コード例 #1
0
        public async Task AddKubernetesActuatorsWithConventions_IWebHostBuilder_AddsAndActivatesActuatorsAddAllActuators()
        {
            var hostBuilder = new WebHostBuilder();

            _testServerWithSecureRouting.Invoke(hostBuilder);

            var host       = hostBuilder.AddKubernetesActuators(ep => ep.RequireAuthorization("TestAuth")).Start();
            var testClient = host.GetTestServer().CreateClient();

            var response = await testClient.GetAsync("/actuator");

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            response = await testClient.GetAsync("/actuator/info");

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            response = await testClient.GetAsync("/actuator/health");

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            response = await testClient.GetAsync("/actuator/health/liveness");

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            Assert.Contains("\"LivenessState\":\"CORRECT\"", await response.Content.ReadAsStringAsync());
            response = await testClient.GetAsync("/actuator/health/readiness");

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            Assert.Contains("\"ReadinessState\":\"ACCEPTING_TRAFFIC\"", await response.Content.ReadAsStringAsync());
            response = await testClient.GetAsync("/actuator/httptrace");

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }
コード例 #2
0
        public async Task AddKubernetesActuators_IWebHostBuilder_AddsAndActivatesActuators_MediaV1()
        {
            var hostBuilder = new WebHostBuilder();

            _testServerWithRouting.Invoke(hostBuilder);

            var host       = hostBuilder.AddKubernetesActuators(MediaTypeVersion.V1).Start();
            var testClient = host.GetTestServer().CreateClient();

            var response = await testClient.GetAsync("/actuator");

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            response = await testClient.GetAsync("/actuator/info");

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            response = await testClient.GetAsync("/actuator/health");

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            response = await testClient.GetAsync("/actuator/health/liveness");

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            Assert.Contains("\"LivenessState\":\"CORRECT\"", await response.Content.ReadAsStringAsync());
            response = await testClient.GetAsync("/actuator/health/readiness");

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            Assert.Contains("\"ReadinessState\":\"ACCEPTING_TRAFFIC\"", await response.Content.ReadAsStringAsync());
            response = await testClient.GetAsync("/actuator/trace");

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }