Skip to content

Fix flaky test

Mikhail Mazurskiy requested to merge ash2k/fix-flaky-tests into master

Segregate client and server counters. I think it can fail because sometimes order depends on how goroutines/network interact.

From https://gitlab.com/gitlab-org/cluster-integration/gitlab-agent/-/jobs/5680674737#L2265:

=== RUN   TestRequestsInFlightStatsHandler
    requests_in_flight_stats_handler.go:72: Unexpected call to *mock_otel.MockInt64UpDownCounter.Add([context.Background -1 {{{[{grpc_method {4 0 RequestResponse <nil>}} {grpc_service {4 0 gitlab.agent.grpctool.test.Testing <nil>}}]}}}]) at /src/internal/tool/grpctool/requests_in_flight_stats_handler.go:72 because: 
        expected call at /src/internal/tool/grpctool/requests_in_flight_stats_handler_test.go:65 doesn't have a prerequisite call satisfied:
        *mock_otel.MockInt64UpDownCounter.Add(is anything, is equal to -1 (int64), is anything) /src/internal/tool/grpctool/requests_in_flight_stats_handler_test.go:62
        should be called before:
        *mock_otel.MockInt64UpDownCounter.Add(is anything, is equal to -1 (int64), is anything) /src/internal/tool/grpctool/requests_in_flight_stats_handler_test.go:65
        expected call at /src/internal/tool/grpctool/requests_in_flight_stats_handler_test.go:56 doesn't match the argument at index 1.
        Got: -1 (int64)
        Want: is equal to 1 (int64)
    controller.go:98: missing call(s) to *mock_otel.MockInt64UpDownCounter.Add(is anything, is equal to -1 (int64), is anything) /src/internal/tool/grpctool/requests_in_flight_stats_handler_test.go:65
    controller.go:98: aborting test due to missing call(s)
--- FAIL: TestRequestsInFlightStatsHandler (0.00s)

Merge request reports