cmd/uplink: Fix a faulty test (#2054)

The test was not considering the proper length of a slice generated with
a random length.
This commit is contained in:
Ivan Fraixedes 2019-05-24 19:55:46 +02:00 committed by Jess G
parent 5c50aac661
commit 2cdc55d345

View File

@ -70,7 +70,12 @@ func TestUseOrLoadEncryptionKeyIntoEncryptionAccess(t *testing.T) {
access, err := useOrLoadEncryptionAccess(string(rawKey), "")
require.NoError(t, err)
require.Equal(t, rawKey[:storj.KeySize], access.Key[:])
if len(rawKey) > storj.KeySize {
require.Equal(t, rawKey[:storj.KeySize], access.Key[:])
} else {
require.Equal(t, rawKey, access.Key[:len(rawKey)])
}
})
t.Run("error", func(t *testing.T) {