Skip to content

Re-record Batch tests #6405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,15 @@ public BatchAccountTests(Xunit.Abstractions.ITestOutputHelper output)
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
}

[Fact(Skip = "Need service team to re-record test after changes to the ClientRuntime.")]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait("Re-record", "ClientRuntime changes")]
public void TestBatchAccountEndToEnd()
{
BatchController.NewInstance.RunPsTest("Test-BatchAccountEndToEnd");
}

[Fact]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestListNodeAgentSkus()
{
BatchController.NewInstance.RunPsTest("Test-GetBatchNodeAgentSkus");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class BatchApplicationPackageTests : WindowsAzure.Commands.Test.Utilities
private const string version = "foo";

[Fact]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestUploadApplicationPackage()
{
string id = "newApplicationPackage";
Expand Down Expand Up @@ -56,7 +56,7 @@ public void TestUploadApplicationPackage()
}

[Fact]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestUpdateApplicationPackage()
{
string id = "updateApplicationPackage";
Expand Down Expand Up @@ -85,8 +85,8 @@ public void TestUpdateApplicationPackage()
TestUtilities.GetCurrentMethodName());
}

[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCreatePoolWithApplicationPackage()
{
string id = "createPoolWithApplicationPackage";
Expand Down Expand Up @@ -114,8 +114,8 @@ public void TestCreatePoolWithApplicationPackage()
TestUtilities.GetCurrentMethodName());
}

