Skip to content

Commit

Permalink
Merge pull request #2115 from MohamedSabthar/subscription-disable
Browse files Browse the repository at this point in the history
Disable test testDataLoaderWithDifferentAliasForSameField
  • Loading branch information
chiranSachintha authored Dec 9, 2024
2 parents 87157c7 + ba91142 commit 35b4c8c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ dependencies = [
{org = "ballerina", name = "graphql"},
{org = "ballerina", name = "graphql_test_common"},
{org = "ballerina", name = "http"},
{org = "ballerina", name = "io"},
{org = "ballerina", name = "test"},
{org = "ballerina", name = "websocket"}
]
Expand Down Expand Up @@ -182,9 +181,6 @@ dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.value"}
]
modules = [
{org = "ballerina", packageName = "io", moduleName = "io"}
]

[[package]]
org = "ballerina"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,34 @@ import ballerina/graphql;
import ballerina/graphql_test_common as common;
import ballerina/test;
import ballerina/websocket;
import ballerina/io;

@test:Config {
groups: ["dataloader", "query"],
after: resetDispatchCounters
}
isolated function testDataLoaderWithQuery() returns error? {
io:println("start testDataLoaderWithQuery");
graphql:Client graphqlClient = check new ("localhost:9090/dataloader");
string document = check common:getGraphqlDocumentFromFile("dataloader_with_query");
json response = check graphqlClient->execute(document);
json expectedPayload = check common:getJsonContentFromFile("dataloader_with_query");
common:assertJsonValuesWithOrder(response, expectedPayload);
assertDispatchCountForAuthorLoader(1);
assertDispatchCountForBookLoader(1);
io:println("end testDataLoaderWithQuery");
}

@test:Config {
groups: ["dataloader", "query"],
after: resetDispatchCounters
after: resetDispatchCounters,
enable: false
}
isolated function testDataLoaderWithDifferentAliasForSameField() returns error? {
io:println("start testDataLoaderWithDifferentAliasForSameField");
graphql:Client graphqlClient = check new ("localhost:9090/dataloader");
string document = check common:getGraphqlDocumentFromFile("dataloader_with_different_alias_for_same_field");
json response = check graphqlClient->execute(document);
json expectedPayload = check common:getJsonContentFromFile("dataloader_with_different_alias_for_same_field");
common:assertJsonValuesWithOrder(response, expectedPayload);
assertDispatchCountForAuthorLoader(1);
assertDispatchCountForBookLoader(1);
io:println("end testDataLoaderWithDifferentAliasForSameField");
}

