Class ITHttpServer

    • Constructor Detail

      • ITHttpServer

        public ITHttpServer()
    • Method Detail

      • reusesPropagatedSpanId

        @Test
        protected void reusesPropagatedSpanId()
                                       throws IOException
        Throws:
        IOException
      • createsChildWhenJoinDisabled

        @Test
        protected void createsChildWhenJoinDisabled()
                                             throws IOException
        Throws:
        IOException
      • readsBaggage_unsampled

        @Test
        protected void readsBaggage_unsampled()
                                       throws IOException
        Throws:
        IOException
      • readsBaggage_existingTrace

        @Test
        protected void readsBaggage_existingTrace()
                                           throws IOException
        Throws:
        IOException
      • async

        @Test
        protected void async()
                      throws IOException
        Tests that the span propagates between under asynchronous callbacks (even if explicitly)
        Throws:
        IOException
      • createsChildSpan

        @Test
        protected void createsChildSpan()
                                 throws IOException
        This ensures thread-state is propagated from trace interceptors to user code. The endpoint "/child" is expected to create an in-process span. When this works, it should be a child of the "current span", in this case the span representing an incoming server request. When thread state isn't managed properly, the child span will appear as a new trace.
        Throws:
        IOException
      • childCompletesBeforeServer

        @Test
        protected void childCompletesBeforeServer()
                                           throws IOException
        The child completes before the response code is established, so it should be contained completely by the server's interval.
        Throws:
        IOException
      • reportsClientAddress_XForwardedFor

        @Test
        protected void reportsClientAddress_XForwardedFor()
                                                   throws IOException
        Throws:
        IOException
      • reportsServerKindToZipkin

        @Test
        protected void reportsServerKindToZipkin()
                                          throws IOException
        Throws:
        IOException
      • defaultSpanNameIsMethodNameOrRoute

        @Test
        protected void defaultSpanNameIsMethodNameOrRoute()
                                                   throws IOException
        Throws:
        IOException
      • readsRequestAtResponseTime

        @Test
        protected void readsRequestAtResponseTime()
                                           throws IOException
        Throws:
        IOException
      • supportsPortableCustomization

        @Test
        protected void supportsPortableCustomization()
                                              throws IOException
        Throws:
        IOException
      • httpRoute

        @Test
        protected void httpRoute()
                          throws IOException
        The "/items/{itemId}" endpoint should return the itemId in the response body, which proves templating worked (including that it ignores query parameters). Note the route format is framework specific, ex "/items/:itemId" in vert.x
        Throws:
        IOException
      • httpRoute_nested

        @Test
        protected void httpRoute_nested()
                                 throws IOException
        The "/nested/items/{itemId}" endpoint should be implemented by two route expressions: A path prefix: "/nested" and then a relative expression "/items/{itemId}"
        Throws:
        IOException
      • httpRoute_async

        @Test
        protected void httpRoute_async()
                                throws IOException
        Sometimes state used to carry http route data is different for async requests. This helps ensure we don't miss issues like this.
        Throws:
        IOException
      • notFound

        @Test
        protected void notFound()
                         throws IOException
        If http route is supported, then the span name should include it
        Throws:
        IOException
      • options

        @Test
        protected void options()
                        throws IOException
        This tests both that a root path ends up as "/" (slash) not "" (empty), as well that less typical OPTIONS methods can be traced.
        Throws:
        IOException
      • addsStatusCode_badRequest

        @Test
        protected void addsStatusCode_badRequest()
                                          throws IOException
        Throws:
        IOException
      • httpPathTagExcludesQueryParams

        @Test
        protected void httpPathTagExcludesQueryParams()
                                               throws IOException
        Throws:
        IOException
      • httpStatusCodeTagMatchesResponse_onUncaughtException

        @Test
        protected void httpStatusCodeTagMatchesResponse_onUncaughtException()
                                                                     throws IOException
        Throw NOT_READY_ISE inside your controller after setting the status code {code 503}.

        Note: Don't throw UnavailableException as Jetty ignores the exception message!

        Throws:
        IOException
      • httpStatusCodeTagMatchesResponse_onUncaughtException_async

        @Test
        protected void httpStatusCodeTagMatchesResponse_onUncaughtException_async()
                                                                           throws IOException
        Throws:
        IOException
      • httpStatusCodeSettable_onUncaughtException

        @Test
        protected void httpStatusCodeSettable_onUncaughtException()
                                                           throws IOException
        This tests that the actual code is 503, not 500 on exception.

        Usually, frameworks have an exception wrapper which allow you to control the status code. Other times, you have to set the status before raising the exception.

        Note: Some frameworks cannot control the status code upon unhandled error in a controller at all. If this is the case, just override and ignore this test.

        Throws:
        IOException
      • httpStatusCodeSettable_onUncaughtException_async

        @Test
        protected void httpStatusCodeSettable_onUncaughtException_async()
                                                                 throws IOException
        Throws:
        IOException
      • httpStatusCodeTagMatchesResponse_onUncaughtException

        protected okhttp3.Response httpStatusCodeTagMatchesResponse_onUncaughtException​(String path,
                                                                                        String errorMessage)
                                                                                 throws IOException
        Throws:
        IOException
      • httpStatusCodeTagMatchesResponse_onUncaughtException

        protected okhttp3.Response httpStatusCodeTagMatchesResponse_onUncaughtException​(String path)
                                                                                 throws IOException
        Throws:
        IOException
      • setsErrorAndHttpStatusOnUncaughtException

        @Test
        protected void setsErrorAndHttpStatusOnUncaughtException()
                                                          throws IOException
        Throws:
        IOException
      • setsErrorAndHttpStatusOnUncaughtException_async

        @Test
        protected void setsErrorAndHttpStatusOnUncaughtException_async()
                                                                throws IOException
        Throws:
        IOException
      • spanHandlerSeesError_async

        @Test
        protected void spanHandlerSeesError_async()
                                           throws IOException
        Throws:
        IOException