aboutsummaryrefslogtreecommitdiffstats
path: root/container-core/src/test/java/com/yahoo/container/core/config/ApplicationBundleLoaderTest.java
diff options
context:
space:
mode:
authorgjoranv <gv@verizonmedia.com>2022-09-01 12:32:32 +0200
committergjoranv <gv@verizonmedia.com>2022-09-05 23:41:43 +0200
commit58e8a5d51dceaa7f9dbda2d3690264433448b363 (patch)
tree8e12782d4a19fbc17524fe6339a7e43b018d54f7 /container-core/src/test/java/com/yahoo/container/core/config/ApplicationBundleLoaderTest.java
parentd6e36ad9521007dae37433b32d61e7942535cc3f (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/com/yahoo/container/core/config/ApplicationBundleLoaderTest.java')
-rw-r--r--container-core/src/test/java/com/yahoo/container/core/config/ApplicationBundleLoaderTest.java18
1 files changed, 18 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());
+ }
+
}