diff options
author | Arnstein Ressem <aressem@gmail.com> | 2020-12-07 15:31:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-07 15:31:41 +0100 |
commit | 623ad7595b4d0685d969b4585bb73c272d7da033 (patch) | |
tree | ac2d6eb70cb4bc9b4423569538e5a164ec05d54e /container-disc/src/test | |
parent | d27544dd87c1c3d2798a10c04f22b8ff91d3185d (diff) |
Revert "Always deconstruct in reverse creation order, including Provider objects"
Diffstat (limited to 'container-disc/src/test')
-rw-r--r-- | container-disc/src/test/java/com/yahoo/container/jdisc/component/DeconstructorTest.java | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/container-disc/src/test/java/com/yahoo/container/jdisc/component/DeconstructorTest.java b/container-disc/src/test/java/com/yahoo/container/jdisc/component/DeconstructorTest.java index 9ae05f5c193..efdc8f44c17 100644 --- a/container-disc/src/test/java/com/yahoo/container/jdisc/component/DeconstructorTest.java +++ b/container-disc/src/test/java/com/yahoo/container/jdisc/component/DeconstructorTest.java @@ -9,9 +9,6 @@ import com.yahoo.jdisc.SharedResource; import org.junit.Before; import org.junit.Test; -import java.util.List; -import java.util.concurrent.TimeUnit; - import static java.util.Collections.emptyList; import static java.util.Collections.singleton; import static org.junit.Assert.assertTrue; @@ -31,25 +28,25 @@ public class DeconstructorTest { public void require_abstract_component_destructed() throws InterruptedException { TestAbstractComponent abstractComponent = new TestAbstractComponent(); // Done by executor, so it takes some time even with a 0 delay. - deconstructor.deconstruct(List.of(abstractComponent), emptyList()); - deconstructor.executor.shutdown(); - deconstructor.executor.awaitTermination(1, TimeUnit.MINUTES); + deconstructor.deconstruct(singleton(abstractComponent), emptyList()); + int cnt = 0; + while (! abstractComponent.destructed && (cnt++ < 12000)) { + Thread.sleep(10); + } assertTrue(abstractComponent.destructed); } @Test - public void require_provider_destructed() throws InterruptedException { + public void require_provider_destructed() { TestProvider provider = new TestProvider(); - deconstructor.deconstruct(List.of(provider), emptyList()); - deconstructor.executor.shutdown(); - deconstructor.executor.awaitTermination(1, TimeUnit.MINUTES); + deconstructor.deconstruct(singleton(provider), emptyList()); assertTrue(provider.destructed); } @Test public void require_shared_resource_released() { TestSharedResource sharedResource = new TestSharedResource(); - deconstructor.deconstruct(List.of(sharedResource), emptyList()); + deconstructor.deconstruct(singleton(sharedResource), emptyList()); assertTrue(sharedResource.released); } @@ -58,8 +55,10 @@ public class DeconstructorTest { var bundle = new UninstallableMockBundle(); // Done by executor, so it takes some time even with a 0 delay. deconstructor.deconstruct(emptyList(), singleton(bundle)); - deconstructor.executor.shutdown(); - deconstructor.executor.awaitTermination(1, TimeUnit.MINUTES); + int cnt = 0; + while (! bundle.uninstalled && (cnt++ < 12000)) { + Thread.sleep(10); + } assertTrue(bundle.uninstalled); } |