[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestUpdatePoolWithApplicationPackage()
{
string id = "updatePoolWithApplicationPackage";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ public CertificateTests(Xunit.Abstractions.ITestOutputHelper output)
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
}

[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCertificateCrudOperations()
{
BatchController.NewInstance.RunPsTest("Test-CertificateCrudOperations");
}

[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCancelCertificateDelete()
{
BatchController controller = BatchController.NewInstance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ function Test-CertificateCrudOperations
$thumbprintAlgorithm = "sha1"

$localDir = ($pwd).Path # Use $pwd to get the local directory. If $pwd is not used, paths are relative to [Environment]::CurrentDirectory, which can be different
$certPath = $localDir + "\Resources\BatchTestCert01.cer"
$x509cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList $certPath

$certPathVs = $localDir + "/Resources/BatchTestCert01.cer"
# $certPathConsole = [System.IO.Path]::GetDirectoryName($PSScriptRoot) + "/Resources/BatchTestCert01.cer"
# $certPath = if (Test-Path $certPathVs -PathType Leaf) { $certPathVs } Else { $certPathConsole }
$x509cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList $certPathVs

# Add the cert
$x509cert | New-AzureBatchCertificate -BatchContext $context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ function Start-TestSleep($milliseconds)
}
}

function Compute-TestTimeout($seconds)
{
if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -eq [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback)
{
# Timeout of 3 hours, to deal with long delays in recording framework
return 60 * 24 * 3
}
else
{
return $seconds
}
}

<#
.SYNOPSIS
Gets a Batch account name for testing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public ComputeNodeTests(Xunit.Abstractions.ITestOutputHelper output)
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
}

[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestRemoveComputeNodes()
{
BatchController controller = BatchController.NewInstance;
Expand All @@ -51,8 +51,8 @@ public void TestRemoveComputeNodes()
TestUtilities.GetCurrentMethodName());
}

[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestRebootAndReimageComputeNode()
{
BatchController controller = BatchController.NewInstance;
Expand All @@ -74,8 +74,8 @@ public void TestRebootAndReimageComputeNode()
TestUtilities.GetCurrentMethodName());
}

[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestDisableAndEnableComputeNodeScheduling()
{
BatchController controller = BatchController.NewInstance;
Expand All @@ -94,8 +94,8 @@ public void TestDisableAndEnableComputeNodeScheduling()
TestUtilities.GetCurrentMethodName());
}

[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetComputeNodeRemoteLoginSettings()
{
BatchController controller = BatchController.NewInstance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ function Test-RemoveComputeNodes
$select = "id,state"
$computeNodes = Get-AzureBatchComputeNode -PoolId $poolId -Select $select -BatchContext $context
$start = [DateTime]::Now
$end = $start.AddSeconds(30)
$timeout = Compute-TestTimeout 30
$end = $start.AddSeconds($timeout)
while ($computeNodes[0].State -ne 'LeavingPool' -and $computeNodes[1].State -ne 'LeavingPool')
{
if ([DateTime]::Now -gt $end)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public ComputeNodeUserTests(Xunit.Abstractions.ITestOutputHelper output)
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
}

[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestComputeNodeUserEndToEnd()
{
BatchController controller = BatchController.NewInstance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public FileTests(Xunit.Abstractions.ITestOutputHelper output)
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
}

[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetNodeFileContentByTask()
{
BatchController controller = BatchController.NewInstance;
Expand All @@ -57,8 +57,8 @@ public void TestGetNodeFileContentByTask()
TestUtilities.GetCurrentMethodName());
}

[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetNodeFileContentByComputeNode()
{
BatchController controller = BatchController.NewInstance;
Expand All @@ -76,8 +76,8 @@ public void TestGetNodeFileContentByComputeNode()
TestUtilities.GetCurrentMethodName());
}

[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetRemoteDesktopProtocolFile()
{
BatchController controller = BatchController.NewInstance;
Expand All @@ -95,8 +95,8 @@ public void TestGetRemoteDesktopProtocolFile()
TestUtilities.GetCurrentMethodName());
}

[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestDeleteNodeFileByTask()
{
BatchController controller = BatchController.NewInstance;
Expand All @@ -122,8 +122,8 @@ public void TestDeleteNodeFileByTask()
TestUtilities.GetCurrentMethodName());
}

[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestDeleteNodeFileByComputeNode()
{
BatchController controller = BatchController.NewInstance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ public JobScheduleTests(Xunit.Abstractions.ITestOutputHelper output)
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
}

[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestJobScheduleCRUD()
{
BatchController.NewInstance.RunPsTest("Test-JobScheduleCRUD");
}


[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestDisableEnableTerminateJobSchedule()
{
BatchController controller = BatchController.NewInstance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ public JobTests(Xunit.Abstractions.ITestOutputHelper output)
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
}

[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestJobCRUD()
{
BatchController.NewInstance.RunPsTest("Test-JobCRUD");
}


[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestDisableEnableTerminateJob()
{
BatchController controller = BatchController.NewInstance;
Expand All @@ -58,8 +58,8 @@ public void TestDisableEnableTerminateJob()
TestUtilities.GetCurrentMethodName());
}

[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void IfJobSetsAutoFailure_ItCompletesWhenAnyTaskFails()
{
BatchController controller = BatchController.NewInstance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ public PoolTests(Xunit.Abstractions.ITestOutputHelper output)
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
}

[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestPoolCRUD()
{
BatchController.NewInstance.RunPsTest("Test-PoolCRUD");
}

[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestResizeAndStopResizePool()
{
BatchController controller = BatchController.NewInstance;
Expand All @@ -59,8 +59,8 @@ public void TestResizeAndStopResizePool()
TestUtilities.GetCurrentMethodName());
}

[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAutoScaleActions()
{
BatchController controller = BatchController.NewInstance;
Expand All @@ -81,8 +81,8 @@ public void TestAutoScaleActions()
TestUtilities.GetCurrentMethodName());
}

[Fact(Skip = "Need Batch team to re-record failing test. See the following issue: https://github.com/Azure/azure-powershell/issues/5006")]
[Trait(Category.AcceptanceType, Category.Flaky)]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestChangeOSVersion()
{
BatchController controller = BatchController.NewInstance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ public static string AddTestCertificate(BatchController controller, BatchAccount
{
PSCertificate existingCert = client.ListCertificates(getParameters).FirstOrDefault();
DateTime start = DateTime.Now;
DateTime end = start.AddMinutes(5);
TimeSpan timeout = GetTimeout(TimeSpan.FromMinutes(5));
DateTime end = start.Add(timeout);

// Cert might still be deleting from other tests, so we wait for the delete to finish.
while (existingCert != null && existingCert.State == CertificateState.Deleting)
Expand Down Expand Up @@ -153,7 +154,7 @@ public static void WaitForCertificateToFailDeletion(BatchController controller,

PSCertificate cert = client.ListCertificates(parameters).First();

DateTime timeout = DateTime.Now.AddMinutes(2);
DateTime timeout = DateTime.Now.Add(GetTimeout(TimeSpan.FromMinutes(2)));
while (cert.State != CertificateState.DeleteFailed)
{
if (DateTime.Now > timeout)
Expand Down Expand Up @@ -261,7 +262,7 @@ public static void WaitForSteadyPoolAllocation(BatchController controller, Batch
PoolId = poolId
};

DateTime timeout = DateTime.Now.AddMinutes(5);
DateTime timeout = DateTime.Now.Add(GetTimeout(TimeSpan.FromMinutes(5)));
PSCloudPool pool = client.ListPools(options).First();
while (pool.AllocationState != AllocationState.Steady)
{
Expand Down Expand Up @@ -346,7 +347,7 @@ public static void CreateTestJob(BatchController controller, BatchAccountContext
/// </summary>
public static string WaitForRecentJob(BatchController controller, BatchAccountContext context, string jobScheduleId, string previousJob = null)
{
DateTime timeout = DateTime.Now.AddMinutes(2);
DateTime timeout = DateTime.Now.Add(GetTimeout(TimeSpan.FromMinutes(2)));
BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);

ListJobScheduleOptions options = new ListJobScheduleOptions(context)
Expand Down Expand Up @@ -507,7 +508,7 @@ public static void WaitForIdleComputeNode(BatchController controller, BatchAccou
Select = "id,state"
};

DateTime timeout = DateTime.Now.AddMinutes(5);
DateTime timeout = DateTime.Now.Add(GetTimeout(TimeSpan.FromMinutes(10)));
PSComputeNode computeNode = client.ListComputeNodes(options).First();
while (computeNode.State != ComputeNodeState.Idle)
{
Expand Down Expand Up @@ -601,5 +602,15 @@ private static void Sleep(int milliseconds)
Thread.Sleep(milliseconds);
}
}

private static TimeSpan GetTimeout(TimeSpan timeout)
{
if (HttpMockServer.Mode == HttpRecorderMode.Playback)
{
return TimeSpan.FromHours(3);
}

return timeout;
}
}
}
Loading