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

Try to fix flaky test by replacing list comparison with set comparison #480

Merged
merged 2 commits into from
Jun 8, 2020
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/
import com.google.common.io.Files
import javax.servlet.Servlet
import javax.servlet.ServletException
import org.apache.catalina.AccessLog
import org.apache.catalina.Context
import org.apache.catalina.connector.Request
Expand All @@ -27,9 +29,6 @@ import org.apache.tomcat.JarScanType
import spock.lang.Shared
import spock.lang.Unroll

import javax.servlet.Servlet
import javax.servlet.ServletException

import static io.opentelemetry.auto.test.base.HttpServerTest.ServerEndpoint.AUTH_REQUIRED
import static io.opentelemetry.auto.test.base.HttpServerTest.ServerEndpoint.ERROR
import static io.opentelemetry.auto.test.base.HttpServerTest.ServerEndpoint.EXCEPTION
Expand Down Expand Up @@ -125,6 +124,10 @@ abstract class TomcatServlet3Test extends AbstractServlet3Test<Tomcat, Context>

and:
assertTraces(count * 2) {
assert accessLogValue.loggedIds.size() == count
def loggedTraces = accessLogValue.loggedIds*.first
def loggedSpans = accessLogValue.loggedIds*.second

(0..count - 1).each {
trace(it * 2, 1) {
basicSpan(it, 0, "TEST_SPAN")
Expand All @@ -134,9 +137,8 @@ abstract class TomcatServlet3Test extends AbstractServlet3Test<Tomcat, Context>
controllerSpan(it, 1, span(0))
}

def (String traceId, String spanId) = accessLogValue.loggedIds[it]
assert traces[it * 2 + 1][0].traceId.toLowerBase16() == traceId
assert traces[it * 2 + 1][0].spanId.toLowerBase16() == spanId
assert loggedTraces.contains(traces[it * 2 + 1][0].traceId.toLowerBase16())
assert loggedSpans.contains(traces[it * 2 + 1][0].spanId.toLowerBase16())
}
}

Expand Down