Skip to content

Commit

Permalink
fixed remaining tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KopsMI committed Dec 1, 2024
1 parent 636e59e commit 680f782
Show file tree
Hide file tree
Showing 10 changed files with 5,393 additions and 1,504 deletions.
1,150 changes: 933 additions & 217 deletions src/Kusto/Kusto.Autorest/test/Get-AzKustoScript.Recording.json

Large diffs are not rendered by default.

36 changes: 22 additions & 14 deletions src/Kusto/Kusto.Autorest/test/Get-AzKustoScript.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,44 +21,52 @@ Describe 'Get-AzKustoScript' {
$clusterName = $env.kustoClusterName
$databaseName = "testdatabase" + $env.rstr4
$scriptContent = ".create table table3 (Level:string, Timestamp:datetime, UserId:string, TraceId:string, Message:string, ProcessId:int32)"
$scriptName = "testScript"

New-AzKustoDatabase -ResourceGroupName $env.resourceGroupName -ClusterName $clusterName -Name $databaseName -Kind ReadWrite -Location $env.location -SubscriptionId $env.SubscriptionId

New-AzKustoScript -ClusterName $clusterName -DatabaseName $databaseName -Name "testScript" -ResourceGroupName $env.resourceGroupName -SubscriptionId $env.SubscriptionId -ContinueOnError -ForceUpdateTag "tag1" -ScriptContent $scriptContent -PrincipalPermissionsAction "RemovePermissionOnScriptCompletion" -ScriptLevel "Database"
New-AzKustoScript -ClusterName $clusterName -DatabaseName $databaseName -Name $scriptName -ResourceGroupName $env.resourceGroupName -SubscriptionId $env.SubscriptionId -ContinueOnError -ForceUpdateTag "tag1" -ScriptContent $scriptContent -PrincipalPermissionsAction "RemovePermissionOnScriptCompletion" -ScriptLevel "Database"
$ScriptList = Get-AzKustoScript -ClusterName $clusterName -DatabaseName $databaseName -ResourceGroupName $env.resourceGroupName -SubscriptionId $env.SubscriptionId

Validate_Script $ScriptList "tag1" $continueOnErrors $clusterName $databaseName "testScript" -principalPermissionsAction "RemovePermissionOnScriptCompletion" -scriptLevel "Database"
Validate_Script $ScriptList "tag1" $continueOnErrors $clusterName $databaseName $scriptName -principalPermissionsAction "RemovePermissionOnScriptCompletion" -scriptLevel "Database"

Remove-AzKustoDatabase -ResourceGroupName $env.resourceGroupName -ClusterName $env.kustoClusterName -Name $name
Remove-AzKustoDatabase -ResourceGroupName $env.resourceGroupName -ClusterName $env.kustoClusterName -Name $databaseName
}

It 'Get' {
$continueOnErrors = $false
$clusterName = $env.kustoClusterName
$databaseName = $env.kustoDatabaseName
$databaseName = "testdatabase" + $env.rstr4
$scriptContent = ".create table table3 (Level:string, Timestamp:datetime, UserId:string, TraceId:string, Message:string, ProcessId:int32)"
$scriptName = "testScript"

New-AzKustoDatabase -ResourceGroupName $env.resourceGroupName -ClusterName $clusterName -Name $databaseName -Kind ReadWrite -Location $env.location -SubscriptionId $env.SubscriptionId

New-AzKustoScript -ClusterName $clusterName -DatabaseName $databaseName -Name "testScript" -ResourceGroupName $env.resourceGroupName -SubscriptionId $env.SubscriptionId -ContinueOnError -ForceUpdateTag "tag1" -ScriptContent $scriptContent -PrincipalPermissionsAction "RemovePermissionOnScriptCompletion" -ScriptLevel "Database"
$script = Get-AzKustoScript -ClusterName $clusterName -DatabaseName $databaseName -Name "testScript" -ResourceGroupName $env.resourceGroupName -SubscriptionId $env.SubscriptionId
New-AzKustoScript -ClusterName $clusterName -DatabaseName $databaseName -Name $scriptName -ResourceGroupName $env.resourceGroupName -SubscriptionId $env.SubscriptionId -ContinueOnError -ForceUpdateTag "tag1" -ScriptContent $scriptContent -PrincipalPermissionsAction "RemovePermissionOnScriptCompletion" -ScriptLevel "Database"
$script = Get-AzKustoScript -ClusterName $clusterName -DatabaseName $databaseName -Name $scriptName -ResourceGroupName $env.resourceGroupName -SubscriptionId $env.SubscriptionId

Validate_Script $script "tag1" $continueOnErrors $clusterName $databaseName "testScript" -principalPermissionsAction "RemovePermissionOnScriptCompletion" -scriptLevel "Database"
Validate_Script $script "tag1" $continueOnErrors $clusterName $databaseName $scriptName -principalPermissionsAction "RemovePermissionOnScriptCompletion" -scriptLevel "Database"

Remove-AzKustoDatabase -ResourceGroupName $env.resourceGroupName -ClusterName $env.kustoClusterName -Name $databaseName

Remove-AzKustoScript -InputObject $script
}

It 'GetViaIdentity' {
$continueOnErrors = $false
$clusterName = $env.kustoClusterName
$databaseName = $env.kustoDatabaseName
$databaseName = "testdatabase" + $env.rstr4
$scriptContent = ".create table table3 (Level:string, Timestamp:datetime, UserId:string, TraceId:string, Message:string, ProcessId:int32)"

New-AzKustoScript -ClusterName $clusterName -DatabaseName $databaseName -Name "testScript" -ResourceGroupName $env.resourceGroupName -SubscriptionId $env.SubscriptionId -ContinueOnError -ForceUpdateTag "tag1" -ScriptContent $scriptContent -PrincipalPermissionsAction "RemovePermissionOnScriptCompletion" -ScriptLevel "Database"
$script = Get-AzKustoScript -ClusterName $clusterName -DatabaseName $databaseName -Name "testScript" -ResourceGroupName $env.resourceGroupName -SubscriptionId $env.SubscriptionId
$scriptName = "testScript1"

New-AzKustoDatabase -ResourceGroupName $env.resourceGroupName -ClusterName $clusterName -Name $databaseName -Kind ReadWrite -Location $env.location -SubscriptionId $env.SubscriptionId

New-AzKustoScript -ClusterName $clusterName -DatabaseName $databaseName -Name $scriptName -ResourceGroupName $env.resourceGroupName -SubscriptionId $env.SubscriptionId -ContinueOnError -ForceUpdateTag "tag1" -ScriptContent $scriptContent -PrincipalPermissionsAction "RemovePermissionOnScriptCompletion" -ScriptLevel "Database"
$script = Get-AzKustoScript -ClusterName $clusterName -DatabaseName $databaseName -Name $scriptName -ResourceGroupName $env.resourceGroupName -SubscriptionId $env.SubscriptionId

$script = Get-AzKustoScript -InputObject $script

Validate_Script $script "tag1" $continueOnErrors $clusterName $databaseName "testScript" -principalPermissionsAction "RemovePermissionOnScriptCompletion" -scriptLevel "Database"
Validate_Script $script "tag1" $continueOnErrors $clusterName $databaseName $scriptName -principalPermissionsAction "RemovePermissionOnScriptCompletion" -scriptLevel "Database"

Remove-AzKustoScript -InputObject $script
Remove-AzKustoDatabase -ResourceGroupName $env.resourceGroupName -ClusterName $env.kustoClusterName -Name $databaseName
}
}
Loading

0 comments on commit 680f782

Please sign in to comment.