Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] testing flaky tests #1260

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions protocol/daemons/slinky/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package client_test

import (
"context"
"net"
"testing"
"time"

Comment on lines 2 to 7
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [32-32]

The gRPC server is created without specifying credentials, which could lead to insecure communication. Even though this is a test environment, adopting best practices for secure communication is beneficial. Consider adding SSL/TLS credentials to the gRPC server setup. Here's an example of how to add credentials to the server:

+ import "google.golang.org/grpc/credentials"

  grpcServer := grpc.NewServer(
+   grpc.Creds(credentials.NewServerTLSFromFile("cert.pem", "cert.key")),
  )

Ensure you have the cert.pem and cert.key files available in your test environment. This change enhances the security of your gRPC communication during testing.

Expand Down Expand Up @@ -44,12 +43,14 @@ func TestClient(t *testing.T) {
)

defer grpcServer.Stop()
go func() {
ls, err := net.Listen("tcp", appFlags.GrpcAddress)
require.NoError(t, err)
err = grpcServer.Serve(ls)
require.NoError(t, err)
}()
/*
go func() {
ls, err := net.Listen("tcp", appFlags.GrpcAddress)
require.NoError(t, err)
err = grpcServer.Serve(ls)
require.NoError(t, err)
}()
*/
Comment on lines +46 to +53
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes from lines 47 to 54 involve commenting out the gRPC server setup within a goroutine. While this might be an attempt to address flaky tests, it's essential to investigate the root cause of the flakiness. Disabling parts of the test setup can reduce the test's effectiveness in simulating real-world scenarios. Consider alternative solutions that maintain the integrity of the test setup, such as adjusting timeouts, using more deterministic data, or isolating external dependencies.

Would you like assistance in exploring alternative solutions to address the test flakiness while keeping the test setup intact?


slinky.On("Stop").Return(nil)
slinky.On("Start", mock.Anything).Return(nil).Once()
Expand Down
Loading