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

Add acceptance test for deleting connetion #11563

Merged
merged 16 commits into from
Apr 4, 2022

Conversation

terencecho
Copy link
Contributor

@terencecho terencecho commented Mar 30, 2022

What

Add an acceptance test to check that we are able to delete a connection during a normal state and even when the state of the temporal workflow is in a terminal state. This behavior was originally committed in this PR: #11302 with unit tests and verified manually, but lacked an acceptance test.

@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 04:21 Inactive
@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 05:01 Inactive
@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 05:04 Inactive
@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 06:24 Inactive
@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 06:24 Inactive
@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 07:29 Inactive
@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 07:30 Inactive
@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 08:00 Inactive
@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 08:00 Inactive
@terencecho
Copy link
Contributor Author

running into this error in the github builds

AcceptanceTests > testActionsWhenTemporalIsInTerminalState() FAILED
    io.grpc.StatusRuntimeException: NOT_FOUND: sql: no rows in result set
        at app//io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:262)
        at app//io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:243)
        at app//io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:156)
        at app//io.temporal.api.workflowservice.v1.WorkflowServiceGrpc$WorkflowServiceBlockingStub.terminateWorkflowExecution(WorkflowServiceGrpc.java:2884)
        at app//io.temporal.internal.client.external.GenericWorkflowClientExternalImpl.lambda$terminate$4(GenericWorkflowClientExternalImpl.java:202)
        at app//io.temporal.internal.retryer.GrpcRetryer.lambda$retry$0(GrpcRetryer.java:44)
        at app//io.temporal.internal.retryer.GrpcSyncRetryer.retry(GrpcSyncRetryer.java:61)
        at app//io.temporal.internal.retryer.GrpcRetryer.retryWithResult(GrpcRetryer.java:51)
        at app//io.temporal.internal.retryer.GrpcRetryer.retry(GrpcRetryer.java:41)
        at app//io.temporal.internal.client.external.GenericWorkflowClientExternalImpl.terminate(GenericWorkflowClientExternalImpl.java:195)
        at app//io.temporal.internal.client.RootWorkflowClientInvoker.terminate(RootWorkflowClientInvoker.java:174)
        at app//io.temporal.internal.sync.WorkflowStubImpl.terminate(WorkflowStubImpl.java:376)
        at app//io.airbyte.test.acceptance.AcceptanceTests.testActionsWhenTemporalIsInTerminalState(AcceptanceTests.java:1187)

which seems to suggest that it's having problems finding the workflow in the temporal database.

@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 18:37 Inactive
@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 18:38 Inactive
@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 19:46 Inactive
@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 19:46 Inactive
@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 20:09 Inactive
@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 20:09 Inactive
@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 20:17 Inactive
@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 20:17 Inactive
@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 21:06 Inactive
@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 21:06 Inactive
@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 22:23 Inactive
@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 22:23 Inactive
@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 23:19 Inactive
@terencecho terencecho temporarily deployed to more-secrets March 30, 2022 23:19 Inactive
@terencecho
Copy link
Contributor Author

terencecho commented Mar 30, 2022

I found it weird that it didn’t work when i tried

@EnabledIfEnvironmentVariable(named = "NEW_SCHEDULER",
                              matches = "true")

but worked when i did the following

    final FeatureFlags featureFlags = new EnvVariableFeatureFlags();
    if (!featureFlags.usesNewScheduler()) {
      LOGGER.info("Skipping test since not using new temporal scheduler");
      return;
    }

although i think if i can get the first approach to work, it would be better, since the log lines were not outputted here. I would need to find where to access the standard output of the acceptance tests. I verified that the test was actually ran by running it locally.

Copy link
Contributor

@benmoriceau benmoriceau left a comment

Choose a reason for hiding this comment

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

Thanks for improving the acceptance coverage! I only have minor comments.


// Terminate workflow
LOGGER.info("Terminating temporal workflow...");
workflowCLient.newUntypedWorkflowStub("connection_manager_" + connectionId).terminate("");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we extract the termination in its own method? It will be needed for other tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

workflowCLient.newUntypedWorkflowStub("connection_manager_" + connectionId).terminate("");

// expect an exception because the temporal workflow is not running
Assertions.assertThatExceptionOfType(ApiException.class)
Copy link
Contributor

Choose a reason for hiding this comment

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

We should remove that, it won't throw exception later on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense. removed

@@ -1147,6 +1152,57 @@ public void testCancelSyncWhenCancelledWhenWorkerIsNotRunning() throws Exception
assertEquals(JobStatus.CANCELLED, resp.get().getJob().getStatus());
}

@Test
@Order(22)
@DisabledIfEnvironmentVariable(named = "KUBE",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason to not run on Kube?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

originally i thought we would have to do some extra stuff to get it working on kube, but i guess that's not the case. it's been removed.

@terencecho terencecho changed the title Add acceptance test for deleting connetion in bad temporal state Add acceptance test for deleting connetion Mar 31, 2022
@terencecho terencecho temporarily deployed to more-secrets March 31, 2022 03:48 Inactive
@terencecho terencecho temporarily deployed to more-secrets March 31, 2022 03:48 Inactive
@terencecho
Copy link
Contributor Author

@benmoriceau PTAL. i refactored it to cover both the normal case and the temporal in a bad state case.

@terencecho terencecho merged commit 568f112 into master Apr 4, 2022
@terencecho terencecho deleted the tcho/11214-acceptance-tests branch April 4, 2022 17:51
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.

2 participants