mercedes-benz / sechub

SecHub provides a central API to test software with different security tools.
https://mercedes-benz.github.io/sechub/
MIT License
259 stars 61 forks source link

Handle flaky integration-test SecHubExecutionScenario2IntTest #189

Closed de-jcup closed 4 years ago

de-jcup commented 4 years ago

Sometimes / very often SecHubExecutionScenario2IntTest method when_user_is_assigned_to_project_job_can_be_created_and_approved_user_1_can_get_report_but_not_user2 fails on Jenkins - but not on GitHub Actions. Either this is a race condition in testing or another problem.

Error Message

java.lang.IllegalStateException: Even after some retries no job report state was accessible!

Stacktrace

java.lang.IllegalStateException: Even after some retries no job report state was accessible!
    at com.daimler.sechub.integrationtest.api.AsUser.getJobReport(AsUser.java:303)
    at com.daimler.sechub.integrationtest.api.AssertUser.canGetReportForJob(AssertUser.java:327)
    at com.daimler.sechub.integrationtest.scenario2.SecHubExecutionScenario2IntTest.when_user_is_assigned_to_project_job_can_be_created_and_approved_user_1_can_get_report_but_not_user2(SecHubExecutionScenario2IntTest.java:246)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at com.daimler.sechub.integrationtest.api.IntegrationTestSetup$IntegrationTestStatement.evaluate(IntegrationTestSetup.java:159)
    at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
    at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.lang.Thread.run(Thread.java:748)

Standard Output
de-jcup commented 4 years ago

Here comes relevant part of Standard-Output (contains server error as well)

13:37:29.848 [Time-limited test] DEBUG org.springframework.web.client.RestTemplate - Reading to [java.lang.String] as "application/json"
13:37:29.848 [Time-limited test] INFO com.daimler.sechub.integrationtest.internal.AbstractTestScenario - ############################################################################################################
13:37:29.848 [Time-limited test] INFO com.daimler.sechub.integrationtest.internal.AbstractTestScenario - ###
13:37:29.848 [Time-limited test] INFO com.daimler.sechub.integrationtest.internal.AbstractTestScenario - ### [DONE ]  Ppreparing scenario: 'Scenario2'
13:37:29.848 [Time-limited test] INFO com.daimler.sechub.integrationtest.internal.AbstractTestScenario - ### [START]  Test itself
13:37:29.848 [Time-limited test] INFO com.daimler.sechub.integrationtest.internal.AbstractTestScenario - ###
13:37:29.848 [Time-limited test] INFO com.daimler.sechub.integrationtest.internal.AbstractTestScenario - ############################################################################################################
13:37:29.848 [Time-limited test] INFO com.daimler.sechub.integrationtest.internal.AbstractTestScenario - ###   Class =com.daimler.sechub.integrationtest.scenario2.SecHubExecutionScenario2IntTest
13:37:29.848 [Time-limited test] INFO com.daimler.sechub.integrationtest.internal.AbstractTestScenario - ###   Method=when_user_is_not_assigned_to_project_job_cannot_be_started
13:37:29.848 [Time-limited test] INFO com.daimler.sechub.integrationtest.internal.AbstractTestScenario - ############################################################################################################
13:37:29.848 [Time-limited test] INFO com.daimler.sechub.integrationtest.api.IntegrationTestSetup - Start waiting for preparation done: 100 milliseconds
13:37:29.948 [Time-limited test] DEBUG org.springframework.web.client.RestTemplate - HTTP GET https://localhost:8244/api/admin/user/scenario2_user1
13:37:29.948 [Time-limited test] DEBUG org.springframework.web.client.RestTemplate - Accept=[text/plain, application/json, application/cbor, application/*+json, */*]
13:37:29.949 [Time-limited test] INFO com.daimler.sechub.integrationtest.internal.TestSecHubRestAPIClientHttpRequestInterceptor - ...............REST call for user:int-test_superadmin............................
13:37:29.951 [Time-limited test] DEBUG org.springframework.web.client.RestTemplate - Response 200 OK
13:37:29.951 [Time-limited test] DEBUG org.springframework.web.client.RestTemplate - Reading to [java.lang.String] as "application/json"
13:37:29.951 [Time-limited test] DEBUG org.springframework.web.client.RestTemplate - HTTP GET https://localhost:8244/api/admin/user/scenario2_user1
13:37:29.952 [Time-limited test] DEBUG org.springframework.web.client.RestTemplate - Accept=[text/plain, application/json, application/cbor, application/*+json, */*]
13:37:29.952 [Time-limited test] INFO com.daimler.sechub.integrationtest.internal.TestSecHubRestAPIClientHttpRequestInterceptor - ...............REST call for user:int-test_superadmin............................
13:37:29.953 [Time-limited test] DEBUG org.springframework.web.client.RestTemplate - Response 200 OK
13:37:29.953 [Time-limited test] DEBUG org.springframework.web.client.RestTemplate - Reading to [java.lang.String] as "application/json"
13:37:29.954 [Time-limited test] DEBUG org.springframework.web.client.RestTemplate - HTTP GET https://localhost:8244/api/admin/project/scenario2_project1
13:37:29.954 [Time-limited test] DEBUG org.springframework.web.client.RestTemplate - Accept=[text/plain, application/json, application/cbor, application/*+json, */*]
13:37:29.954 [Time-limited test] INFO com.daimler.sechub.integrationtest.internal.TestSecHubRestAPIClientHttpRequestInterceptor - ...............REST call for user:int-test_superadmin............................
13:37:29.957 [Time-limited test] DEBUG org.springframework.web.client.RestTemplate - Response 200 OK
13:37:29.957 [Time-limited test] DEBUG org.springframework.web.client.RestTemplate - Reading to [java.lang.String] as "application/json"
13:37:29.957 [Time-limited test] DEBUG org.springframework.web.client.RestTemplate - HTTP GET https://localhost:8244/api/admin/project/scenario2_project1
13:37:29.957 [Time-limited test] DEBUG org.springframework.web.client.RestTemplate - Accept=[text/plain, application/json, application/cbor, application/*+json, */*]
13:37:29.957 [Time-limited test] INFO com.daimler.sechub.integrationtest.internal.TestSecHubRestAPIClientHttpRequestInterceptor - ...............REST call for user:int-test_superadmin............................
13:37:29.959 [Time-limited test] DEBUG org.springframework.web.client.RestTemplate - Response 200 OK
13:37:29.959 [Time-limited test] DEBUG org.springframework.web.client.RestTemplate - Reading to [java.lang.String] as "application/json"
13:37:29.959 [Time-limited test] DEBUG org.springframework.web.client.RestTemplate - HTTP POST https://localhost:8244/api/project/scenario2_project1/job
13:37:29.959 [Time-limited test] DEBUG org.springframework.web.client.RestTemplate - Accept=[text/plain, application/json, application/cbor, application/*+json, */*]
13:37:29.959 [Time-limited test] DEBUG org.springframework.web.client.RestTemplate - Writing [{

    "apiVersion": "1.0",

    "project"   : "__projectname__",

    "webScan"   : {
        "uris": ["https://netsparker.green.demo.example.org"]
    }
}] as "application/json"
13:37:29.959 [Time-limited test] INFO com.daimler.sechub.integrationtest.internal.TestSecHubRestAPIClientHttpRequestInterceptor - ...............REST call for user:scenario2_user1............................
13:37:30.043 [Time-limited test] DEBUG org.springframework.web.client.RestTemplate - Response 404 NOT_FOUND
13:37:30.043 [Time-limited test] ERROR com.daimler.sechub.integrationtest.internal.TestRestHelper - ############################################################################

