celestial-winter / vics

MIT License
96 stars 34 forks source link

Build fails with redis/jedis errors in many tests #6

Open simon-brooke opened 7 years ago

simon-brooke commented 7 years ago

I've followed the build instructions in the README, but the build fails. It fails both as a normal user and also as root. Both failures are similar and may be identical.

The following tests fail:

Tests in error: CanvassCardTest.returnsBadRequestIfStreetsIsEmpty » IllegalState Failed to loa... CanvassCardTest.returnsBadRequestIfStreetsNull » IllegalState Failed to load A... ConstituenciesTest.addsAUserAssociation » IllegalState Failed to load Applicat... ConstituenciesTest.addsAUserAssociationByUsername » IllegalState Failed to loa... ConstituenciesTest.removesAUserAssociation » IllegalState Failed to load Appli... ConstituenciesTest.returnsEmptyListIfLimitIsZeroWhenRequestingRestrictedConstituencies » IllegalState ConstituenciesTest.returnsTheConstituenciesByName » IllegalState Failed to loa... ConstituenciesTest.returnsTheUserRestrictedConstituencies » IllegalState Faile... ConstituenciesTest.returnsUnauthorizedIfUserNotAdminWehnSearching » IllegalState ConstituenciesTest.searchesUserRestrictedConstituenciesByName » IllegalState F... ConstituenciesTest.searchesUserRestrictedConstituenciesByNameIgnoresCase » IllegalState ConstituenciesTest.searchesUserRestrictedConstituenciesByNameReturnsEmptyListIfNotFound » IllegalState GeoTest.encodesTheConstituencyStatsInTheUkTopoJson » IllegalState Failed to lo... GeoTest.returnsNotFoundForNonExistentPostcode » IllegalState Failed to load Ap... GeoTest.returnsThePostcodeMetaData » IllegalState Failed to load ApplicationCo... GotvTest.returnsBadRequestIfIntentionRangeInvalid » IllegalState Failed to loa... GotvTest.returnsBadRequestIfLikelihoodRangeInvalid » IllegalState Failed to lo... GotvTest.returnsNotFoundIfNoPostalVotersOnStreets » IllegalState Failed to loa... GotvTest.returnsTheFilteredVoters » IllegalState Failed to load ApplicationCon... HealthCheckTest.returnsTheHealthStatus » IllegalState Failed to load Applicati... PrivilegesTest.assignsTheViewMapsPrivilegeToUser » IllegalState Failed to load... PrivilegesTest.failsToAssignAPrivilegeIfUserNotAdmin » IllegalState Failed to ... PrivilegesTest.failsToRemoveAPrivilegeIfUserNotAdmin » IllegalState Failed to ... PrivilegesTest.removesTheViewMapsPrivilege » IllegalState Failed to load Appli... StatsTest.adminCountsReturnsNotAuthorizedIfNonAdmin » IllegalState Failed to l... StatsTest.countsUsersByRegion » IllegalState Failed to load ApplicationContext StatsTest.countsUsersByRegionReturnsNotAuthorizedIfNonAdmin » IllegalState Fai... StatsTest.returnsConstituenciesStats » IllegalState Failed to load Application... StatsTest.returnsTheAdminCounts » IllegalState Failed to load ApplicationConte... StatsTest.returnsTheConstituencyStats » IllegalState Failed to load Applicatio... StatsTest.returnsTheTopCanvassers » IllegalState Failed to load ApplicationCon... StatsTest.returnsTheTopConstituencies » IllegalState Failed to load Applicatio... StatsTest.returnsTheTopWards » IllegalState Failed to load ApplicationContext StatsTest.returnsWardsStats » IllegalState Failed to load ApplicationContext UserTest.createUserFailsIfEmailInvalid » IllegalState Failed to load Applicati... UserTest.createUserFailsIfNonAdminAccount » IllegalState Failed to load Applic... UserTest.createUserFailsIfUsernameAlreadyExists » IllegalState Failed to load ... UserTest.createsANewUser » IllegalState Failed to load ApplicationContext UserTest.deleteUserReturns400IfUserIdInvalidFormat » IllegalState Failed to lo... UserTest.deleteUserReturns404IfUserNotFound » IllegalState Failed to load Appl... UserTest.deleteUserReturnsNotAuthorizedIfNonAdmin » IllegalState Failed to loa... UserTest.deletesAUser » IllegalState Failed to load ApplicationContext UserTest.findsTheUsers » IllegalState Failed to load ApplicationContext UserTest.logsInTheUser » IllegalState Failed to load ApplicationContext UserTest.returnsNotAuthorizationIfCredentialsInvalidOnLogin » IllegalState Fai... VoterTest.recordsVoted » IllegalState Failed to load ApplicationContext VoterTest.returnsTheElectorsWhenSearchingByAttributes » IllegalState Failed to... VoterTest.undoVoted » IllegalState Failed to load ApplicationContext WardsTest.addsAUserAssociation » IllegalState Failed to load ApplicationContex... WardsTest.checksUserHasAssociations » IllegalState Failed to load ApplicationC... WardsTest.removesAUserAssociation » IllegalState Failed to load ApplicationCon... WardsTest.returns404IfConstituencyNotFound » IllegalState Failed to load Appli... WardsTest.returns404IfNonExistantID » IllegalState Failed to load ApplicationC... WardsTest.returnsFailureIfNotAdminWhenSearchingByName » IllegalState Failed to... WardsTest.returnsStreetsByWard » IllegalState Failed to load ApplicationContex... WardsTest.returnsTheRestrictedWardsForCovs » IllegalState Failed to load Appli... WardsTest.returnsTheWardsByName » IllegalState Failed to load ApplicationConte... WardsTest.returnsTheWardsSummariesForCovs » IllegalState Failed to load Applic... WardsTest.searchesUserRestrictedWardsByNameForAssociatedConstituencyCase » IllegalState WardsTest.searchesUserRestrictedWardsByNameForAssociatedWardCase » IllegalState ConstituencyRepositoryTest.returnsTheLimitedConstituencies » IllegalState Fail... ConstituencyRepositoryTest.searchByConstituencyNameIn » IllegalState Failed to... StatsRepositoryTest.recordsTheTotalCanvassedByWeekAndConstituency » IllegalState StatsRepositoryTest.recordsTheTotalCanvassedByWeekAndWard » IllegalState Faile... StatsRepositoryTest.returnsTheCanvassedContactsOverThePast7Days » IllegalState StatsRepositoryTest.returnsTheTopCanvassers » IllegalState Failed to load Appl... StatsRepositoryTest.returnsTheTopConstituencies » IllegalState Failed to load ... StatsRepositoryTest.returnsTheTopWards » IllegalState Failed to load Applicati... StatsRepositoryTest.returnsTheUserCountsByRegion » IllegalState Failed to load... UserRepositoryTest.returnsASpecificUserAndTheirRolesAndPermissions » IllegalState UserRepositoryTest.returnsAllTheUserSummaries » IllegalState Failed to load Ap... UserRepositoryTest.returnsTheUsers » IllegalState Failed to load ApplicationCo... WardRepositoryTest.returnsTheWards » IllegalState Failed to load ApplicationCo... WardRepositoryTest.returnsWardByConstituencyCodeAndWardNames » IllegalState Fa... WardRepositoryTest.returnsWardsByConstituency » IllegalState Failed to load Ap... WardRepositoryTest.searchUserRestrictedWardsByWardNameIn » IllegalState Failed... PasswordResetTokenRepositoryGeneratorTest.deletesTheExistingTokenByUsername » IllegalState PasswordResetTokenRepositoryGeneratorTest.returnsTheTokens » IllegalState Fail...

