aws / aws-xray-sdk-go

AWS X-Ray SDK for the Go programming language.
Apache License 2.0
276 stars 117 forks source link

Local test daemon for grpc server test cases #375

Closed srprash closed 2 years ago

srprash commented 2 years ago

Issue: For the last few runs of the unit test CI, the TestUnaryServerInterceptor has been failing due to inconsistent segment across test cases.

Description of changes: The cause for above flaky test cases failure is the shared channel in the TestDaemon for the test cases. I tested through a separate experiment that a channel in Go is not guaranteed to return the same value in a goroutine which was put there by the same goroutine. In the test cases, there are 4 goroutines created (when the test runs with -race flag) which create individual segments but retrieve the segment through the common test daemon channel. This leads to a segment of one test case leaking into another.

To avoid segment mismatch across test cases, we can have a local instance of test daemon for each test case.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.