Skip to content

Fix test flake

Mikhail Mazurskiy requested to merge ash2k/fix-test-flake into master

Those method calls are not actually ordered.

=== RUN   TestRouter_UnaryHappyPath
    logger.go:130: 2024-01-08T09:04:24.491Z	DEBUG	Trying tunnel	{"agent_id": 123, "kas_url": "grpc://127.0.0.1:34951"}
    router_agent.go:38: Unexpected call to *mock_tunnel_server.MockFinder.FindTunnel([context.Background.WithValue(type transport.connectionKey, val <not Stringer>).WithValue(type peer.peerKey, val <not Stringer>).WithValue(type grpctool.maxConnAgeCtxKeyType, val 2024-01-08 09:04:24.492091097 +0000 UTC m=+0.060919959).WithCancel.WithValue(type metadata.mdIncomingKey, val <not Stringer>).WithValue(type grpc.serverKey, val <not Stringer>).WithValue(type grpctool.maxConnAgeCtxKeyType, val context.Background.WithCancel).WithValue(type grpc.streamKey, val <not Stringer>).WithValue(type grpc.rpcInfoContextKey, val <not Stringer>).WithValue(type modserver.rpcApiKeyType, val <not Stringer>).WithValue(type metadata.mdIncomingKey, val <not Stringer>) 123 gitlab.agent.grpctool.test.Testing RequestResponse]) at /src/cmd/kas/kasapp/router_agent.go:38 because: 
        expected call at /src/cmd/kas/kasapp/router_test.go:409 doesn't have a prerequisite call satisfied:
        *mock_tunnel_server.MockPollingQuerier.CachedKasUrlsByAgentId(is equal to 123 (int64)) /src/cmd/kas/kasapp/router_test.go:407
        should be called before:
        *mock_tunnel_server.MockFinder.FindTunnel(is anything, is equal to 123 (int64), is anything, is anything) /src/cmd/kas/kasapp/router_test.go:409
    router_kas_tunnel_finder.go:131: Unexpected call to *mock_tunnel_server.MockPollingQuerier.PollKasUrlsByAgentId([context.Background.WithValue(type transport.connectionKey, val <not Stringer>).WithValue(type peer.peerKey, val <not Stringer>).WithValue(type grpctool.maxConnAgeCtxKeyType, val 2024-01-08 09:04:24.491147697 +0000 UTC m=+0.059976559).WithCancel.WithValue(type metadata.mdIncomingKey, val <not Stringer>).WithValue(type grpc.serverKey, val <not Stringer>).WithValue(type grpctool.maxConnAgeCtxKeyType, val context.Background.WithCancel).WithValue(type grpc.streamKey, val <not Stringer>).WithValue(type grpc.rpcInfoContextKey, val <not Stringer>).WithValue(type modserver.rpcApiKeyType, val <not Stringer>).WithValue(type trace.traceContextKeyType, val <not Stringer>).WithDeadline(2024-01-08 09:04:44.491295337 +0000 UTC m=+20.060124199 [14.997910043s]).WithCancel 123 0xd242f0]) at /src/cmd/kas/kasapp/router_kas_tunnel_finder.go:131 because: there are no expected calls of the method "PollKasUrlsByAgentId" for that receiver
    logger.go:130: 2024-01-08T09:04:44.492Z	ERROR	Agent connection not found	{"agent_id": 123, "error": "context deadline exceeded"}
    router_test.go:65: 
        	Error Trace:	/src/cmd/kas/kasapp/router_test.go:65
        	            				/src/cmd/kas/kasapp/router_test.go:496
        	            				/src/cmd/kas/kasapp/router_test.go:61
        	Error:      	Received unexpected error:
        	            	rpc error: code = DeadlineExceeded desc = Agent connection not found. Is agent up to date and connected?
        	Test:       	TestRouter_UnaryHappyPath
    controller.go:98: missing call(s) to *mock_tunnel_server.MockFinder.FindTunnel(is anything, is equal to 123 (int64), is anything, is anything) /src/cmd/kas/kasapp/router_test.go:409
    controller.go:98: missing call(s) to *mock_tunnel_server.MockFindHandle.Get(is anything) /src/cmd/kas/kasapp/router_test.go:412
    controller.go:98: missing call(s) to *mock_tunnel_server.MockFindHandle.Done(is anything) /src/cmd/kas/kasapp/router_test.go:415
    controller.go:98: aborting test due to missing call(s)
    controller.go:98: missing call(s) to *mock_tunnel_server.MockTunnel.ForwardStream(is anything, is anything, is anything, is anything) /src/cmd/kas/kasapp/router_test.go:59
    controller.go:98: missing call(s) to *mock_tunnel_server.MockTunnel.Done(is anything) /src/cmd/kas/kasapp/router_test.go:414
    controller.go:98: aborting test due to missing call(s)
--- FAIL: TestRouter_UnaryHappyPath (20.00s)

Merge request reports

Loading