server error -> 404

13:37:30.043 [Time-limited test] ERROR com.daimler.sechub.integrationtest.internal.TestRestHelper - ## CLIENT RESPONSE ERROR:404 NOT_FOUND, response:{"status":404,"error":"Not Found","message":"Project scenario2_project1 does not exist, or you have no access.","details":
[],"timeStamp":"Fri Feb 21 13:37:30 CET 2020","trace":"com.daimler.sechub.sharedkernel.error.NotFoundException: Project scenario2_project1 does not exist, or you have no access.
    at com.daimler.sechub.domain.schedule.access.ScheduleUserAccessToProjectValidationService.assertUserHasAccessToProject(ScheduleUserAccessToProjectValidationService.java:48)
    at com.daimler.sechub.domain.schedule.ScheduleAssertService.assertUserHasAccessToProject(ScheduleAssertService.java:36)
    at com.daimler.sechub.domain.schedule.SchedulerCreateJobService.createJob(SchedulerCreateJobService.java:50)
    at com.daimler.sechub.domain.schedule.SchedulerRestController.createJob(SchedulerRestController.java:68)
    at com.daimler.sechub.domain.schedule.SchedulerRestController$$FastClassBySpringCGLIB$$9d433c57.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:769)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747)
    at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:69)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)
    at com.daimler.sechub.domain.schedule.SchedulerRestController$$EnhancerBySpringCGLIB$$3c9360f1.createJob(<generated>)
    at sun.reflect.GeneratedMethodAccessor384.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:888)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:118)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:158)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:203)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:92)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:77)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:526)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1579)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
"}