mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-10 13:37:08 +08:00
correctly remove duplicated secrets and ssh keys
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
@ -82,4 +82,17 @@ func TestSSHKeys(t *testing.T) {
|
||||
result := actual.Equals(expected)
|
||||
require.True(t, result.True())
|
||||
})
|
||||
|
||||
t.Run("RemoveDupes", func(t *testing.T) {
|
||||
sshkeys := SSHKeys{
|
||||
{ID: "default"},
|
||||
{ID: "key", Paths: []string{"path/to/foo"}},
|
||||
{ID: "key", Paths: []string{"path/to/bar"}},
|
||||
}.Normalize()
|
||||
|
||||
expected := `[{"id":"default"},{"id":"key","paths":["path/to/bar"]}]`
|
||||
actual, err := json.Marshal(sshkeys)
|
||||
require.NoError(t, err)
|
||||
require.JSONEq(t, expected, string(actual))
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user