public async Task HostTests_StopsLibrary()

in src/LibraryTest/Library/HostTests.cs [63:104]


        public async Task HostTests_StopsLibrary()
        {
            // ARRANGE
            var telemetryClient = Common.SetupStubTelemetryClient(out var sentItems);

            int port = Common.GetPort();

            var config = $@"<?xml version=""1.0"" encoding=""utf-8"" ?>
<Configuration>
    <Host>0.0.0.0</Host>
    <Port>{port}</Port>
    <InstrumentationKey>[SPECIFY INSTRUMENTATION KEY HERE]</InstrumentationKey>
    <LiveMetricsStreamAuthenticationApiKey></LiveMetricsStreamAuthenticationApiKey>
    <AdaptiveSampling Enabled=""true"">
      <MaxEventsPerSecond>%ISTIO_MIXER_PLUGIN_AI_ADAPTIVE_SAMPLING_EVENTS_LIMIT%</MaxEventsPerSecond>
      <!--Telemetry items other than events are counted together-->
      <MaxOtherItemsPerSecond>%ISTIO_MIXER_PLUGIN_AI_ADAPTIVE_SAMPLING_LIMIT%</MaxOtherItemsPerSecond>
    </AdaptiveSampling>
</Configuration>
";

            Host host = new Host(telemetryClient);
            host.Run(config, TimeSpan.FromSeconds(5));
            Thread.Sleep(TimeSpan.FromMilliseconds(250));

            // ACT
            host.Stop();
            Thread.Sleep(TimeSpan.FromMilliseconds(250));

            var request = new HandleTraceSpanRequest();
            request.Instances.Add(new InstanceMsg()
            {
                HttpStatusCode = 203,
                SpanTags = { { "source.name", new Value { StringValue = "some-app-1" } }, { "destination.name", new Value { StringValue = "some-other-app-1" } } }
            });

            // ASSERT
            var writer = new GrpcWriter(port);
            await writer.Write(request).ConfigureAwait(false);

            Assert.Fail();
        }