test(nvcf-cli): TestResolveStack_GitURI_DispatchesToGitResolver opens a real SSH connection and blocks go test on a host-key prompt

Aperta Adatta ai principianti
#3,630 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
91/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
git, go
Ambito
cli, testing

Direzione di ricerca

Leggi src/clis/nvcf-cli/internal/selfhosted/stack_test.go, in particolare TestResolveStack_GitURI_DispatchesToGitResolver, e verifica come ResolveStack invoca il resolver Git. Esegui il test specifico con GIT_SSH_COMMAND=false, come descritto nell’issue; il lavoro è completo quando il test verifica l’instradamento al resolver senza aprire una vera connessione SSH né bloccarsi in attesa della conferma della chiave host.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

cicd needs-triage

Problem

TestResolveStack_GitURI_DispatchesToGitResolver
(src/clis/nvcf-cli/internal/selfhosted/stack_test.go) calls ResolveStack with
[email protected]:nonexistent/nonexistent.git, so resolveGit runs a real
git clone over SSH to github.com.

The test's comment says "The point is to verify dispatch, not network
reachability," but the test depends on SSH and the network. On a machine where
github.com is not in known_hosts, SSH asks the host-key question on the terminal,
and go test ./... stops until someone answers:

The authenticity of host 'github.com (...)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
Are you sure you want to continue connecting (yes/no/[fingerprint])?

In CI there is no terminal, so SSH fails fast and the test passes, which hides this.

Steps to reproduce

  1. Fresh environment (I used a GitHub Codespace on main 31e209e64) with no
    github.com entry in ~/.ssh/known_hosts.
  2. cd src/clis/nvcf-cli && go test ./...
  3. The run blocks on the host-key prompt in internal/selfhosted.

Suggested fix

Keep the test off the network so it only verifies dispatch, for example:

t.Setenv("GIT_SSH_COMMAND", "false")

before calling ResolveStack. Git then fails immediately with no prompt, and the
existing assertions (an error containing "git ") still hold. Verified with
GIT_SSH_COMMAND=false go test ./internal/selfhosted/ -run TestResolveStack_GitURI_DispatchesToGitResolver -v.
Happy to send the PR.

Lingua principale
Go
Stelle
251
Fork
100
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NVIDIA/nvcf

Tutte le issue di NVIDIA/nvcf

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.