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

Adding stubserver support to tests #11

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

Conversation

janardhanvissa
Copy link
Owner

No description provided.

@@ -93,14 +94,32 @@ func (s) TestE2E_CustomBackendMetrics_OutOfBand(t *testing.T) {
opts := orca.ServiceOptions{MinReportingInterval: shortReportingInterval, ServerMetricsProvider: smr}
internal.AllowAnyMinReportingInterval.(func(*orca.ServiceOptions))(&opts)

// Register the OpenRCAService with a very short metrics reporting interval.
blockCh := make(chan struct{})

Choose a reason for hiding this comment

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

why did you introduce a new channel? you can continue to use mutex and define a counter requests as variable

@@ -126,7 +145,7 @@ func (s) TestE2E_CustomBackendMetrics_OutOfBand(t *testing.T) {
errCh <- fmt.Errorf("UnaryCall failed: %v", err)
return
}
time.Sleep(time.Millisecond)
time.Sleep(10 * time.Millisecond)

Choose a reason for hiding this comment

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

why increase the sleep time? if you stick the mutex approach, we will make sure all 20 rpc calls are serialized

s := grpc.NewServer()
if err := orca.Register(s, opts); err != nil {
t.Fatalf("orca.EnableOutOfBandMetricsReportingForTesting() failed: %v", err)
t.Fatalf("orca.Register failed: %v", err)

Choose a reason for hiding this comment

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

why change this? Seems unrelated?

@purnesh42H
Copy link

Delete the testserviceimpl code

@@ -126,7 +116,10 @@ func (s) TestE2E_CustomBackendMetrics_OutOfBand(t *testing.T) {
errCh <- fmt.Errorf("UnaryCall failed: %v", err)
return
}
time.Sleep(time.Millisecond)
mu.Lock()

Choose a reason for hiding this comment

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

why did request counter move here? why can't it remain in stub function?

Copy link
Owner Author

Choose a reason for hiding this comment

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

By managing the counter outside the stub, we can safely increment it in a concurrent context. This will ensure that we accurately track how many requests have been sent, regardless of their processing order or timing.

Copy link

Choose a reason for hiding this comment

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

The counter needs to be updated inside of the UnaryCall and t.smr.SetNamedUtilization(requestsMetricKey, float64(t.requests)*0.01) line should remain like earlier. I don't see a point in hard-coding requestsMetricKey to 0.2.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Done with the above comments. Please re-review once and let me know if any changes are required to be made.

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.

4 participants