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

test: modify tests to use stubserver instead of test service #7976

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

pvsravani
Copy link
Contributor

Partially Addresses: #7291

RELEASE NOTES: None

Copy link

codecov bot commented Dec 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.04%. Comparing base (724f450) to head (0638cda).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7976      +/-   ##
==========================================
- Coverage   82.05%   82.04%   -0.01%     
==========================================
  Files         381      381              
  Lines       38539    38539              
==========================================
- Hits        31622    31620       -2     
+ Misses       5602     5598       -4     
- Partials     1315     1321       +6     

see 26 files with indirect coverage changes

}
healthgrpc.RegisterHealthServer(stub.S, ts)
stubserver.StartTestService(t, stub)
t.Cleanup(func() { stub.Stop() })
Copy link
Contributor

Choose a reason for hiding this comment

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

should be stub.S.Stop()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

errCh := make(chan error)
go func() {
errCh <- s.Serve(l)
errCh <- ss.S.Serve(ss.Listener)
Copy link
Contributor

Choose a reason for hiding this comment

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

we should remove the redundant Serve since StartTestService already start the server. This has to be followed for every change. Please keep in mind for future changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

@janardhanvissa janardhanvissa left a comment

Choose a reason for hiding this comment

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

LGTM!

return s, lis, ts
stub := &stubserver.StubServer{
Listener: lis,
EmptyCallF: func(_ context.Context, _ *testpb.Empty) (*testpb.Empty, error) {
Copy link
Contributor

@purnesh42H purnesh42H Jan 6, 2025

Choose a reason for hiding this comment

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

From where did this EmptyCallF and FullDuplexCallF implementation taken from? How is this being used? I can't find it. The testServer{} which is being replaced has totally different implementation here

func (s *testServer) EmptyCall(ctx context.Context, _ *testpb.Empty) (*testpb.Empty, error) {

@@ -255,6 +246,5 @@ func (s) TestConnsCleanup(t *testing.T) {
t.Fatalf("timeout waiting for lis wrapper conns to clear, size: %v", lenConns)
}

server.Stop()
wg.Wait()
ss.S.Stop()
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be done right after stubserver.StartTestService() as defer statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants