diff --git a/pkg/api/message/v3/service.go b/pkg/api/message/v3/service.go index 1afbbdb8..a729d24d 100644 --- a/pkg/api/message/v3/service.go +++ b/pkg/api/message/v3/service.go @@ -265,7 +265,7 @@ func validatePublishWelcomesRequest(req *proto.PublishWelcomesRequest) error { return status.Errorf(codes.InvalidArgument, "invalid welcome message") } ciphertext := welcome.WelcomeMessage.GetV1().Ciphertext - if ciphertext == nil || len(ciphertext) == 0 { + if len(ciphertext) == 0 { return status.Errorf(codes.InvalidArgument, "invalid welcome message") } } diff --git a/pkg/api/message/v3/service_test.go b/pkg/api/message/v3/service_test.go index 80755c01..10da71da 100644 --- a/pkg/api/message/v3/service_test.go +++ b/pkg/api/message/v3/service_test.go @@ -70,10 +70,12 @@ func newTestService(t *testing.T, ctx context.Context) (*Service, *bun.DB, *mock ReaderDB: messageDb, CleanerDB: messageDb, }) + require.NoError(t, err) node, nodeCleanup := test.NewNode(t) mlsValidationService := newMockedValidationService() svc, err := NewService(node, log, messageStore, mlsStore, mlsValidationService) + require.NoError(t, err) return svc, mlsDb, mlsValidationService, func() { messageStore.Close() diff --git a/pkg/store/query_test.go b/pkg/store/query_test.go index afd087cf..0a57e96e 100644 --- a/pkg/store/query_test.go +++ b/pkg/store/query_test.go @@ -303,6 +303,7 @@ func TestMlsMessagePublish(t *testing.T) { response, err := store.Query(&messagev1.QueryRequest{ ContentTopics: []string{contentTopic}, }) + require.NoError(t, err) require.Len(t, response.Envelopes, 1) require.Equal(t, response.Envelopes[0].Message, message) require.Equal(t, response.Envelopes[0].ContentTopic, contentTopic) diff --git a/pkg/testing/random.go b/pkg/testing/random.go index 3d0d4e9c..508331db 100644 --- a/pkg/testing/random.go +++ b/pkg/testing/random.go @@ -1,6 +1,7 @@ package testing import ( + cryptoRand "crypto/rand" "math/rand" "strings" ) @@ -21,6 +22,6 @@ func RandomStringLower(n int) string { func RandomBytes(n int) []byte { b := make([]byte, n) - _, _ = rand.Read(b) + _, _ = cryptoRand.Read(b) return b }