Skip to content

Commit

Permalink
Restructure websub test cases to fix tests hanging issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ayeshLK committed Apr 2, 2024
1 parent 2b58ac7 commit a0e3ffa
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ballerina/tests/unsubscription_test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ isolated function notifySubscriber(string mode) returns error? {
}
}

listener Listener unsubscriptionTestListener = new (9102);

SubscriberService unsubscriptionTestSubscriber = @SubscriberServiceConfig {
target: ["http://127.0.0.1:9197/common/hub", "test"],
leaseSeconds: 36000,
Expand All @@ -87,12 +85,13 @@ service object {
groups: ["unsubscriptionViaGracefulstop"]
}
function testUnsubscriptionOnGracefulStop() returns error? {
check unsubscriptionTestListener.attach(unsubscriptionTestSubscriber, "sub");
check unsubscriptionTestListener.'start();
Listener ls = check new (9102);
check ls.attach(unsubscriptionTestSubscriber, "sub");
check ls.'start();
log:printInfo("[UNSUB_VER] Starting Subscriber");
runtime:sleep(5);
log:printInfo("[UNSUB_VER] Invoking graceful stop");
check unsubscriptionTestListener.gracefulStop();
check ls.gracefulStop();
runtime:sleep(5);
log:printInfo("[UNSUB_VER] Verifying shutdown");
test:assertTrue(isVerified());
Expand Down

0 comments on commit a0e3ffa

Please sign in to comment.