This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/scheduled_event_on_event_thread
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 62bf74f4bed2bdeae4935bbbf69ba28af1a972da
Author: Pepijn Noltes <[email protected]>
AuthorDate: Sat Jun 17 16:38:07 2023 +0200

    Refactor topman scope test with "becomes" condition
---
 .../topology_manager/tms_tst/tms_tests.cpp         | 28 +++++++++++++++++-----
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/bundles/remote_services/topology_manager/tms_tst/tms_tests.cpp 
b/bundles/remote_services/topology_manager/tms_tst/tms_tests.cpp
index 92bc86b6..500a9bae 100644
--- a/bundles/remote_services/topology_manager/tms_tst/tms_tests.cpp
+++ b/bundles/remote_services/topology_manager/tms_tst/tms_tests.cpp
@@ -497,8 +497,13 @@ extern "C" {
 
         celix_framework_waitForEmptyEventQueue(framework);
 
-        bool imported = testImport->IsImported(testImport);
-        EXPECT_EQ(true, imported);
+        //Then endpointImported becomes true within 1 second
+        bool imported;
+        int iteration = 0;
+        do {
+            imported = testImport->IsImported(testImport);
+            usleep(1000);
+        } while (!imported && iteration++ < 1000);
 
         rc = eplService->endpointRemoved(eplService->handle, endpoint, NULL);
         EXPECT_EQ(CELIX_SUCCESS, rc);
@@ -544,8 +549,13 @@ extern "C" {
 
         celix_framework_waitForEmptyEventQueue(framework);
 
-        bool imported = testImport->IsImported(testImport);
-        EXPECT_EQ(true, imported);
+        //Then endpointImported becomes true within 1 second
+        bool imported;
+        int iteration = 0;
+        do {
+            imported = testImport->IsImported(testImport);
+            usleep(1000);
+        } while (!imported && iteration++ < 1000);
 
         rc = eplService->endpointRemoved(eplService->handle, endpoint, NULL);
         EXPECT_EQ(CELIX_SUCCESS, rc);
@@ -636,8 +646,14 @@ extern "C" {
 
         celix_framework_waitForEmptyEventQueue(framework);
 
-        celix_framework_waitForEmptyEventQueue(framework);
-        bool imported = testImport->IsImported(testImport);
+        //Then endpointImported becomes true within 1 second
+        bool imported;
+        int iteration = 0;
+        do {
+            imported = testImport->IsImported(testImport);
+            usleep(1000);
+        } while (!imported && iteration++ < 1000);
+
         EXPECT_EQ(true, imported);
 
         rc = eplService->endpointRemoved(eplService->handle, endpoint, NULL);

Reply via email to