diff --git a/code/DeltaKustoAdxIntegrationTest/AdxIntegrationTestBase.cs b/code/DeltaKustoAdxIntegrationTest/AdxIntegrationTestBase.cs index ef75d4a1..6d87534c 100644 --- a/code/DeltaKustoAdxIntegrationTest/AdxIntegrationTestBase.cs +++ b/code/DeltaKustoAdxIntegrationTest/AdxIntegrationTestBase.cs @@ -19,8 +19,6 @@ namespace DeltaKustoAdxIntegrationTest { public abstract class AdxIntegrationTestBase : IntegrationTestBase { - private static readonly TimeSpan TIME_OUT = TimeSpan.FromSeconds(90); - private readonly Uri _clusterUri; private readonly string _currentDb; private readonly string _targetDb; @@ -84,15 +82,11 @@ protected AdxIntegrationTestBase() protected async Task TestAdxToFile(string statesFolderPath, string outputFolder) { - var cancellationToken = new CancellationTokenSource(TIME_OUT); - var ct = cancellationToken.Token; - await LoopThroughStateFilesAsync( statesFolderPath, - ct, async (fromFile, toFile) => { - await PrepareDbAsync(fromFile, true, ct); + await PrepareDbAsync(fromFile, true); var outputPath = outputFolder + Path.GetFileNameWithoutExtension(fromFile) @@ -104,15 +98,14 @@ await LoopThroughStateFilesAsync( .Append(("jobs.main.action.filePath", outputPath)); var parameters = await RunParametersAsync( "adx-to-file-params.json", - ct, overrides); var outputCommands = await LoadScriptAsync("", outputPath); var targetCommands = CommandBase.FromScript( await File.ReadAllTextAsync(toFile)); - await ApplyCommandsAsync(outputCommands, true, ct); + await ApplyCommandsAsync(outputCommands, true); - var finalCommands = await FetchDbCommandsAsync(true, ct); + var finalCommands = await FetchDbCommandsAsync(true); var targetModel = DatabaseModel.FromCommands(targetCommands); var finalModel = DatabaseModel.FromCommands(finalCommands); var finalScript = string.Join(";\n\n", finalCommands.Select(c => c.ToScript())); @@ -126,15 +119,11 @@ await LoopThroughStateFilesAsync( protected async Task TestFileToAdx(string statesFolderPath, string outputFolder) { - var cancellationToken = new CancellationTokenSource(TIME_OUT); - var ct = cancellationToken.Token; - await LoopThroughStateFilesAsync( statesFolderPath, - ct, async (fromFile, toFile) => { - await PrepareDbAsync(toFile, false, ct); + await PrepareDbAsync(toFile, false); var outputPath = outputFolder + Path.GetFileNameWithoutExtension(fromFile) @@ -146,7 +135,6 @@ await LoopThroughStateFilesAsync( .Append(("jobs.main.action.filePath", outputPath)); var parameters = await RunParametersAsync( "file-to-adx-params.json", - ct, overrides); var outputCommands = await LoadScriptAsync("", outputPath); var currentCommands = CommandBase.FromScript( @@ -156,10 +144,9 @@ await LoopThroughStateFilesAsync( await ApplyCommandsAsync( currentCommands.Concat(outputCommands), - true, - ct); + true); - var finalCommands = await FetchDbCommandsAsync(true, ct); + var finalCommands = await FetchDbCommandsAsync(true); var targetModel = DatabaseModel.FromCommands(targetCommands); var finalModel = DatabaseModel.FromCommands(finalCommands); var finalScript = string.Join(";\n\n", finalCommands.Select(c => c.ToScript())); @@ -173,17 +160,13 @@ await ApplyCommandsAsync( protected async Task TestAdxToAdx(string statesFolderPath, string outputFolder) { - var cancellationToken = new CancellationTokenSource(TIME_OUT); - var ct = cancellationToken.Token; - await LoopThroughStateFilesAsync( statesFolderPath, - ct, async (fromFile, toFile) => { await Task.WhenAll( - PrepareDbAsync(fromFile, true, ct), - PrepareDbAsync(toFile, false, ct)); + PrepareDbAsync(fromFile, true), + PrepareDbAsync(toFile, false)); var outputPath = outputFolder + Path.GetFileNameWithoutExtension(fromFile) @@ -195,11 +178,10 @@ await Task.WhenAll( .Append(("jobs.main.action.filePath", outputPath)); var parameters = await RunParametersAsync( "adx-to-adx-params.json", - ct, overrides); var targetCommands = CommandBase.FromScript( await File.ReadAllTextAsync(toFile)); - var finalCommands = await FetchDbCommandsAsync(false, ct); + var finalCommands = await FetchDbCommandsAsync(false); var targetModel = DatabaseModel.FromCommands(targetCommands); var finalModel = DatabaseModel.FromCommands(finalCommands); var finalScript = string.Join(";\n\n", finalCommands.Select(c => c.ToScript())); @@ -213,7 +195,6 @@ await Task.WhenAll( private async Task LoopThroughStateFilesAsync( string folderPath, - CancellationToken ct, Func loopFunction) { var stateFiles = Directory.GetFiles(folderPath); @@ -225,7 +206,7 @@ private async Task LoopThroughStateFilesAsync( foreach (var toFile in stateFiles) { Console.WriteLine($"Current loop: ({fromFile}, {toFile})"); - await CleanDatabasesAsync(ct); + await CleanDatabasesAsync(); await loopFunction(fromFile, toFile); } } @@ -233,26 +214,23 @@ private async Task LoopThroughStateFilesAsync( private async Task ApplyCommandsAsync( IEnumerable commands, - bool isCurrent, - CancellationToken ct) + bool isCurrent) { var gateway = CreateKustoManagementGateway(isCurrent); // Apply commands to the db - await gateway.ExecuteCommandsAsync(commands, ct); + await gateway.ExecuteCommandsAsync(commands); } - private async Task> FetchDbCommandsAsync( - bool isCurrent, - CancellationToken ct) + private async Task> FetchDbCommandsAsync(bool isCurrent) { var gateway = CreateKustoManagementGateway(isCurrent); var dbProvider = (IDatabaseProvider)new KustoDatabaseProvider( new ConsoleTracer(false), gateway); var emptyProvider = (IDatabaseProvider)new EmptyDatabaseProvider(); - var finalDb = await dbProvider.RetrieveDatabaseAsync(ct); - var emptyDb = await emptyProvider.RetrieveDatabaseAsync(ct); + var finalDb = await dbProvider.RetrieveDatabaseAsync(); + var emptyDb = await emptyProvider.RetrieveDatabaseAsync(); // Use the delta from an empty db to get var finalCommands = emptyDb.ComputeDelta(finalDb); @@ -261,7 +239,6 @@ private async Task> FetchDbCommandsAsync( protected override Task RunParametersAsync( string parameterFilePath, - CancellationToken ct, IEnumerable<(string path, string value)>? overrides = null) { var adjustedOverrides = overrides != null @@ -273,20 +250,19 @@ protected override Task RunParametersAsync( .Append(("tokenProvider.login.clientId", _servicePrincipalId)) .Append(("tokenProvider.login.secret", _servicePrincipalSecret)); - return base.RunParametersAsync(parameterFilePath, ct, adjustedOverrides); + return base.RunParametersAsync(parameterFilePath, adjustedOverrides); } - protected async Task CleanDatabasesAsync(CancellationToken ct) + protected async Task CleanDatabasesAsync() { await Task.WhenAll( - CleanDbAsync(true, ct), - CleanDbAsync(false, ct)); + CleanDbAsync(true), + CleanDbAsync(false)); } protected async Task PrepareDbAsync( string scriptPath, - bool isCurrent, - CancellationToken ct) + bool isCurrent) { var script = await File.ReadAllTextAsync(scriptPath); @@ -295,7 +271,7 @@ protected async Task PrepareDbAsync( var commands = CommandBase.FromScript(script); var gateway = CreateKustoManagementGateway(isCurrent); - await gateway.ExecuteCommandsAsync(commands, ct); + await gateway.ExecuteCommandsAsync(commands); } catch (Exception ex) { @@ -333,18 +309,18 @@ private ITokenProvider CreateTokenProvider() return tokenProvider!; } - private async Task CleanDbAsync(bool isCurrent, CancellationToken ct) + private async Task CleanDbAsync(bool isCurrent) { var emptyDbProvider = (IDatabaseProvider)new EmptyDatabaseProvider(); var kustoGateway = CreateKustoManagementGateway(isCurrent); var dbProvider = (IDatabaseProvider)new KustoDatabaseProvider( new ConsoleTracer(false), kustoGateway); - var emptyDb = await emptyDbProvider.RetrieveDatabaseAsync(ct); - var db = await dbProvider.RetrieveDatabaseAsync(ct); + var emptyDb = await emptyDbProvider.RetrieveDatabaseAsync(); + var db = await dbProvider.RetrieveDatabaseAsync(); var currentDeltaCommands = db.ComputeDelta(emptyDb); - await kustoGateway.ExecuteCommandsAsync(currentDeltaCommands, ct); + await kustoGateway.ExecuteCommandsAsync(currentDeltaCommands); } } } \ No newline at end of file diff --git a/code/DeltaKustoAdxIntegrationTest/FailIfDataLossTest.cs b/code/DeltaKustoAdxIntegrationTest/FailIfDataLossTest.cs index 7a4e3957..094649dd 100644 --- a/code/DeltaKustoAdxIntegrationTest/FailIfDataLossTest.cs +++ b/code/DeltaKustoAdxIntegrationTest/FailIfDataLossTest.cs @@ -18,12 +18,11 @@ public class FailIfDataLossTest : AdxIntegrationTestBase public async Task TestFailIfDropsNoDrop() { var toFile = "FailIfDataLoss/target.kql"; - var ct = CreateCancellationToken(); - await CleanDatabasesAsync(ct); - await PrepareDbAsync(toFile, false, ct); + await CleanDatabasesAsync(); + await PrepareDbAsync(toFile, false); - await RunParametersAsync("FailIfDataLoss/no-fail.json", ct, TargetDbOverrides); + await RunParametersAsync("FailIfDataLoss/no-fail.json", TargetDbOverrides); // We just test that this doesn't fail } @@ -32,10 +31,9 @@ public async Task TestFailIfDropsNoDrop() public async Task TestFailIfDrops() { var toFile = "FailIfDataLoss/target.kql"; - var ct = CreateCancellationToken(); - await CleanDatabasesAsync(ct); - await PrepareDbAsync(toFile, false, ct); + await CleanDatabasesAsync(); + await PrepareDbAsync(toFile, false); var overrides = TargetDbOverrides .Append(("failIfDrops", "true")); @@ -44,7 +42,7 @@ public async Task TestFailIfDrops() { // The "Main" will return non-zero which will throw an exception var parameters = - await RunParametersAsync("FailIfDataLoss/no-fail.json", ct, overrides); + await RunParametersAsync("FailIfDataLoss/no-fail.json", overrides); Assert.True(parameters.FailIfDataLoss); Assert.False(true, "Should have thrown by now"); @@ -53,8 +51,5 @@ public async Task TestFailIfDrops() { } } - - private CancellationToken CreateCancellationToken() => - new CancellationTokenSource(TimeSpan.FromSeconds(8)).Token; } } \ No newline at end of file diff --git a/code/DeltaKustoFileIntegrationTest/Functions/EmptyCurrent/FunctionEmptyCurrentTest.cs b/code/DeltaKustoFileIntegrationTest/Functions/EmptyCurrent/FunctionEmptyCurrentTest.cs index 0b06975d..40621f7a 100644 --- a/code/DeltaKustoFileIntegrationTest/Functions/EmptyCurrent/FunctionEmptyCurrentTest.cs +++ b/code/DeltaKustoFileIntegrationTest/Functions/EmptyCurrent/FunctionEmptyCurrentTest.cs @@ -12,7 +12,7 @@ public class FunctionEmptyCurrentTest : IntegrationTestBase public async Task EmptyDelta() { var paramPath = "Functions/EmptyCurrent/EmptyDelta/empty-delta-params.yaml"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var outputPath = parameters.Jobs!.First().Value.Action!.FilePath!; var commands = await LoadScriptAsync(paramPath, outputPath); @@ -23,7 +23,7 @@ public async Task EmptyDelta() public async Task OneFunctionDelta() { var paramPath = "Functions/EmptyCurrent/OneFunctionDelta/delta-params.yaml"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var inputPath = parameters.Jobs!.First().Value.Target!.Scripts!.First().FilePath!; var outputPath = parameters.Jobs!.First().Value.Action!.FilePath!; var inputCommands = await LoadScriptAsync(paramPath, inputPath); @@ -36,7 +36,7 @@ public async Task OneFunctionDelta() public async Task TwoFunctionsDelta() { var paramPath = "Functions/EmptyCurrent/TwoFunctionsDelta/delta-params.yaml"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var inputPath = parameters.Jobs!.First().Value.Target!.Scripts!.First().FilePath!; var outputPath = parameters.Jobs!.First().Value.Action!.FilePath!; var inputCommands = await LoadScriptAsync(paramPath, inputPath); @@ -44,8 +44,5 @@ public async Task TwoFunctionsDelta() Assert.True(inputCommands.SequenceEqual(outputCommands)); } - - private CancellationToken CreateCancellationToken() => - new CancellationTokenSource(TimeSpan.FromSeconds(2)).Token; } } \ No newline at end of file diff --git a/code/DeltaKustoFileIntegrationTest/Functions/WithCurrent/FunctionWithCurrentTest.cs b/code/DeltaKustoFileIntegrationTest/Functions/WithCurrent/FunctionWithCurrentTest.cs index 4e254562..97a20c46 100644 --- a/code/DeltaKustoFileIntegrationTest/Functions/WithCurrent/FunctionWithCurrentTest.cs +++ b/code/DeltaKustoFileIntegrationTest/Functions/WithCurrent/FunctionWithCurrentTest.cs @@ -14,7 +14,7 @@ public class FunctionWithCurrentTest : IntegrationTestBase public async Task EmptyBoth() { var paramPath = "Functions/WithCurrent/EmptyBoth/delta-params.json"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var outputPath = parameters.Jobs!.First().Value.Action!.FilePath!; var commands = await LoadScriptAsync(paramPath, outputPath); @@ -25,7 +25,7 @@ public async Task EmptyBoth() public async Task Same() { var paramPath = "Functions/WithCurrent/Same/delta-params.json"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var outputPath = parameters.Jobs!.First().Value.Action!.FilePath!; var commands = await LoadScriptAsync(paramPath, outputPath); @@ -36,7 +36,7 @@ public async Task Same() public async Task TargetMore() { var paramPath = "Functions/WithCurrent/TargetMore/delta-params.json"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var outputPath = parameters.Jobs!.First().Value.Action!.FilePath!; var commands = await LoadScriptAsync(paramPath, outputPath); @@ -51,7 +51,7 @@ public async Task TargetMore() public async Task TargetLess() { var paramPath = "Functions/WithCurrent/TargetLess/delta-params.json"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var outputRootFolder = parameters.Jobs!.First().Value.Action!.FolderPath!; var outputPath = Path.Combine(outputRootFolder, "functions/drop/YourFunction.kql"); var commands = await LoadScriptAsync(paramPath, outputPath); @@ -62,8 +62,5 @@ public async Task TargetLess() Assert.Equal("YourFunction", function.FunctionName.Name); } - - private CancellationToken CreateCancellationToken() => - new CancellationTokenSource(TimeSpan.FromSeconds(2)).Token; } } \ No newline at end of file diff --git a/code/DeltaKustoFileIntegrationTest/IntegrationTestBase.cs b/code/DeltaKustoFileIntegrationTest/IntegrationTestBase.cs index a4bedaec..283e57ad 100644 --- a/code/DeltaKustoFileIntegrationTest/IntegrationTestBase.cs +++ b/code/DeltaKustoFileIntegrationTest/IntegrationTestBase.cs @@ -54,6 +54,8 @@ private class ProjectSetting } #endregion + private static readonly TimeSpan PROCESS_TIMEOUT = TimeSpan.FromSeconds(20); + private readonly string? _executablePath; static IntegrationTestBase() @@ -85,9 +87,9 @@ static IntegrationTestBase() } protected SimpleHttpClientFactory HttpClientFactory { get; } - + protected IKustoManagementGatewayFactory GatewayFactory { get; } - + protected ITokenProviderFactory TokenProviderFactory { get; } protected IntegrationTestBase() @@ -109,15 +111,13 @@ protected IntegrationTestBase() } var tracer = new ConsoleTracer(false); - + HttpClientFactory = new SimpleHttpClientFactory(tracer); GatewayFactory = new KustoManagementGatewayFactory(tracer, HttpClientFactory); TokenProviderFactory = new TokenProviderFactory(tracer, HttpClientFactory); } - protected async virtual Task RunMainAsync( - CancellationToken ct, - params string[] args) + protected async virtual Task RunMainAsync(params string[] args) { if (_executablePath == null) { @@ -148,6 +148,8 @@ protected async virtual Task RunMainAsync( if (started) { + var ct = new CancellationTokenSource(PROCESS_TIMEOUT).Token; + await process.WaitForExitAsync(ct); return process.ExitCode; @@ -161,18 +163,15 @@ protected async virtual Task RunMainAsync( } } - protected async virtual Task RunSuccessfulMainAsync( - CancellationToken ct, - params string[] args) + protected async virtual Task RunSuccessfulMainAsync(params string[] args) { - var returnedValue = await RunMainAsync(ct, args); + var returnedValue = await RunMainAsync(args); Assert.Equal(0, returnedValue); } protected async virtual Task RunParametersAsync( string parameterFilePath, - CancellationToken ct, IEnumerable<(string path, string value)>? overrides = null) { var pathOverrides = overrides != null @@ -182,7 +181,7 @@ protected async virtual Task RunParametersAsync( var cliParameters = overrides != null ? baseParameters.Append("-o").Concat(pathOverrides) : baseParameters; - var returnedValue = await RunMainAsync(ct, cliParameters.ToArray()); + var returnedValue = await RunMainAsync(cliParameters.ToArray()); if (returnedValue != 0) { @@ -210,7 +209,7 @@ protected async virtual Task> LoadScriptAsync( var rootFolder = Path.GetDirectoryName(paramPath) ?? ""; var path = Path.Combine(rootFolder!, scriptPath); - if(!File.Exists(path)) + if (!File.Exists(path)) { throw new InvalidOperationException($"Can't find '{path}'"); } diff --git a/code/DeltaKustoFileIntegrationTest/JsonSchema/JsonSchemaTest.cs b/code/DeltaKustoFileIntegrationTest/JsonSchema/JsonSchemaTest.cs index aa300bfd..f21223d6 100644 --- a/code/DeltaKustoFileIntegrationTest/JsonSchema/JsonSchemaTest.cs +++ b/code/DeltaKustoFileIntegrationTest/JsonSchema/JsonSchemaTest.cs @@ -13,7 +13,7 @@ public class JsonSchemaTest : IntegrationTestBase public async Task HelpSamples() { var paramPath = "JsonSchema/HelpSamples/delta-params.yaml"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var outputPath = parameters.Jobs!.First().Value.Action!.FilePath!; var outputCommands = await LoadScriptAsync(paramPath, outputPath); // Mostly a check we can process the json file @@ -24,8 +24,5 @@ public async Task HelpSamples() Assert.Single(oneTable); } - - private CancellationToken CreateCancellationToken() => - new CancellationTokenSource(TimeSpan.FromSeconds(2)).Token; } } \ No newline at end of file diff --git a/code/DeltaKustoFileIntegrationTest/Mappings/MappingTest.cs b/code/DeltaKustoFileIntegrationTest/Mappings/MappingTest.cs index 0c6844e3..1c1d7551 100644 --- a/code/DeltaKustoFileIntegrationTest/Mappings/MappingTest.cs +++ b/code/DeltaKustoFileIntegrationTest/Mappings/MappingTest.cs @@ -14,7 +14,7 @@ public class MappingTest : IntegrationTestBase public async Task NoneToOne() { var paramPath = "Mappings/NoneToOne/delta-params.yaml"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var outputPath = parameters.Jobs!.First().Value.Action!.FilePath!; var outputCommands = await LoadScriptAsync(paramPath, outputPath); @@ -33,7 +33,7 @@ public async Task NoneToOne() public async Task OneToTwo() { var paramPath = "Mappings/OneToTwo/delta-params.yaml"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var outputPath = parameters.Jobs!.First().Value.Action!.FilePath!; var outputCommands = await LoadScriptAsync(paramPath, outputPath); @@ -57,7 +57,7 @@ public async Task OneToTwo() public async Task TwoToOne() { var paramPath = "Mappings/TwoToOne/delta-params.yaml"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var outputPath = parameters.Jobs!.First().Value.Action!.FilePath!; var outputCommands = await LoadScriptAsync(paramPath, outputPath); @@ -67,8 +67,5 @@ public async Task TwoToOne() Assert.Equal("csv", dropMappingCommand.MappingKind); } - - private CancellationToken CreateCancellationToken() => - new CancellationTokenSource(TimeSpan.FromSeconds(2)).Token; } } \ No newline at end of file diff --git a/code/DeltaKustoFileIntegrationTest/Tables/EmptyCurrent/TableEmptyCurrentTest.cs b/code/DeltaKustoFileIntegrationTest/Tables/EmptyCurrent/TableEmptyCurrentTest.cs index f09b1785..ce9f0b1a 100644 --- a/code/DeltaKustoFileIntegrationTest/Tables/EmptyCurrent/TableEmptyCurrentTest.cs +++ b/code/DeltaKustoFileIntegrationTest/Tables/EmptyCurrent/TableEmptyCurrentTest.cs @@ -12,7 +12,7 @@ public class TableEmptyCurrentTest : IntegrationTestBase public async Task OneTableDelta() { var paramPath = "Tables/EmptyCurrent/OneTableDelta/delta-params.yaml"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var inputPath = parameters.Jobs!.First().Value.Target!.Scripts!.First().FilePath!; var outputPath = parameters.Jobs!.First().Value.Action!.FilePath!; var inputCommands = await LoadScriptAsync(paramPath, inputPath); @@ -25,7 +25,7 @@ public async Task OneTableDelta() public async Task TwoFunctionsDelta() { var paramPath = "Tables/EmptyCurrent/TwoTablesDelta/delta-params.yaml"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var inputPath = parameters.Jobs!.First().Value.Target!.Scripts!.First().FilePath!; var outputPath = parameters.Jobs!.First().Value.Action!.FilePath!; var inputCommands = await LoadScriptAsync(paramPath, inputPath); @@ -33,8 +33,5 @@ public async Task TwoFunctionsDelta() Assert.True(inputCommands.SequenceEqual(outputCommands)); } - - private CancellationToken CreateCancellationToken() => - new CancellationTokenSource(TimeSpan.FromSeconds(2)).Token; } } \ No newline at end of file diff --git a/code/DeltaKustoFileIntegrationTest/Tables/Scenarios/TableScenariosTest.cs b/code/DeltaKustoFileIntegrationTest/Tables/Scenarios/TableScenariosTest.cs index 5119f25c..f8da91e7 100644 --- a/code/DeltaKustoFileIntegrationTest/Tables/Scenarios/TableScenariosTest.cs +++ b/code/DeltaKustoFileIntegrationTest/Tables/Scenarios/TableScenariosTest.cs @@ -14,7 +14,7 @@ public class TableScenariosTest : IntegrationTestBase public async Task AddFolderOnTable() { var paramPath = "Tables/Scenarios/AddFolderOnTable/delta-params.yaml"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var outputPath = parameters.Jobs!.First().Value.Action!.FilePath!; var commands = await LoadScriptAsync(paramPath, outputPath); @@ -29,7 +29,7 @@ public async Task AddFolderOnTable() public async Task AddDocStringOnTable() { var paramPath = "Tables/Scenarios/AddDocStringOnTable/delta-params.yaml"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var outputPath = parameters.Jobs!.First().Value.Action!.FilePath!; var commands = await LoadScriptAsync(paramPath, outputPath); @@ -44,7 +44,7 @@ public async Task AddDocStringOnTable() public async Task ChangeColumnType() { var paramPath = "Tables/Scenarios/ChangeColumnType/delta-params.yaml"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var outputPath = parameters.Jobs!.First().Value.Action!.FilePath!; var commands = await LoadScriptAsync(paramPath, outputPath); @@ -59,7 +59,7 @@ public async Task ChangeColumnType() public async Task DropColumn() { var paramPath = "Tables/Scenarios/DropColumn/delta-params.yaml"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var outputPath = parameters.Jobs!.First().Value.Action!.FilePath!; var commands = await LoadScriptAsync(paramPath, outputPath); @@ -75,7 +75,7 @@ public async Task DropColumn() public async Task ChangeColumnDocString() { var paramPath = "Tables/Scenarios/ChangeColumnDoc/delta-params.yaml"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var outputPath = parameters.Jobs!.First().Value.Action!.FilePath!; var commands = await LoadScriptAsync(paramPath, outputPath); @@ -95,7 +95,7 @@ public async Task ChangeColumnDocString() public async Task DropColumnDocString() { var paramPath = "Tables/Scenarios/DropColumnDoc/delta-params.yaml"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var outputPath = parameters.Jobs!.First().Value.Action!.FilePath!; var commands = await LoadScriptAsync(paramPath, outputPath); @@ -115,7 +115,7 @@ public async Task DropColumnDocString() public async Task DropMultipleTablesTablesString() { var paramPath = "Tables/Scenarios/DropMultipleTables/delta-params.yaml"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var outputPath = parameters.Jobs!.First().Value.Action!.FilePath!; var commands = await LoadScriptAsync(paramPath, outputPath); @@ -125,8 +125,5 @@ public async Task DropMultipleTablesTablesString() Assert.Equal(3, dropTables.TableNames.Count); } - - private CancellationToken CreateCancellationToken() => - new CancellationTokenSource(TimeSpan.FromSeconds(2)).Token; } } \ No newline at end of file diff --git a/code/DeltaKustoFileIntegrationTest/Tables/WithCurrent/TableWithCurrentTest.cs b/code/DeltaKustoFileIntegrationTest/Tables/WithCurrent/TableWithCurrentTest.cs index 58e8dccd..98e5793f 100644 --- a/code/DeltaKustoFileIntegrationTest/Tables/WithCurrent/TableWithCurrentTest.cs +++ b/code/DeltaKustoFileIntegrationTest/Tables/WithCurrent/TableWithCurrentTest.cs @@ -14,7 +14,7 @@ public class TableWithCurrentTest : IntegrationTestBase public async Task EmptyBoth() { var paramPath = "Tables/WithCurrent/EmptyBoth/delta-params.json"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var outputPath = parameters.Jobs!.First().Value.Action!.FilePath!; var commands = await LoadScriptAsync(paramPath, outputPath); @@ -25,7 +25,7 @@ public async Task EmptyBoth() public async Task Same() { var paramPath = "Tables/WithCurrent/Same/delta-params.json"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var outputPath = parameters.Jobs!.First().Value.Action!.FilePath!; var commands = await LoadScriptAsync(paramPath, outputPath); @@ -36,7 +36,7 @@ public async Task Same() public async Task TargetMore() { var paramPath = "Tables/WithCurrent/TargetMore/delta-params.json"; - var parameters = await RunParametersAsync(paramPath,CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var outputPath = parameters.Jobs!.First().Value.Action!.FilePath!; var commands = await LoadScriptAsync(paramPath, outputPath); @@ -51,7 +51,7 @@ public async Task TargetMore() public async Task TargetLess() { var paramPath = "Tables/WithCurrent/TargetLess/delta-params.json"; - var parameters = await RunParametersAsync(paramPath, CreateCancellationToken()); + var parameters = await RunParametersAsync(paramPath); var outputRootFolder = parameters.Jobs!.First().Value.Action!.FolderPath!; var outputPath = Path.Combine(outputRootFolder, "tables/drop/your-table.kql"); var commands = await LoadScriptAsync(paramPath, outputPath); @@ -62,8 +62,5 @@ public async Task TargetLess() Assert.Equal("your-table", table.TableName.Name); } - - private CancellationToken CreateCancellationToken() => - new CancellationTokenSource(TimeSpan.FromSeconds(2)).Token; } } \ No newline at end of file