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

Conversation

matthchr
Copy link
Member

@matthchr matthchr commented Jun 6, 2018

  • Also label tests as "CheckIn" category.

Description

See title

Checklist

@matthchr matthchr mentioned this pull request Jun 6, 2018
8 tasks
@matthchr
Copy link
Member Author

matthchr commented Jun 6, 2018

This PR supplants PR #6249

@@ -507,7 +507,7 @@ public static void WaitForIdleComputeNode(BatchController controller, BatchAccou
Select = "id,state"
};

DateTime timeout = DateTime.Now.AddMinutes(5);
DateTime timeout = DateTime.Now.AddMinutes(10);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change this to 3 hours?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to see where the tests failed in CI, and then fix up all those places, as I am not sure this is the only place we wait.

I will amend the PR to wait a longer time once I've seen the initial results though, yes.

@matthchr
Copy link
Member Author

matthchr commented Jun 6, 2018

This fixes issue: #5006

@matthchr
Copy link
Member Author

matthchr commented Jun 6, 2018

It looks like the test pass in Travis failed because of this error:

[xUnit.net 00:00:20.4340168]     Microsoft.Azure.Commands.Batch.Test.ScenarioTests.CertificateTests.TestCertificateCrudOperations [FAIL]
Failed   Microsoft.Azure.Commands.Batch.Test.ScenarioTests.CertificateTests.TestCertificateCrudOperations
Error Message:
 System.Management.Automation.CmdletInvocationException : Exception calling ".ctor" with "1" argument(s): "error:2006D080:BIO routines:BIO_new_file:no such file"
---- System.Management.Automation.MethodInvocationException : Exception calling ".ctor" with "1" argument(s): "error:2006D080:BIO routines:BIO_new_file:no such file"
-------- Interop+Crypto+OpenSslCryptographicException : error:2006D080:BIO routines:BIO_new_file:no such file
Stack Trace:
   at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
   at System.Management.Automation.Runspaces.Pipeline.Invoke()
   at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
   at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
   at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.CoreInvoke[TOutput](IEnumerable input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.Invoke()
   at Microsoft.WindowsAzure.Commands.ScenarioTest.EnvironmentSetupHelper.RunPowerShellTest(String[] scripts) in /home/travis/build/Azure/azure-powershell/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/EnvironmentSetupHelper.cs:line 638
   at Microsoft.Azure.Commands.Batch.Test.ScenarioTests.BatchController.RunPsTestWorkflow(Func`1 scriptBuilder, Action initialize, Action cleanup, String callingClassType, String mockName) in /home/travis/build/Azure/azure-powershell/src/ResourceManager/AzureBatch/Commands.Batch.Test/ScenarioTests/BatchController.cs:line 112
   at Microsoft.Azure.Commands.Batch.Test.ScenarioTests.BatchController.RunPsTest(String[] scripts) in /home/travis/build/Azure/azure-powershell/src/ResourceManager/AzureBatch/Commands.Batch.Test/ScenarioTests/BatchController.cs:line 55
   at Microsoft.Azure.Commands.Batch.Test.ScenarioTests.CertificateTests.TestCertificateCrudOperations() in /home/travis/build/Azure/azure-powershell/src/ResourceManager/AzureBatch/Commands.Batch.Test/ScenarioTests/CertificateTests.cs:line 34
----- Inner Stack Trace -----
   at System.Management.Automation.DotNetAdapter.AuxiliaryConstructorInvoke(MethodInformation methodInformation, Object[] arguments, Object[] originalArguments)
   at System.Management.Automation.DotNetAdapter.InvokeResolvedConstructor(MethodInformation bestMethod, Object[] newArguments, Object[] arguments)
   at System.Management.Automation.DotNetAdapter.ConstructorInvokeDotNet(Type type, ConstructorInfo[] constructors, Object[] arguments)
   at Microsoft.PowerShell.Commands.NewObjectCommand.CallConstructor(Type type, ConstructorInfo[] constructors, Object[] args)
----- Inner Stack Trace -----
   at Interop.Crypto.CheckValidOpenSslHandle(SafeHandle handle)
   at Internal.Cryptography.Pal.CertificatePal.FromFile(String fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)
   at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags)
   at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName)

I think it's complaining because we have a file Resources\BatchTestCert01.cer that it is trying to use but can't find?

I see this issue: https://github.com/dotnet/corefx/issues/11042 suggests the same as above (file not found).

But this same test passes in Jenkins. Do we explicitly exclude .cer files from the travis run somehow?

@matthchr matthchr force-pushed the matthchr/fix-tests branch from c8b65d3 to d265472 Compare June 6, 2018 23:06
@maddieclayton
Copy link
Contributor

@MiYanni Can you take a look at this?

@MiYanni
Copy link
Contributor

MiYanni commented Jun 7, 2018

@matthchr I just had the same issue for another service's tests. The fix here: 4ab7861

Basically, the path resolution seems to vary depending on if you are running the test via the console runner or the Visual Studio runner. Just do the logic I did in green where you have both potential paths and check to see if one exists; otherwise, use the other path.

@matthchr matthchr force-pushed the matthchr/fix-tests branch from d265472 to e404dd2 Compare June 7, 2018 19:43
maddieclayton
maddieclayton previously approved these changes Jun 7, 2018
Copy link
Contributor

@maddieclayton maddieclayton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me! If it passes all tests I will merge.

@maddieclayton
Copy link
Contributor

on demand (to ensure all batch tests are successfully moved): https://azuresdkci.westus2.cloudapp.azure.com/view/PowerShell/job/powershell-demand/920/

@maddieclayton
Copy link
Contributor

@matthchr @MiYanni Looks like the test is still failing in travis.

@matthchr
Copy link
Member Author

matthchr commented Jun 7, 2018

@MiYanni - Can you give specific guidance on how to do your fix in a Powershell context rather than a C# one?

I tried:

    $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 $certPath

But that doesn't seem to work.

I assume the issue is the certPathConsole path... what is the directory structure in Travis?

@MiYanni
Copy link
Contributor

MiYanni commented Jun 7, 2018

@matthchr Oh. Your issue isn't that the directory is wrong. Just put:

$x509cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList './Resources/BatchTestCert01.cer'

You can't use backslashes in Linux.

I've had to change every filepath in code to use forward slashes instead. Or use Path.Combine in C# or Join-Path in PowerShell.

@matthchr
Copy link
Member Author

matthchr commented Jun 7, 2018

Hah! Good catch. Will fix.

  - Label tests as "CheckIn" category.
  - Have a large timeout when in replay mode to deal with possibility of
    thread starvation in massively parallel run.
@matthchr
Copy link
Member Author

matthchr commented Jun 8, 2018

There we go, Travis passes now. Feel free to call another on-demand build to make sure things are looking okay.

@maddieclayton
Copy link
Contributor

On demand will be fine as I confirmed all batch tests were moved. Merging now! I'll close the flaky test issue now, but let you know if it ever shows back up.

Thanks Matt! We really appreciate your work fixing these tests.

@maddieclayton maddieclayton merged commit 4c2d8a9 into Azure:preview Jun 8, 2018
@matthchr matthchr deleted the matthchr/fix-tests branch September 18, 2018 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants