Skip to content

Commit

Permalink
Merge pull request #744 from apache/hotfix/shaky-framework-test
Browse files Browse the repository at this point in the history
Hotfix/shaky-framework-test-fix
  • Loading branch information
PengZheng authored Apr 17, 2024
2 parents cb38185 + ab2f7ba commit 0802579
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
16 changes: 8 additions & 8 deletions libs/framework/gtest/src/CelixFrameworkTestSuite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "celix_launcher.h"
#include "celix_framework_factory.h"
#include "celix_framework.h"
#include "framework.h"
#include "framework_private.h"
#include "celix_constants.h"
#include "celix_utils.h"

Expand Down Expand Up @@ -105,27 +105,27 @@ TEST_F(CelixFrameworkTestSuite, AsyncInstallStartStopUpdateAndUninstallBundleTes
EXPECT_FALSE(celix_framework_isBundleActive(framework.get(), bndId));

celix_framework_updateBundleAsync(framework.get(), bndId, NULL);
std::this_thread::sleep_for(std::chrono::milliseconds{100});
celix_framework_waitForBundleLifecycleHandlers(framework.get());
EXPECT_FALSE(celix_framework_isBundleActive(framework.get(), bndId));

celix_framework_startBundleAsync(framework.get(), bndId);
std::this_thread::sleep_for(std::chrono::milliseconds{100});
celix_framework_waitForBundleLifecycleHandlers(framework.get());
EXPECT_TRUE(celix_framework_isBundleActive(framework.get(), bndId));

celix_framework_updateBundleAsync(framework.get(), bndId, NULL);
std::this_thread::sleep_for(std::chrono::milliseconds{100});
celix_framework_waitForBundleLifecycleHandlers(framework.get());
EXPECT_TRUE(celix_framework_isBundleActive(framework.get(), bndId));

celix_framework_stopBundleAsync(framework.get(), bndId);
std::this_thread::sleep_for(std::chrono::milliseconds{100});
celix_framework_waitForBundleLifecycleHandlers(framework.get());
EXPECT_FALSE(celix_framework_isBundleActive(framework.get(), bndId));

celix_framework_updateBundleAsync(framework.get(), bndId, NULL);
std::this_thread::sleep_for(std::chrono::milliseconds{100});
celix_framework_waitForBundleLifecycleHandlers(framework.get());
EXPECT_FALSE(celix_framework_isBundleActive(framework.get(), bndId));

celix_framework_unloadBundleAsync(framework.get(), bndId);
std::this_thread::sleep_for(std::chrono::milliseconds{100});
celix_framework_waitForBundleLifecycleHandlers(framework.get());
EXPECT_FALSE(celix_framework_isBundleInstalled(framework.get(), bndId));

// reloaded bundle should reuse the same bundle id
Expand All @@ -134,7 +134,7 @@ TEST_F(CelixFrameworkTestSuite, AsyncInstallStartStopUpdateAndUninstallBundleTes
EXPECT_FALSE(celix_framework_isBundleActive(framework.get(), bndId));

celix_framework_uninstallBundleAsync(framework.get(), bndId);
std::this_thread::sleep_for(std::chrono::milliseconds{100});
celix_framework_waitForBundleLifecycleHandlers(framework.get());
EXPECT_FALSE(celix_framework_isBundleInstalled(framework.get(), bndId));
}

Expand Down
5 changes: 0 additions & 5 deletions libs/framework/src/framework_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,6 @@ void celix_framework_waitForAsyncRegistration(celix_framework_t *fw, long svcId)
*/
void celix_framework_waitForAsyncUnregistration(celix_framework_t *fw, long svcId);

/**
* Returns whether the current thread is the Celix framework event loop thread.
*/
bool celix_framework_isCurrentThreadTheEventLoop(celix_framework_t* fw);

/**
* Increase the use count of a bundle and ensure that a bundle cannot be uninstalled.
*/
Expand Down

0 comments on commit 0802579

Please sign in to comment.