pacman, ssh-client: tests read nothing of the machine, so the unit level passes shut off and on a desk (issue 1891)
pacman-conf proved the shipped pacman.conf through its Include of /etc/pacman.d/mirrorlist, which the shut-off unit level does not have: the proven file now reads a mirror list of its own, and a guard test holds that every repository of the shipped file includes the list reflector writes. ssh-client's Test case for a run without an agent read the account's SSH_AUTH_SOCK, so it failed on any desk with an agent: it now sets its own, and also proves the environment's agent is the one reported.
This commit is contained in:
@@ -311,6 +311,8 @@ func TestAnUnreachableHostIsNotRefreshed(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTestSaysHowItAuthenticatedOrWhyNot(t *testing.T) {
|
||||
// The test's own agent, none: the account running it may have one, and the unit level runs with none (issue 1891).
|
||||
t.Setenv("SSH_AUTH_SOCK", "")
|
||||
ok := "debug1: Connecting to ace.internal [10.0.0.2] port 22.\ndebug1: Server accepts key: /h/.ssh/id_ed25519 ED25519 " + edFP + "\nAuthenticated to ace.internal ([10.0.0.2]:22) using \"publickey\".\n"
|
||||
f := &fake{answer: func(c call) forgekey.Ran { return forgekey.Ran{Stderr: ok} }}
|
||||
got, err := client(t.TempDir(), f).Test(context.Background(), "ace")
|
||||
@@ -327,9 +329,15 @@ func TestTestSaysHowItAuthenticatedOrWhyNot(t *testing.T) {
|
||||
if got["ok"] != false || got["why"] != "no key it offered was accepted" || !reflect.DeepEqual(got["offered"], []string{"/h/.ssh/id_box"}) {
|
||||
t.Fatalf("%v", got)
|
||||
}
|
||||
if !strings.Contains(got["note"].(string), "agent") {
|
||||
if note, _ := got["note"].(string); !strings.Contains(note, "agent") {
|
||||
t.Fatalf("no word on the agent: %v", got)
|
||||
}
|
||||
agent := filepath.Join(t.TempDir(), "agent.sock")
|
||||
t.Setenv("SSH_AUTH_SOCK", agent)
|
||||
got, _ = client(t.TempDir(), f).Test(context.Background(), "ace")
|
||||
if got["agent"] != agent || got["note"] != nil {
|
||||
t.Fatalf("the environment's agent is not the one it ran with, or a passphrase note without a passphrase: %v", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCheckFindsWhatIsWrongAndSaysWhatItDidNotCheck(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user