celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject [celix] 01/01: Adds a timestamp to the celix bundle cache for the PubSubSerializationProviderTestSuite
Date Tue, 09 Jun 2020 18:32:43 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit c7e75f869a6cbcbef9f414b2de52910526d5d2c7
Author: Pepijn Noltes <pepijnnoltes@gmail.com>
AuthorDate: Tue Jun 9 20:32:19 2020 +0200

    Adds a timestamp to the celix bundle cache for the PubSubSerializationProviderTestSuite
    
    This is done because that test suite fails from time to time, this is
    to test if the bundle cache cleaning has anything to do with this.
---
 .../gtest/src/PubSubSerializationProviderTestSuite.cc         | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/bundles/pubsub/pubsub_utils/gtest/src/PubSubSerializationProviderTestSuite.cc
b/bundles/pubsub/pubsub_utils/gtest/src/PubSubSerializationProviderTestSuite.cc
index 2522bbf..0604f51 100644
--- a/bundles/pubsub/pubsub_utils/gtest/src/PubSubSerializationProviderTestSuite.cc
+++ b/bundles/pubsub/pubsub_utils/gtest/src/PubSubSerializationProviderTestSuite.cc
@@ -20,6 +20,7 @@
 #include "gtest/gtest.h"
 
 #include <memory>
+#include <chrono>
 
 #include <celix_api.h>
 #include "pubsub_serialization_provider.h"
@@ -28,7 +29,15 @@ class PubSubSerializationProviderTestSuite : public ::testing::Test {
 public:
     PubSubSerializationProviderTestSuite() {
         auto* props = celix_properties_create();
-        celix_properties_set(props, OSGI_FRAMEWORK_FRAMEWORK_STORAGE, ".pubsub_serialization_provider_cache");
+
+        //NOTE setting the cache using a timestamp. This test suite fails from time to time
on CI.
+        //Cannot reproduce this on host, so testing if a timestamp improves stability.
+        const auto t = std::chrono::system_clock::now();
+        char *cache = nullptr;
+        asprintf(&cache, ".pubsub_serialization_provider_cache-%li", t.time_since_epoch().count());
+        celix_properties_set(props, OSGI_FRAMEWORK_FRAMEWORK_STORAGE, cache);
+        free(cache);
+
         auto* fwPtr = celix_frameworkFactory_createFramework(props);
         auto* ctxPtr = celix_framework_getFrameworkContext(fwPtr);
         fw = std::shared_ptr<celix_framework_t>{fwPtr, [](auto* f) {celix_frameworkFactory_destroyFramework(f);}};


Mime
View raw message