@test:Config {
Expand Down Expand Up @@ -80,59 +76,51 @@ isolated function testDataLoaderWithSubscription() returns error? {
after: resetDispatchCounters
}
isolated function testDataLoaderWithMutation() returns error? {
io:println("start testDataLoaderWithMutation");
graphql:Client graphqlClient = check new ("localhost:9090/dataloader");
string document = check common:getGraphqlDocumentFromFile("dataloader_with_mutation");
json response = check graphqlClient->execute(document);
json expectedPayload = check common:getJsonContentFromFile("dataloader_with_mutation");
common:assertJsonValuesWithOrder(response, expectedPayload);
assertDispatchCountForUpdateAuthorLoader(1);
assertDispatchCountForBookLoader(1);
io:println("end testDataLoaderWithMutation");
}

@test:Config {
groups: ["dataloader", "interceptor"],
after: resetDispatchCounters
}
isolated function testDataLoaderWithInterceptors() returns error? {
io:println("start testDataLoaderWithInterceptors");
graphql:Client graphqlClient = check new ("localhost:9090/dataloader_with_interceptor");
string document = check common:getGraphqlDocumentFromFile("dataloader_with_interceptor");
json response = check graphqlClient->execute(document);
json expectedPayload = check common:getJsonContentFromFile("dataloader_with_interceptor");
common:assertJsonValuesWithOrder(response, expectedPayload);
assertDispatchCountForAuthorLoader(1);
assertDispatchCountForBookLoader(1);
io:println("end testDataLoaderWithInterceptors");
}

@test:Config {
groups: ["dataloader", "dispatch-error"],
after: resetDispatchCounters
}
isolated function testBatchFunctionReturningErrors() returns error? {
io:println("start testBatchFunctionReturningErrors");
graphql:Client graphqlClient = check new ("localhost:9090/dataloader");
string document = check common:getGraphqlDocumentFromFile("batch_function_returing_errors");
json response = check graphqlClient->execute(document);
json expectedPayload = check common:getJsonContentFromFile("batch_function_returing_errors");
common:assertJsonValuesWithOrder(response, expectedPayload);
assertDispatchCountForAuthorLoader(1);
assertDispatchCountForBookLoader(0);
io:println("end testBatchFunctionReturningErrors");
}

@test:Config {
groups: ["dataloader", "dispatch-error"],
after: resetDispatchCounters
}
isolated function testBatchFunctionReturingNonMatchingNumberOfResults() returns error? {
io:println("start testBatchFunctionReturingNonMatchingNumberOfResults");
graphql:Client graphqlClient = check new ("localhost:9090/dataloader_with_faulty_batch_function");
string document = check common:getGraphqlDocumentFromFile("batch_function_returning_non_matcing_number_of_results");
json response = check graphqlClient->execute(document);
json expectedPayload = check common:getJsonContentFromFile("batch_function_returning_non_matcing_number_of_results");
common:assertJsonValuesWithOrder(response, expectedPayload);
io:println("end testBatchFunctionReturingNonMatchingNumberOfResults");
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@

import ballerina/graphql_test_common as common;
import ballerina/test;
import ballerina/io;

@test:Config {
groups: ["server_cache", "dataloader"],
groups: ["server_cache", "data_loader"],
dataProvider: dataProviderServerCacheWithDataloader
}
isolated function testServerSideCacheWithDataLoader(string documentFile, string[] resourceFileNames, json variables = (), string[] operationNames = []) returns error? {
io:println("start testServerSideCacheWithDataLoader");
string url = "http://localhost:9090/caching_with_dataloader";
string document = check common:getGraphqlDocumentFromFile(documentFile);
foreach int i in 0 ..< resourceFileNames.length() {
Expand All @@ -32,7 +30,6 @@ isolated function testServerSideCacheWithDataLoader(string documentFile, string[
common:assertJsonValuesWithOrder(actualPayload, expectedPayload);
}
resetDispatchCounters();
io:println("end testServerSideCacheWithDataLoader");
}

function dataProviderServerCacheWithDataloader() returns map<[string, string[], json, string[]]> {
Expand All @@ -44,11 +41,10 @@ function dataProviderServerCacheWithDataloader() returns map<[string, string[],
}

@test:Config {
groups: ["server_cache", "dataloader"],
groups: ["server_cache", "data_loader"],
dataProvider: dataProviderServerCacheWithDataloaderInOperationalLevel
}
isolated function testServerSideCacheWithDataLoaderInOperationalLevel(string documentFile, string[] resourceFileNames, json variables = (), string[] operationNames = []) returns error? {
io:println("start testServerSideCacheWithDataLoaderInOperationalLevel");
string url = "http://localhost:9090/caching_with_dataloader_operational";
string document = check common:getGraphqlDocumentFromFile(documentFile);
foreach int i in 0 ..< resourceFileNames.length() {
Expand All @@ -57,7 +53,6 @@ isolated function testServerSideCacheWithDataLoaderInOperationalLevel(string doc
common:assertJsonValuesWithOrder(actualPayload, expectedPayload);
}
resetDispatchCounters();
io:println("end testServerSideCacheWithDataLoaderInOperationalLevel");
}

function dataProviderServerCacheWithDataloaderInOperationalLevel() returns map<[string, string[], json, string[]]> {
Expand Down

0 comments on commit 35b4c8c

Please sign in to comment.