Exemplo n.º 1
0
        public async void DataProvders_TestKustoFailover()
        {
            var configFactory         = new MockDataProviderConfigurationFactory();
            var config                = configFactory.LoadConfigurations();
            var kustoHeartBeatService = new KustoHeartBeatService(config.KustoConfiguration);

            MockKustoClient.ShouldHeartbeatSucceed = true;
            int startingHeartBeatRuns = MockKustoClient.HeartBeatRuns;

            do
            {
                await Task.Delay(100);
            } while (startingHeartBeatRuns == MockKustoClient.HeartBeatRuns);
            Assert.Equal(config.KustoConfiguration.KustoClusterNameGroupings, await kustoHeartBeatService.GetClusterNameFromStamp("waws-prod-mockstamp"));


            MockKustoClient.ShouldHeartbeatSucceed = false;
            startingHeartBeatRuns = MockKustoClient.HeartBeatRuns;
            do
            {
                await Task.Delay(100);
            } while (startingHeartBeatRuns == MockKustoClient.HeartBeatRuns);
            Assert.Equal(config.KustoConfiguration.KustoClusterFailoverGroupings, await kustoHeartBeatService.GetClusterNameFromStamp("waws-prod-mockstamp"));

            MockKustoClient.ShouldHeartbeatSucceed = true;
            startingHeartBeatRuns = MockKustoClient.HeartBeatRuns;
            do
            {
                await Task.Delay(100);
            } while (startingHeartBeatRuns == MockKustoClient.HeartBeatRuns);
            Assert.Equal(config.KustoConfiguration.KustoClusterNameGroupings, await kustoHeartBeatService.GetClusterNameFromStamp("waws-prod-mockstamp"));
        }