Ejemplo 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"));
        }
Ejemplo n.º 2
0
        public async void DataProvders_TestKusto()
        {
            var metadata = ScriptTestDataHelper.GetRandomMetadata();

            metadata.ScriptText = @"
                public async static Task<DataTable> Run(DataProviders dataProviders) {
                    return await dataProviders.Kusto.ExecuteQuery(""TestA"", ""waws-prod-mockstamp"");
                }";

            var configFactory = new MockDataProviderConfigurationFactory();
            var config        = configFactory.LoadConfigurations();

            var kustoHeartBeatService = new KustoHeartBeatService(config.KustoConfiguration);
            var dataProviders         = new DataProviders.DataProviders(new DataProviderContext(config, Guid.NewGuid().ToString(), kustoHeartBeatService: kustoHeartBeatService));

            using (EntityInvoker invoker = new EntityInvoker(metadata, ScriptHelper.GetFrameworkReferences(), ScriptHelper.GetFrameworkImports()))
            {
                await invoker.InitializeEntryPointAsync();

                var result = (DataTable)await invoker.Invoke(new object[] { dataProviders });

                Assert.NotNull(result);
            }
        }