From 7d20fd801a1dc691ba356f7480ad96c37bcc0216 Mon Sep 17 00:00:00 2001 From: wasuradananjith Date: Thu, 10 Mar 2022 10:37:30 +0530 Subject: [PATCH] Remove tenant user for GraphQL sub tests due to https://github.com/wso2/product-apim/issues/12621 --- .../graphql/GraphqlSubscriptionTestCase.java | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/graphql/GraphqlSubscriptionTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/graphql/GraphqlSubscriptionTestCase.java index 8e7dc1a3ba..bed5a039ff 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/graphql/GraphqlSubscriptionTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/graphql/GraphqlSubscriptionTestCase.java @@ -132,8 +132,9 @@ public GraphqlSubscriptionTestCase(TestUserMode userMode) { @DataProvider public static Object[][] userModeDataProvider() { - return new Object[][]{new Object[]{TestUserMode.SUPER_TENANT_ADMIN}, - new Object[]{TestUserMode.TENANT_ADMIN}}; + // Removed the tenant user due to https://github.com/wso2/product-apim/issues/12621 + // Need to revisit this + return new Object[][] { new Object[] { TestUserMode.SUPER_TENANT_ADMIN } }; } @BeforeClass(alwaysRun = true) @@ -425,7 +426,7 @@ public void testGraphQLAPIInvocationWithScopes() throws Exception { // Create Revision and Deploy to Gateway createAPIRevisionAndDeployUsingRest(graphqlApiId, restAPIPublisher); // Keep sufficient time to update map - Thread.sleep(10000); + Thread.sleep(20000); waitForAPIDeploymentSync(apidto.getProvider(), apidto.getName(), apidto.getVersion(), APIMIntegrationConstants.IS_API_EXISTS); // generate token @@ -489,7 +490,7 @@ public void testGraphQLAPIInvocationWithScopes() throws Exception { // Create Revision and Deploy to Gateway createAPIRevisionAndDeployUsingRest(graphqlApiId, restAPIPublisher); // Keep sufficient time to update map - Thread.sleep(10000); + Thread.sleep(20000); waitForAPIDeploymentSync(apidto.getProvider(), apidto.getName(), apidto.getVersion(), APIMIntegrationConstants.IS_API_EXISTS); } @@ -591,8 +592,8 @@ private void invokeGraphQLSubscriptionSuccess(WebSocketClient client, String acc textMessage = "{\"type\":\"connection_init\",\"payload\":{}}"; Thread.sleep(20000); socket.sendMessage(textMessage); - Thread.sleep(20000); waitForReply(socket); + Thread.sleep(40000); assertFalse(StringUtils.isEmpty(socket.getResponseMessage()), "Client did not receive response from server"); assertEquals(socket.getResponseMessage(), "{\"type\":\"connection_ack\"}", @@ -602,9 +603,7 @@ private void invokeGraphQLSubscriptionSuccess(WebSocketClient client, String acc textMessage = "{\"id\":\"1\",\"type\":\"start\",\"payload\":{\"variables\":{},\"extensions\":{}," + "\"operationName\":null,\"query\":" + "\"subscription {\\n liftStatusChange {\\n name\\n }\\n}\\n\"}}"; - Thread.sleep(20000); socket.sendMessage(textMessage); - Thread.sleep(20000); waitForReply(socket); assertFalse(StringUtils.isEmpty(socket.getResponseMessage()), "Client did not receive response from server"); @@ -789,6 +788,7 @@ private void invokeGraphQLSubscriptionScopeInvalidError(WebSocketClient client, socket.sendMessage(textMessage); Thread.sleep(20000); waitForReply(socket); + Thread.sleep(20000); assertFalse(StringUtils.isEmpty(socket.getResponseMessage()), "Client did not receive response from server"); assertEquals(socket.getResponseMessage(), "{\"type\":\"connection_ack\"}", @@ -798,9 +798,7 @@ private void invokeGraphQLSubscriptionScopeInvalidError(WebSocketClient client, textMessage = "{\"id\":\"1\",\"type\":\"start\",\"payload\":{\"variables\":{},\"extensions\":{}," + "\"operationName\":null,\"query\":" + "\"subscription {\\n liftStatusChange {\\n name\\n }\\n}\\n\"}}"; - Thread.sleep(20000); socket.sendMessage(textMessage); - Thread.sleep(20000); waitForReply(socket); assertFalse(StringUtils.isEmpty(socket.getResponseMessage()), "Client did not receive response from server"); @@ -844,6 +842,7 @@ private void invokeGraphQLSubscriptionForComplexityError(WebSocketClient client, socket.sendMessage(textMessage); Thread.sleep(20000); waitForReply(socket); + Thread.sleep(20000); assertFalse(StringUtils.isEmpty(socket.getResponseMessage()), "Client did not receive response from server"); assertEquals(socket.getResponseMessage(), "{\"type\":\"connection_ack\"}", @@ -853,9 +852,7 @@ private void invokeGraphQLSubscriptionForComplexityError(WebSocketClient client, textMessage = "{\"id\":\"1\",\"type\":\"start\",\"payload\":{\"variables\":{},\"extensions\":{}," + "\"operationName\":null,\"query\": \"subscription {\\n " + "liftStatusChange {\\n name\\n id\\n status\\n night\\n capacity\\n }\\n}\\n\"}}"; - Thread.sleep(20000); socket.sendMessage(textMessage); - Thread.sleep(20000); waitForReply(socket); assertFalse(StringUtils.isEmpty(socket.getResponseMessage()), "Client did not receive response from server"); @@ -896,10 +893,11 @@ private void invokeGraphQLSubscriptionForDepthError(WebSocketClient client, Stri String textMessage; //Send connection init message textMessage = "{\"type\":\"connection_init\",\"payload\":{}}"; - Thread.sleep(20000); + Thread.sleep(40000); socket.sendMessage(textMessage); - Thread.sleep(20000); + Thread.sleep(30000); waitForReply(socket); + Thread.sleep(30000); assertFalse(StringUtils.isEmpty(socket.getResponseMessage()), "Client did not receive response from server"); assertEquals(socket.getResponseMessage(), "{\"type\":\"connection_ack\"}", @@ -909,9 +907,7 @@ private void invokeGraphQLSubscriptionForDepthError(WebSocketClient client, Stri textMessage = "{\"id\":\"1\",\"type\":\"start\",\"payload\":{\"variables\":{},\"extensions\":{}," + "\"operationName\":null,\"query\": \"subscription {\\n " + "liftStatusChange {\\n name\\n}\\n}\\n\"}}"; - Thread.sleep(20000); socket.sendMessage(textMessage); - Thread.sleep(20000); waitForReply(socket); assertFalse(StringUtils.isEmpty(socket.getResponseMessage()), "Client did not receive response from server"); @@ -952,10 +948,11 @@ private void invokeGraphQLSubscriptionForInvalidPayloadError(WebSocketClient cli String textMessage; //Send connection init message textMessage = "{\"type\":\"connection_init\",\"payload\":{}}"; - Thread.sleep(20000); + Thread.sleep(40000); socket.sendMessage(textMessage); - Thread.sleep(20000); + Thread.sleep(30000); waitForReply(socket); + Thread.sleep(30000); assertFalse(StringUtils.isEmpty(socket.getResponseMessage()), "Client did not receive response from server"); assertEquals(socket.getResponseMessage(), "{\"type\":\"connection_ack\"}", @@ -965,9 +962,7 @@ private void invokeGraphQLSubscriptionForInvalidPayloadError(WebSocketClient cli textMessage = "{\"id\":\"1\",\"type\":\"start\",\"payload\":{\"variables\":{},\"extensions\":{}," + "\"operationName\":null,\"query\": \"subscription {\\n " + "liftStatusChange {\\n name\\n invalidField\\n }\\n}\\n\"}}"; - Thread.sleep(20000); socket.sendMessage(textMessage); - Thread.sleep(20000); waitForReply(socket); assertFalse(StringUtils.isEmpty(socket.getResponseMessage()), "Client did not receive response from server"); @@ -1009,6 +1004,7 @@ private void testThrottling(String accessToken) throws Exception { String textMessage; //Send connection init message textMessage = "{\"type\":\"connection_init\",\"payload\":{}}"; + Thread.sleep(10000); socket.sendMessage(textMessage); waitForReply(socket); assertFalse(StringUtils.isEmpty(socket.getResponseMessage()),