All the failing tests are in the web-server module:

Tests run: 163, Failures: 0, Errors: 78, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] webapp ............................................. SUCCESS [  1.433 s]
[INFO] common ............................................. SUCCESS [  3.030 s]
[INFO] paf-client ......................................... SUCCESS [  3.459 s]
[INFO] paf-stub ........................................... SUCCESS [  3.641 s]
[INFO] tools .............................................. SUCCESS [  0.862 s]
[INFO] web-client ......................................... SUCCESS [01:24 min]
[INFO] web-server ......................................... FAILURE [37:02 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 38:40 min

I imagine there's something fairly small and simple in the redis/jedis configuration that I'm missing, but I've failed to diagnose it.

simon-brooke commented 7 years ago

Environment:

simon-brooke commented 7 years ago

A typical error stacktrace is as follows. I don't guarantee they're all identical, but they're all fairly similar.

java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124) at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83) at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:183) at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:123) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:228) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:230) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:249) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:193) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:367) at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:274) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:161) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'enableRedisKeyspaceNotificationsInitializer' defined in class path resource [org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfiguration.class]: Invocation of init method failed; nested exception is org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) at org.springframework.boot.test.SpringApplicationContextLoader.loadContext(SpringApplicationContextLoader.java:98) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116) ... 26 common frames omitted Caused by: org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJedisConnector(JedisConnectionFactory.java:162) at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:251) at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:58) at org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration$EnableRedisKeyspaceNotificationsInitializer.afterPropertiesSet(RedisHttpSessionConfiguration.java:166) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ... 41 common frames omitted Caused by: redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool at redis.clients.util.Pool.getResource(Pool.java:50) at redis.clients.jedis.JedisPool.getResource(JedisPool.java:99) at redis.clients.jedis.JedisPool.getResource(JedisPool.java:12) at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJedisConnector(JedisConnectionFactory.java:155) ... 46 common frames omitted Caused by: redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused at redis.clients.jedis.Connection.connect(Connection.java:164) at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:82) at redis.clients.jedis.BinaryJedis.connect(BinaryJedis.java:1641) at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:85) at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:868) at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:435) at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:363) at redis.clients.util.Pool.getResource(Pool.java:48) ... 49 common frames omitted Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at redis.clients.jedis.Connection.connect(Connection.java:158) ... 56 common frames omitted