Skip to content

Commit

Permalink
tests: managed keys are not accumulated (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
shoenig authored Nov 26, 2022
1 parent 0fd1784 commit f0b08cc
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
1 change: 0 additions & 1 deletion internal/ssh/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ func (r *reader) ReadKeys(filename string) (*set.Set[Key], error) {
}
key, err := ParseKey(line, managed)
if err != nil {
// log something
continue
}
keys.Insert(key)
Expand Down
20 changes: 1 addition & 19 deletions internal/ssh/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func compareToFile(t *testing.T, filename string, expected []Key) {
reader := NewKeysReader()
keys, err := reader.ReadKeys(filename)
must.NoError(t, err)
must.SliceContainsSubset(t, expected, keys.List()) // FIXME (should be 6)
must.SliceContainsAll(t, expected, keys.List())
}

func Test_read_1(t *testing.T) {
Expand Down Expand Up @@ -46,24 +46,6 @@ func Test_read_2(t *testing.T) {
"h1",
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAADJKlkjkfjlkjff==",
),
key(
true,
"alice",
"h1",
"ssh-rsa AAAAB3NzaD1yc2EAAAADAQABAAAAgQCoiewjflsdf==",
),
key(
true,
"alice",
"h2",
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDQ9Tf0lycls==",
),
key(
true,
"bob",
"h2",
"ssh-edsa AAAAB3NzaC1yc2EAdlksjflksdjflksdjflsdkdj==",
),
}

compareToFile(t, "../../hack/tests/authorized_keys.2", expected)
Expand Down

0 comments on commit f0b08cc

Please sign in to comment.