我是 Cloudbees 的新手,我注意到在我的本地 Jenkins 上顺利运行的相同测试实际上在 Cloudbees 的 Jenkins 上是错误的......
基本上,所有基于 Mockito 的单元测试都尝试使用 Hibernate/Persistence导致此异常:
Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
在我的本地机器上通过的测试在 Cloudbees 上是错误的......
我不确定为什么。有人可以帮忙吗?
编辑:来自 Jenkins 的完整堆栈跟踪:
Tests in error:
modifyChildminderAdvertisementShouldHaveNormalInteractions(com.bignibou.tests.service.advertisement.AdvertisementManagementTest)
shouldContainCorrectNumberOfDayToTimeSlots(com.bignibou.tests.service.advertisement.RegularDayToTimeSlotsTest): Failed to load ApplicationContext
shouldNotContainSaturdayNorSunday(com.bignibou.tests.service.advertisement.RegularDayToTimeSlotsTest): Failed to load ApplicationContext
shouldNotContainEveningNorNighttime(com.bignibou.tests.service.advertisement.RegularDayToTimeSlotsTest): Failed to load ApplicationContext
signupMemberShouldHaveNormalInteractions(com.bignibou.tests.service.signup.SignupServiceTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
signupMemberShouldThrowIllegalArgumentExceptionIfAddressRefenceIsEmpty(com.bignibou.tests.service.signup.SignupServiceTest): Unexpected exception, expected<java.lang.IllegalArgumentException> but was<org.springframework.transaction.CannotCreateTransactionException>
activateMemberShouldThrowIllegalArgumentExceptionIfTokenIsEmpty(com.bignibou.tests.service.signup.SignupServiceTest): Unexpected exception, expected<java.lang.IllegalArgumentException> but was<org.springframework.transaction.CannotCreateTransactionException>
signupMemberShouldThrowIllegalArgumentExceptionIfAddressRefenceIsNull(com.bignibou.tests.service.signup.SignupServiceTest): Unexpected exception, expected<java.lang.IllegalArgumentException> but was<org.springframework.transaction.CannotCreateTransactionException>
activateMemberShouldThrowIllegalArgumentExceptionIfTokenIsNull(com.bignibou.tests.service.signup.SignupServiceTest): Unexpected exception, expected<java.lang.IllegalArgumentException> but was<org.springframework.transaction.CannotCreateTransactionException>
activateMemberShouldHaveNormalInteractions(com.bignibou.tests.service.signup.SignupServiceTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
activateMemberShouldThrowInvalidTokenExceptionIfTokenIsInvalid(com.bignibou.tests.service.signup.SignupServiceTest): Unexpected exception, expected<com.bignibou.InvalidTokenException> but was<org.springframework.transaction.CannotCreateTransactionException>
signupMemberShouldThrowIllegalArgumentExceptionIfMemberIsNull(com.bignibou.tests.service.signup.SignupServiceTest): Unexpected exception, expected<java.lang.IllegalArgumentException> but was<org.springframework.transaction.CannotCreateTransactionException>
signupMemberShouldRethrowMailerExceptionIfMessagingExceptionIsThrown(com.bignibou.tests.service.signup.SignupServiceTest): Unexpected exception, expected<com.bignibou.MailerException> but was<org.springframework.transaction.CannotCreateTransactionException>
activateMemberShouldThrowMailerExceptionIfMessagingExceptionIsThrown(com.bignibou.tests.service.signup.SignupServiceTest): Unexpected exception, expected<com.bignibou.MailerException> but was<org.springframework.transaction.CannotCreateTransactionException>
resendActivationEmailShouldHaveNormalInteractions(com.bignibou.tests.service.preference.PreferenceServiceTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
sendPasswordResetInfoShouldHaveNormalInteractions(com.bignibou.tests.service.preference.PreferenceServiceTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
modifyEmailShouldThrowIllegalArgumentExceptionIfMemberArgumentIsNull(com.bignibou.tests.service.preference.PreferenceServiceTest): Unexpected exception, expected<java.lang.IllegalArgumentException> but was<org.springframework.transaction.CannotCreateTransactionException>
resendActivationEmailShouldThrowInvalidTokenException(com.bignibou.tests.service.preference.PreferenceServiceTest): Unexpected exception, expected<com.bignibou.InvalidTokenException> but was<org.springframework.transaction.CannotCreateTransactionException>
modifyEmailShouldSetRelevantPropertiesToMember(com.bignibou.tests.service.preference.PreferenceServiceTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
emailShouldNotBeAvailable(com.bignibou.tests.service.preference.PreferenceServiceTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
activateEmailShouldHaveNormalInteractions(com.bignibou.tests.service.preference.PreferenceServiceTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
shouldActivateEmail(com.bignibou.tests.service.preference.PreferenceServiceTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
modifyEmailShouldThrowIllegalArgumentExceptionIfEmailArgumentIsEmpty(com.bignibou.tests.service.preference.PreferenceServiceTest): Unexpected exception, expected<java.lang.IllegalArgumentException> but was<org.springframework.transaction.CannotCreateTransactionException>
activateEmailShouldThrowIllegalArgumentExceptionIfTokenArgumentIsNull(com.bignibou.tests.service.preference.PreferenceServiceTest): Unexpected exception, expected<java.lang.IllegalArgumentException> but was<org.springframework.transaction.CannotCreateTransactionException>
modifyEmailShouldHaveNormalInteractions(com.bignibou.tests.service.preference.PreferenceServiceTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
emailShouldBeAvailable(com.bignibou.tests.service.preference.PreferenceServiceTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
modifyAddressShouldAllowMemberWithNoAddress(com.bignibou.tests.service.preference.PreferenceServiceTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
modifyPasswordShouldHaveNormalInteractions(com.bignibou.tests.service.preference.PreferenceServiceTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
shouldThrowMailerException(com.bignibou.tests.service.preference.PreferenceServiceTest): Unexpected exception, expected<com.bignibou.MailerException> but was<org.springframework.transaction.CannotCreateTransactionException>
sendPasswordResetInfoShouldNotAllowInexistentEmail(com.bignibou.tests.service.preference.PreferenceServiceTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
shouldThrowInvalidTokenException(com.bignibou.tests.service.preference.PreferenceServiceTest): Unexpected exception, expected<com.bignibou.InvalidTokenException> but was<org.springframework.transaction.CannotCreateTransactionException>
saveAddressFromReferenceShouldHaveNormalInteractions(com.bignibou.tests.service.preference.PreferenceServiceTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
modifyEmailShouldThrowIllegalArgumentExceptionIfEmailArgumentIsNull(com.bignibou.tests.service.preference.PreferenceServiceTest): Unexpected exception, expected<java.lang.IllegalArgumentException> but was<org.springframework.transaction.CannotCreateTransactionException>
testPerformChildminderAdvertisementSearch(com.bignibou.tests.repository.advertisement.ChildminderAdvertisementIntegrationTest): Failed to load ApplicationContext
shouldAllow(com.bignibou.tests.controller.advertisement.AdvertisementControllerTest): Request processing failed; nested exception is java.lang.NullPointerException
shouldNotAllow(com.bignibou.tests.controller.advertisement.AdvertisementControllerTest): Request processing failed; nested exception is java.lang.NullPointerException
Tests run: 55, Failures: 8, Errors: 36, Skipped: 1