From 1292a00ef95ba4a10c79a80e0a0f03f911e22ad2 Mon Sep 17 00:00:00 2001 From: Ekaterina Pavlova Date: Sun, 28 Apr 2024 00:06:17 +0530 Subject: [PATCH] crypto: adjust TestPublicKeys_Copy Since the AllowedGroups []*keys.PublicKey slice is used in the initialization, the test should use the same structures. Signed-off-by: Ekaterina Pavlova --- pkg/crypto/keys/publickey_test.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/crypto/keys/publickey_test.go b/pkg/crypto/keys/publickey_test.go index 1f05c7b30..1f9e5bba9 100644 --- a/pkg/crypto/keys/publickey_test.go +++ b/pkg/crypto/keys/publickey_test.go @@ -42,14 +42,18 @@ func TestEncodeDecodePublicKey(t *testing.T) { func TestPublicKeys_Copy(t *testing.T) { require.Nil(t, (PublicKeys)(nil).Copy()) - pubs := make(PublicKeys, 5) - for i := range pubs { + pubz := make([]*PublicKey, 5) + for i := range pubz { priv, err := NewPrivateKey() require.NoError(t, err) - pubs[i] = priv.PublicKey() + pubz[i] = priv.PublicKey() } + pubs := PublicKeys(pubz) cp := pubs.Copy() + var pubx = ([]*PublicKey)(cp) + require.Equal(t, pubz, pubx) + priv, err := NewPrivateKey() require.NoError(t, err) cp[0] = priv.PublicKey()