You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "Jens Deppe (Jira)" <ji...@apache.org> on 2021/01/21 14:31:00 UTC

[jira] [Assigned] (GEODE-8040) BootstrappingFunctionIntegrationTest unintentionally creates a full Cache stack

     [ https://issues.apache.org/jira/browse/GEODE-8040?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jens Deppe reassigned GEODE-8040:
---------------------------------

    Assignee:     (was: Jens Deppe)

> BootstrappingFunctionIntegrationTest unintentionally creates a full Cache stack
> -------------------------------------------------------------------------------
>
>                 Key: GEODE-8040
>                 URL: https://issues.apache.org/jira/browse/GEODE-8040
>             Project: Geode
>          Issue Type: Bug
>          Components: tests
>            Reporter: Kirk Lund
>            Priority: Major
>
> BootstrappingFunctionIntegrationTest unintentionally creates a full Cache stack. I have renamed and moved BootstrappingFunctionTest from src/test to src/integrationTest because it creates a full Cache/DistributedSystem and leaves the SocketCreatorFactory in an initialized state which causes other unit tests such as SocketCreatorFactoryJUnitTest to fail:
> {noformat}
> org.apache.geode.internal.net.SocketCreatorFactoryJUnitTest > testNewSSLConfigSSLComponentLocator FAILED
>     java.lang.AssertionError
>         at org.junit.Assert.fail(Assert.java:86)
>         at org.junit.Assert.assertTrue(Assert.java:41)
>         at org.junit.Assert.assertTrue(Assert.java:52)
>         at org.apache.geode.internal.net.SocketCreatorFactoryJUnitTest.testNewSSLConfigSSLComponentLocator(SocketCreatorFactoryJUnitTest.java:106)
> {noformat}
> The cause is improper syntax in the test for partial mocking a Spy. This when/thenReturn:
> {noformat}
> when(bootstrappingFunction.verifyCacheExists()).thenReturn(mockCache);
> {noformat}
> ...first invokes the actual verifyCacheExists() method which creates a real Cache and then returns mockCache. This should instead be:
> {noformat}
> doReturn(mockCache).when(bootstrappingFunction).verifyCacheExists();
> {noformat}
> Unfortunately, the class BootstrappingFunction requires additional changes to make it unit testable. The next test failure after fixing the Mockito syntax is:
> {noformat}
> org.apache.geode.cache.CacheClosedException: A cache has not yet been created.
> 	at org.apache.geode.internal.cache.CacheFactoryStatics.getAnyInstance(CacheFactoryStatics.java:87)
> 	at org.apache.geode.modules.util.CreateRegionFunction.<init>(CreateRegionFunction.java:59)
> 	at org.apache.geode.modules.util.BootstrappingFunction.registerFunctions(BootstrappingFunction.java:124)
> 	at org.apache.geode.modules.util.BootstrappingFunction.execute(BootstrappingFunction.java:67)
> 	at org.apache.geode.modules.util.BootstrappingFunctionIntegrationTest.registerFunctionGetsCalledOnNonLocators(BootstrappingFunctionIntegrationTest.java:101)
> {noformat}
> When I make the changes necessary to make BootstrappingFunction unit testable, the tomcat session backwards compatibility tests all start failing in UpgradeTest:
> {noformat}
> org.apache.geode.session.tests.TomcatSessionBackwardsCompatibilityTomcat8WithOldModuleCanDoPutsTest > test[0] FAILED
>     java.lang.RuntimeException: Something very bad happened when trying to start container TOMCAT8_client-server_test0_0_6b9ba51c-9690-47aa-8e56-8e5b6cb22af4_<unknown>
>         at org.apache.geode.session.tests.ContainerManager.startContainer(ContainerManager.java:80)
>         at org.apache.geode.session.tests.ContainerManager.startContainers(ContainerManager.java:91)
>         at org.apache.geode.session.tests.ContainerManager.startAllInactiveContainers(ContainerManager.java:98)
>         at org.apache.geode.session.tests.TomcatSessionBackwardsCompatibilityTestBase.doPutAndGetSessionOnAllClients(TomcatSessionBackwardsCompatibilityTestBase.java:187)
>         at org.apache.geode.session.tests.TomcatSessionBackwardsCompatibilityTomcat8WithOldModuleCanDoPutsTest.test(TomcatSessionBackwardsCompatibilityTomcat8WithOldModuleCanDoPutsTest.java:35)
>         Caused by:
>         java.lang.RuntimeException: Something very bad happened to this container when starting. Check the cargo_logs folder for container logs.
>             at org.apache.geode.session.tests.ServerContainer.start(ServerContainer.java:218)
>             at org.apache.geode.session.tests.ContainerManager.startContainer(ContainerManager.java:77)
>             ... 4 more
>             Caused by:
>             org.codehaus.cargo.container.ContainerException: Deployable [http://localhost:22942/cargocpc/index.html] failed to finish deploying within the timeout period [120000]. The Deployable state is thus unknown.
>                 at org.codehaus.cargo.container.spi.deployer.DeployerWatchdog.watch(DeployerWatchdog.java:111)
>                 at org.codehaus.cargo.container.spi.AbstractLocalContainer.waitForCompletion(AbstractLocalContainer.java:385)
>                 at org.codehaus.cargo.container.spi.AbstractLocalContainer.start(AbstractLocalContainer.java:232)
>                 at org.apache.geode.session.tests.ServerContainer.start(ServerContainer.java:216)
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)