Skip to content

Commit 87157c7

Browse files
Merge pull request #2114 from MohamedSabthar/subscription-disable
Add print statements in dataloader tests
2 parents 26c2874 + 96f6887 commit 87157c7

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

ballerina-tests/graphql-dataloader-test-suite/Dependencies.toml

+4
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ dependencies = [
114114
{org = "ballerina", name = "graphql"},
115115
{org = "ballerina", name = "graphql_test_common"},
116116
{org = "ballerina", name = "http"},
117+
{org = "ballerina", name = "io"},
117118
{org = "ballerina", name = "test"},
118119
{org = "ballerina", name = "websocket"}
119120
]
@@ -181,6 +182,9 @@ dependencies = [
181182
{org = "ballerina", name = "jballerina.java"},
182183
{org = "ballerina", name = "lang.value"}
183184
]
185+
modules = [
186+
{org = "ballerina", packageName = "io", moduleName = "io"}
187+
]
184188

185189
[[package]]
186190
org = "ballerina"

ballerina-tests/graphql-dataloader-test-suite/tests/01_dataloader_tests.bal

+13
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,38 @@ import ballerina/graphql;
1818
import ballerina/graphql_test_common as common;
1919
import ballerina/test;
2020
import ballerina/websocket;
21+
import ballerina/io;
2122

2223
@test:Config {
2324
groups: ["dataloader", "query"],
2425
after: resetDispatchCounters
2526
}
2627
isolated function testDataLoaderWithQuery() returns error? {
28+
io:println("start testDataLoaderWithQuery");
2729
graphql:Client graphqlClient = check new ("localhost:9090/dataloader");
2830
string document = check common:getGraphqlDocumentFromFile("dataloader_with_query");
2931
json response = check graphqlClient->execute(document);
3032
json expectedPayload = check common:getJsonContentFromFile("dataloader_with_query");
3133
common:assertJsonValuesWithOrder(response, expectedPayload);
3234
assertDispatchCountForAuthorLoader(1);
3335
assertDispatchCountForBookLoader(1);
36+
io:println("end testDataLoaderWithQuery");
3437
}
3538

3639
@test:Config {
3740
groups: ["dataloader", "query"],
3841
after: resetDispatchCounters
3942
}
4043
isolated function testDataLoaderWithDifferentAliasForSameField() returns error? {
44+
io:println("start testDataLoaderWithDifferentAliasForSameField");
4145
graphql:Client graphqlClient = check new ("localhost:9090/dataloader");
4246
string document = check common:getGraphqlDocumentFromFile("dataloader_with_different_alias_for_same_field");
4347
json response = check graphqlClient->execute(document);
4448
json expectedPayload = check common:getJsonContentFromFile("dataloader_with_different_alias_for_same_field");
4549
common:assertJsonValuesWithOrder(response, expectedPayload);
4650
assertDispatchCountForAuthorLoader(1);
4751
assertDispatchCountForBookLoader(1);
52+
io:println("end testDataLoaderWithDifferentAliasForSameField");
4853
}
4954

