diff options
author | gjoranv <gv@verizonmedia.com> | 2022-09-01 12:32:32 +0200 |
---|---|---|
committer | gjoranv <gv@verizonmedia.com> | 2022-09-05 23:41:43 +0200 |
commit | 58e8a5d51dceaa7f9dbda2d3690264433448b363 (patch) | |
tree | 8e12782d4a19fbc17524fe6339a7e43b018d54f7 /container-core/src/test/java | |
parent | d6e36ad9521007dae37433b32d61e7942535cc3f (diff) |
Add (failing) unit test to verify that a failed reconfig with ...
unchanged bundles does not affect the already installed bundles.
Diffstat (limited to 'container-core/src/test/java')
-rw-r--r-- | container-core/src/test/java/com/yahoo/container/core/config/ApplicationBundleLoaderTest.java | 18 | ||||
-rw-r--r-- | container-core/src/test/java/com/yahoo/container/di/ContainerTest.java | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/container-core/src/test/java/com/yahoo/container/core/config/ApplicationBundleLoaderTest.java b/container-core/src/test/java/com/yahoo/container/core/config/ApplicationBundleLoaderTest.java index 54ef2d41ac6..2236a1b250a 100644 --- a/container-core/src/test/java/com/yahoo/container/core/config/ApplicationBundleLoaderTest.java +++ b/container-core/src/test/java/com/yahoo/container/core/config/ApplicationBundleLoaderTest.java @@ -116,4 +116,22 @@ public class ApplicationBundleLoaderTest { assertEquals(BUNDLE_1_REF, bundleLoader.getActiveFileReferences().get(0)); } + @Test + void bundles_are_unaffected_by_failed_reconfig_with_unchanged_bundles() { + bundleLoader.useBundles(List.of(BUNDLE_1_REF)); + Set<Bundle> obsoleteBundles = bundleLoader.useBundles(List.of(BUNDLE_1_REF)); + assertTrue(obsoleteBundles.isEmpty()); + + // Revert to the previous generation, as will be done upon a failed reconfig. + Collection<Bundle> bundlesToUninstall = bundleLoader.revertToPreviousGeneration(); + + assertEquals(0, bundlesToUninstall.size()); + assertEquals(1, osgi.getCurrentBundles().size()); + + bundleLoader.useBundles(List.of(BUNDLE_1_REF)); + obsoleteBundles = bundleLoader.useBundles(List.of(BUNDLE_1_REF)); + assertTrue(obsoleteBundles.isEmpty()); + assertEquals(1, osgi.getCurrentBundles().size()); + } + } diff --git a/container-core/src/test/java/com/yahoo/container/di/ContainerTest.java b/container-core/src/test/java/com/yahoo/container/di/ContainerTest.java index c5be05b5c82..23649f8de72 100644 --- a/container-core/src/test/java/com/yahoo/container/di/ContainerTest.java +++ b/container-core/src/test/java/com/yahoo/container/di/ContainerTest.java @@ -10,6 +10,7 @@ import com.yahoo.container.di.componentgraph.core.ComponentGraphTest.SimpleCompo import com.yahoo.container.di.componentgraph.core.ComponentNode.ComponentConstructorException; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import org.osgi.framework.Bundle; import java.util.List; import java.util.concurrent.ExecutorService; |