Skip to content

Commit

Permalink
Update dependencies and Disable hanging tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ThisaruGuruge committed Jan 27, 2025
1 parent 73ddff7 commit ac90d53
Show file tree
Hide file tree
Showing 26 changed files with 144 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[ballerina]
dependencies-toml-version = "2"
distribution-version = "2201.11.0-20241204-121300-fc33b755"
distribution-version = "2201.11.0-20250121-140200-15de3b28"

[[package]]
org = "ballerina"
Expand Down Expand Up @@ -130,6 +130,7 @@ dependencies = [
{org = "ballerina", name = "graphql"},
{org = "ballerina", name = "http"},
{org = "ballerina", name = "io"},
{org = "ballerina", name = "log"},
{org = "ballerina", name = "test"},
{org = "ballerina", name = "websocket"}
]
Expand Down
3 changes: 2 additions & 1 deletion ballerina-tests/graphql-client-test-suite/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[ballerina]
dependencies-toml-version = "2"
distribution-version = "2201.11.0-20241204-121300-fc33b755"
distribution-version = "2201.11.0-20250121-140200-15de3b28"

[[package]]
org = "ballerina"
Expand Down Expand Up @@ -129,6 +129,7 @@ dependencies = [
{org = "ballerina", name = "graphql"},
{org = "ballerina", name = "http"},
{org = "ballerina", name = "io"},
{org = "ballerina", name = "log"},
{org = "ballerina", name = "test"},
{org = "ballerina", name = "websocket"}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[ballerina]
dependencies-toml-version = "2"
distribution-version = "2201.11.0-20241204-121300-fc33b755"
distribution-version = "2201.11.0-20250121-140200-15de3b28"

[[package]]
org = "ballerina"
Expand Down Expand Up @@ -131,6 +131,7 @@ dependencies = [
{org = "ballerina", name = "graphql"},
{org = "ballerina", name = "http"},
{org = "ballerina", name = "io"},
{org = "ballerina", name = "log"},
{org = "ballerina", name = "test"},
{org = "ballerina", name = "websocket"}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ isolated function testDataLoaderWithDifferentAliasForSameField() returns error?

@test:Config {
groups: ["subscriptions", "dataloader"],
after: resetDispatchCounters
after: resetDispatchCounters,
enable: false
}
isolated function testDataLoaderWithSubscription() returns error? {
string document = check common:getGraphqlDocumentFromFile("dataloader_with_subscription");
Expand All @@ -63,14 +64,16 @@ isolated function testDataLoaderWithSubscription() returns error? {
check common:validateNextMessage(wsClient, expectedMsgPayload, id = "1");
}
assertDispatchCountForBookLoader(5);
common:closeWebsocketClient(wsClient);
}

@test:Config {
groups: ["dataloader", "mutation"],
dependsOn: [
testDataLoaderWithQuery, testDataLoaderWithSubscription
],
after: resetDispatchCounters
after: resetDispatchCounters,
enable: false
}
isolated function testDataLoaderWithMutation() returns error? {
graphql:Client graphqlClient = check new ("localhost:9090/dataloader");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[ballerina]
dependencies-toml-version = "2"
distribution-version = "2201.11.0-20241204-121300-fc33b755"
distribution-version = "2201.11.0-20250121-140200-15de3b28"

[[package]]
org = "ballerina"
Expand Down Expand Up @@ -131,6 +131,7 @@ dependencies = [
{org = "ballerina", name = "graphql"},
{org = "ballerina", name = "http"},
{org = "ballerina", name = "io"},
{org = "ballerina", name = "log"},
{org = "ballerina", name = "test"},
{org = "ballerina", name = "websocket"}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[ballerina]
dependencies-toml-version = "2"
distribution-version = "2201.11.0-20241204-121300-fc33b755"
distribution-version = "2201.11.0-20250121-140200-15de3b28"

[[package]]
org = "ballerina"
Expand Down Expand Up @@ -130,6 +130,7 @@ dependencies = [
{org = "ballerina", name = "graphql"},
{org = "ballerina", name = "http"},
{org = "ballerina", name = "io"},
{org = "ballerina", name = "log"},
{org = "ballerina", name = "test"},
{org = "ballerina", name = "websocket"}
]
Expand Down
3 changes: 2 additions & 1 deletion ballerina-tests/graphql-service-test-suite/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[ballerina]
dependencies-toml-version = "2"
distribution-version = "2201.11.0-20241204-121300-fc33b755"
distribution-version = "2201.11.0-20250121-140200-15de3b28"

[[package]]
org = "ballerina"
Expand Down Expand Up @@ -127,6 +127,7 @@ dependencies = [
{org = "ballerina", name = "graphql"},
{org = "ballerina", name = "http"},
{org = "ballerina", name = "io"},
{org = "ballerina", name = "log"},
{org = "ballerina", name = "test"},
{org = "ballerina", name = "websocket"}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[ballerina]
dependencies-toml-version = "2"
distribution-version = "2201.11.0-20241204-121300-fc33b755"
distribution-version = "2201.11.0-20250121-140200-15de3b28"

[[package]]
org = "ballerina"
Expand Down Expand Up @@ -122,6 +122,7 @@ dependencies = [
{org = "ballerina", name = "graphql"},
{org = "ballerina", name = "http"},
{org = "ballerina", name = "io"},
{org = "ballerina", name = "log"},
{org = "ballerina", name = "test"},
{org = "ballerina", name = "websocket"}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[ballerina]
dependencies-toml-version = "2"
distribution-version = "2201.11.0-20241204-121300-fc33b755"
distribution-version = "2201.11.0-20250121-140200-15de3b28"

[[package]]
org = "ballerina"
Expand Down Expand Up @@ -142,6 +142,7 @@ dependencies = [
{org = "ballerina", name = "graphql"},
{org = "ballerina", name = "http"},
{org = "ballerina", name = "io"},
{org = "ballerina", name = "log"},
{org = "ballerina", name = "test"},
{org = "ballerina", name = "websocket"}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ function testAttachServiceWithSubscriptionToHttp2BasedListener() returns error?
graphql:Error? result = http2BasedListener.attach(subscriptionService);
test:assertTrue(result is graphql:Error);
graphql:Error err = <graphql:Error>result;
string expecctedMessage = string `Websocket listener initialization failed due to the incompatibility of ` +
string expectedMessage = string `Websocket listener initialization failed due to the incompatibility of ` +
string `provided HTTP(version 2.0) listener`;
test:assertEquals(err.message(), expecctedMessage);
test:assertEquals(err.message(), expectedMessage);
}

@test:Config {
Expand All @@ -51,4 +51,6 @@ function testAttachServiceWithSubscriptionToHttp1BasedListener() returns error?
check common:validateNextMessage(wsClient1, expectedMsgPayload, id = "1");
check common:validateNextMessage(wsClient2, expectedMsgPayload, id = "2");
}
common:closeWebsocketClient(wsClient1);
common:closeWebsocketClient(wsClient2);
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ isolated function testContextWithSubscriptions() returns error? {
json expectedMsgPayload = {data: {messages: i}};
check common:validateNextMessage(wsClient, expectedMsgPayload);
}
common:closeWebsocketClient(wsClient);
}

@test:Config {
Expand All @@ -62,4 +63,5 @@ isolated function testContextWithInvalidScopeInSubscriptions() returns error? {
}
];
check common:validateErrorMessage(wsClient, expectedErrorPayload);
common:closeWebsocketClient(wsClient);
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ isolated function testSubscriptionWithConstraints() returns error? {
check common:sendSubscriptionMessage(wsClient, document, operationName = "Sub");
json expectedMsgPayload = check common:getJsonContentFromFile("constraints_with_subscription");
check common:validateErrorMessage(wsClient, expectedMsgPayload);
common:closeWebsocketClient(wsClient);
}

@test:Config {
Expand All @@ -50,4 +51,6 @@ isolated function testMultipleSubscriptionClientsWithConstraints() returns error
json expectedMsgPayload = check common:getJsonContentFromFile("constraints_with_subscription");
check common:validateErrorMessage(wsClient1, expectedMsgPayload, "1");
check common:validateErrorMessage(wsClient2, expectedMsgPayload, "2");
common:closeWebsocketClient(wsClient1);
common:closeWebsocketClient(wsClient2);
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ isolated function testSubscriptionMultiplexing() returns error? {
json expectedPayload = {'type: common:WS_NEXT, id: subscriptionId, payload: payload};
test:assertEquals(actualPayload, expectedPayload);
}
common:closeWebsocketClient(wsClient);
}

@test:Config {
Expand All @@ -66,6 +67,7 @@ isolated function testInvalidWebSocketRequestWithEmptyQuery() returns error? {
check common:sendSubscriptionMessage(wsClient, document);
json expectedMsgPayload = {errors: [{message: "An empty query is found"}]};
check common:validateErrorMessage(wsClient, expectedMsgPayload);
common:closeWebsocketClient(wsClient);
}

@test:Config {
Expand All @@ -80,7 +82,8 @@ isolated function testInvalidWebSocketRequestWithInvalidQuery() returns error? {
check wsClient->writeMessage({"type": common:WS_SUBSCRIBE, id: "1", payload: payload});
string expectedErrorMsg = "Invalid format: payload does not conform to the format required by the" +
" 'graphql-transport-ws' subprotocol: Status code: 1003";
common:validateConnectionClousureWithError(wsClient, expectedErrorMsg);
common:validateConnectionClosureWithError(wsClient, expectedErrorMsg);
common:closeWebsocketClient(wsClient);
}

@test:Config {
Expand All @@ -94,7 +97,8 @@ isolated function testInvalidWebSocketRequestWithoutQuery() returns error? {
check wsClient->writeMessage({"type": common:WS_SUBSCRIBE, id: "1", payload: {}});
string expectedErrorMsg = "Invalid format: payload does not conform to the format required by the" +
" 'graphql-transport-ws' subprotocol: Status code: 1003";
common:validateConnectionClousureWithError(wsClient, expectedErrorMsg);
common:validateConnectionClosureWithError(wsClient, expectedErrorMsg);
common:closeWebsocketClient(wsClient);
}

@test:Config {
Expand All @@ -110,7 +114,8 @@ isolated function testInvalidVariableInWebSocketPayload() returns error? {
check common:sendSubscriptionMessage(wsClient, document, variables = variables);
string expectedErrorMsg = "Invalid format: payload does not conform to the format required by the" +
" 'graphql-transport-ws' subprotocol: Status code: 1003";
common:validateConnectionClousureWithError(wsClient, expectedErrorMsg);
common:validateConnectionClosureWithError(wsClient, expectedErrorMsg);
common:closeWebsocketClient(wsClient);
}

@test:Config {
Expand All @@ -124,7 +129,8 @@ isolated function testEmptyWebSocketPayload() returns error? {
check wsClient->writeMessage(payload);
string expectedErrorMsg = "Invalid format: payload does not conform to the format required by the" +
" 'graphql-transport-ws' subprotocol: Status code: 1003";
common:validateConnectionClousureWithError(wsClient, expectedErrorMsg);
common:validateConnectionClosureWithError(wsClient, expectedErrorMsg);
common:closeWebsocketClient(wsClient);
}

@test:Config {
Expand All @@ -137,5 +143,6 @@ isolated function testInvalidWebSocketPayload() returns error? {
check wsClient->writeMessage(payload);
string expectedErrorMsg = "Invalid format: payload does not conform to the format required by the"
+ " 'graphql-transport-ws' subprotocol: Status code: 1003";
common:validateConnectionClousureWithError(wsClient, expectedErrorMsg);
common:validateConnectionClosureWithError(wsClient, expectedErrorMsg);
common:closeWebsocketClient(wsClient);
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ isolated function testSubscription() returns error? {
check common:validateNextMessage(wsClient, expectedMsgPayload);
expectedMsgPayload = {data: {name: "Skyler"}};
check common:validateNextMessage(wsClient, expectedMsgPayload);
common:closeWebsocketClient(wsClient);
}

@test:Config {
Expand Down Expand Up @@ -73,6 +74,8 @@ isolated function testSubscriptionsWithMultipleOperations() returns error? {
json actualPayload = check common:getJsonPayloadFromService(httpUrl, document, operationName = "getName");
json expectedPayload = {data: {name: "Walter White"}};
common:assertJsonValuesWithOrder(actualPayload, expectedPayload);
common:closeWebsocketClient(wsClient1);
common:closeWebsocketClient(wsClient2);
}

@test:Config {
Expand All @@ -90,6 +93,7 @@ isolated function testSubscriptionWithRecords() returns error? {
check common:validateNextMessage(wsClient, expectedMsgPayload);
expectedMsgPayload = {data: {books: {name: "A Game of Thrones", author: "George R.R. Martin"}}};
check common:validateNextMessage(wsClient, expectedMsgPayload);
common:closeWebsocketClient(wsClient);
}

@test:Config {
Expand Down Expand Up @@ -118,6 +122,7 @@ isolated function testSubscriptionWithFragments() returns error? {
check common:validateNextMessage(wsClient, expectedMsgPayload);
expectedMsgPayload = {data: {students: {id: 2, name: "Mikasa Ackerman"}}};
check common:validateNextMessage(wsClient, expectedMsgPayload);
common:closeWebsocketClient(wsClient);
}

@test:Config {
Expand All @@ -135,6 +140,7 @@ isolated function testSubscriptionWithUnionType() returns error? {
check common:validateNextMessage(wsClient, expectedMsgPayload);
expectedMsgPayload = {data: {multipleValues: {name: "Walter White", subject: "Chemistry"}}};
check common:validateNextMessage(wsClient, expectedMsgPayload);
common:closeWebsocketClient(wsClient);
}

@test:Config {
Expand All @@ -153,4 +159,5 @@ isolated function testSubscriptionWithVariables() returns error? {
json expectedMsgPayload = {data: {filterValues: i}};
check common:validateNextMessage(wsClient, expectedMsgPayload);
}
common:closeWebsocketClient(wsClient);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import ballerina/websocket;
@test:Config {
groups: ["subscriptions", "service"]
}
isolated function testConnectionClousureWhenPongNotRecived() returns error? {
isolated function testConnectionClosureWhenPongNotReceived() returns error? {
string url = "ws://localhost:9091/subscription_interceptor1";
websocket:ClientConfiguration config = {subProtocols: [common:GRAPHQL_TRANSPORT_WS]};
websocket:Client wsClient = check new (url, config);
Expand All @@ -35,6 +35,7 @@ isolated function testConnectionClousureWhenPongNotRecived() returns error? {
}
break;
}
test:assertTrue(response is error, "Expected connection clousure error");
test:assertTrue(response is error, "Expected connection closure error");
test:assertEquals((<error>response).message(), "Request timeout: Status code: 4408");
common:closeWebsocketClient(wsClient);
}
Loading

0 comments on commit ac90d53

Please sign in to comment.