5055
@test:Config {
@@ -75,51 +80,59 @@ isolated function testDataLoaderWithSubscription() returns error? {
7580
after: resetDispatchCounters
7681
}
7782
isolated function testDataLoaderWithMutation() returns error? {
83+
io:println("start testDataLoaderWithMutation");
7884
graphql:Client graphqlClient = check new ("localhost:9090/dataloader");
7985
string document = check common:getGraphqlDocumentFromFile("dataloader_with_mutation");
8086
json response = check graphqlClient->execute(document);
8187
json expectedPayload = check common:getJsonContentFromFile("dataloader_with_mutation");
8288
common:assertJsonValuesWithOrder(response, expectedPayload);
8389
assertDispatchCountForUpdateAuthorLoader(1);
8490
assertDispatchCountForBookLoader(1);
91+
io:println("end testDataLoaderWithMutation");
8592
}
8693

8794
@test:Config {
8895
groups: ["dataloader", "interceptor"],
8996
after: resetDispatchCounters
9097
}
9198
isolated function testDataLoaderWithInterceptors() returns error? {
99+
io:println("start testDataLoaderWithInterceptors");
92100
graphql:Client graphqlClient = check new ("localhost:9090/dataloader_with_interceptor");
93101
string document = check common:getGraphqlDocumentFromFile("dataloader_with_interceptor");
94102
json response = check graphqlClient->execute(document);
95103
json expectedPayload = check common:getJsonContentFromFile("dataloader_with_interceptor");
96104
common:assertJsonValuesWithOrder(response, expectedPayload);
97105
assertDispatchCountForAuthorLoader(1);
98106
assertDispatchCountForBookLoader(1);
107+
io:println("end testDataLoaderWithInterceptors");
99108
}
100109

101110
@test:Config {
102111
groups: ["dataloader", "dispatch-error"],
103112
after: resetDispatchCounters
104113
}
105114
isolated function testBatchFunctionReturningErrors() returns error? {
115+
io:println("start testBatchFunctionReturningErrors");
106116
graphql:Client graphqlClient = check new ("localhost:9090/dataloader");
107117
string document = check common:getGraphqlDocumentFromFile("batch_function_returing_errors");
108118
json response = check graphqlClient->execute(document);
109119
json expectedPayload = check common:getJsonContentFromFile("batch_function_returing_errors");
110120
common:assertJsonValuesWithOrder(response, expectedPayload);
111121
assertDispatchCountForAuthorLoader(1);
112122
assertDispatchCountForBookLoader(0);
123+
io:println("end testBatchFunctionReturningErrors");
113124
}
114125

115126
@test:Config {
116127
groups: ["dataloader", "dispatch-error"],
117128
after: resetDispatchCounters
118129
}
119130
isolated function testBatchFunctionReturingNonMatchingNumberOfResults() returns error? {
131+
io:println("start testBatchFunctionReturingNonMatchingNumberOfResults");
120132
graphql:Client graphqlClient = check new ("localhost:9090/dataloader_with_faulty_batch_function");
121133
string document = check common:getGraphqlDocumentFromFile("batch_function_returning_non_matcing_number_of_results");
122134
json response = check graphqlClient->execute(document);
123135
json expectedPayload = check common:getJsonContentFromFile("batch_function_returning_non_matcing_number_of_results");
124136
common:assertJsonValuesWithOrder(response, expectedPayload);
137+
io:println("end testBatchFunctionReturingNonMatchingNumberOfResults");
125138
}

ballerina-tests/graphql-dataloader-test-suite/tests/02_dataloader_with_server_cache.bal

+7-2
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@
1616

1717
import ballerina/graphql_test_common as common;
1818
import ballerina/test;
19+
import ballerina/io;
1920

2021
@test:Config {
21-
groups: ["server_cache", "data_loader"],
22+
groups: ["server_cache", "dataloader"],
2223
dataProvider: dataProviderServerCacheWithDataloader
2324
}
2425
isolated function testServerSideCacheWithDataLoader(string documentFile, string[] resourceFileNames, json variables = (), string[] operationNames = []) returns error? {
26+
io:println("start testServerSideCacheWithDataLoader");
2527
string url = "http://localhost:9090/caching_with_dataloader";
2628
string document = check common:getGraphqlDocumentFromFile(documentFile);
2729
foreach int i in 0 ..< resourceFileNames.length() {
@@ -30,6 +32,7 @@ isolated function testServerSideCacheWithDataLoader(string documentFile, string[
3032
common:assertJsonValuesWithOrder(actualPayload, expectedPayload);
3133
}
3234
resetDispatchCounters();
35+
io:println("end testServerSideCacheWithDataLoader");
3336
}
3437

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

4346
@test:Config {
44-
groups: ["server_cache", "data_loader"],
47+
groups: ["server_cache", "dataloader"],
4548
dataProvider: dataProviderServerCacheWithDataloaderInOperationalLevel
4649
}
4750
isolated function testServerSideCacheWithDataLoaderInOperationalLevel(string documentFile, string[] resourceFileNames, json variables = (), string[] operationNames = []) returns error? {
51+
io:println("start testServerSideCacheWithDataLoaderInOperationalLevel");
4852
string url = "http://localhost:9090/caching_with_dataloader_operational";
4953
string document = check common:getGraphqlDocumentFromFile(documentFile);
5054
foreach int i in 0 ..< resourceFileNames.length() {
@@ -53,6 +57,7 @@ isolated function testServerSideCacheWithDataLoaderInOperationalLevel(string doc
5357
common:assertJsonValuesWithOrder(actualPayload, expectedPayload);
5458
}
5559
resetDispatchCounters();
60+
io:println("end testServerSideCacheWithDataLoaderInOperationalLevel");
5661
}
5762

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

0 commit comments

Comments
 (0)