-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
cleanup: switching to stubserver in tests instead of testservice implementation #7708
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #7708 +/- ##
==========================================
- Coverage 81.82% 81.26% -0.57%
==========================================
Files 361 368 +7
Lines 27828 36799 +8971
==========================================
+ Hits 22771 29904 +7133
- Misses 3857 5652 +1795
- Partials 1200 1243 +43 |
Can you mention the tests in description you are modifying? |
@janardhanvissa can you split the PRs? 1) orca/, 2) test/xds, 3) rest of xds/ |
orca/service_test.go
Outdated
// will trigger the injection of custom backend metrics from the | ||
// testServiceImpl. | ||
// StubServer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: stubServer
orca/service_test.go
Outdated
const numRequests = 20 | ||
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) | ||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why change the timeout?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, defaultTestTimeout is usually 10 secs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default is 5 secs, getting context deadline issues. So, updated to 10 secs.
orca/service_test.go
Outdated
@@ -138,24 +136,25 @@ func (s) TestE2E_CustomBackendMetrics_OutOfBand(t *testing.T) { | |||
t.Fatalf("Failed to create a stream for out-of-band metrics") | |||
} | |||
|
|||
// Wait for the goroutine to finish before processing metrics. | |||
if err := <-errCh; err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this moved out of for loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test is passing after only a couple of counts, that the metrics might be sent before all the unary calls have been processed. I'm suspecting that the metrics are being flushed too early or there's a synchronization issue with the reporting of metrics. Instead of immediately checking for the expected metrics after sending the requests, we should wait for the goroutine that sends the requests to complete before processing the metrics.
orca/service_test.go
Outdated
default: | ||
} | ||
|
||
wantProto := &v3orcapb.OrcaLoadReport{ | ||
CpuUtilization: 50.0, | ||
MemUtilization: 0.9, | ||
ApplicationUtilization: 1.2, | ||
Utilization: map[string]float64{requestsMetricKey: numRequests * 0.01}, | ||
Utilization: map[string]float64{requestsMetricKey: float64(numRequests) * 0.01}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this change related? Let's avoid unrelated changes
1cc0f68
to
8e937ad
Compare
} | ||
}, | ||
} | ||
// Initialize an xDS-enabled gRPC server and use the helper to start the test service. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment here. Just modify the existing statement instead of writing a new line
@@ -62,13 +63,21 @@ func (s) TestServerSideXDS_RedundantUpdateSuppression(t *testing.T) { | |||
updateCh <- args.Mode | |||
}) | |||
|
|||
// Initialize an xDS-enabled gRPC server and register the stubServer on it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
@@ -206,13 +214,20 @@ func (s) TestServerSideXDS_ServingModeChanges(t *testing.T) { | |||
} | |||
}) | |||
|
|||
// Initialize an xDS-enabled gRPC server and register the stubServer on it. | |||
// Initialize an xDS-enabled gRPC server and use the helper to start the test service. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Initialize an xDS-enabled gRPC server and use the helper to start the test service/Initialize an xDS-enabled gRPC server and sets it on stub server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the comments and pushed the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
You need to rebase to latest main branch to unblock from vet check failure |
adding @easwars for second review |
// credentials, and register the test service on it. Configure a mode change | ||
// option that closes a channel when listener2 enter serving mode. | ||
// Create an xDS-enabled gRPC server that is configured to use xDS | ||
// credentials and sets it on a stub server, configuring a mode change |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/sets it on a stub server/assigned to a stub server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed the comments and pushed the changes. Please re-review once.
9a3b43e
to
fda79a8
Compare
Partially Addresses: #7291
RELEASE NOTES: None