Skip to content

[Do not Mege] Updated Set-AzureRmVMChefExtension cmd #1676

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

Closed

Conversation

NimishaS
Copy link

  1. Using new classes like CreateOrUpdateWithHttpMessagesAsync
  2. Passing settings file as Hashtable
  3. Implements Get-AzureRmVMChefExtension
  4. Implements Remove-AzureRmVMChefExtension

Testing is in progress

@azurecla
Copy link

Hi @NimishaS, I'm your friendly neighborhood Azure Pull Request Bot (You can call me AZPRBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!
We will now validate the agreement and then real humans will evaluate your PR.

TTYL, AZPRBOT;

@hovsepm hovsepm changed the title Updated Set-AzureRmVMChefExtension cmd [Do not Mege] Updated Set-AzureRmVMChefExtension cmd Jan 19, 2016
@hovsepm
Copy link
Contributor

hovsepm commented Jan 19, 2016

@NimishaS Please remove [Do not Merge] from the title when your tests will be in the PR.

@NimishaS
Copy link
Author

@hovsepm , can you point me to a doc which explains how to run a specific test scenario. Eg. suppose I want to run only https://github.com/Azure/azure-powershell/blob/dev/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/DiagnosticsExtensionTests.ps1
This wiki https://github.com/Azure/azure-powershell/wiki/Microsoft-Azure-PowerShell-Developer-Guide#run-unit-tests explains how to run all unit test-cases.

@hovsepm
Copy link
Contributor

hovsepm commented Jan 26, 2016

@NimishaS to run any specific test you will need to first find a corresponding C# Unit test that executes that script and run it with Xunit framework (usually it is much easier to do in Visual Studio).
Here is the unit test that invokes Ps script you are asking about -

@NimishaS
Copy link
Author

@hovsepm , we are done adding the specs. We are able to run the tests in Playback mode but not in Recording mode. We tried setting AZURE_TEST_MODE to RECORD in env variables. But the tests still ran in Playback mode from Visual Studio.
Tried to use Microsoft Test Manager but we have to add Team Foundation Server here. We are not sure what value is supposed to be given here.
These steps are not helping us for recording https://github.com/Azure/azure-powershell/wiki/Microsoft-Azure-PowerShell-Developer-Guide#recordingrunning-tests
Note: I want to record tests for only Chef Extension related tests and want to avoid running other tests.
Please suggest.

@NimishaS
Copy link
Author

Also Travis is failing for this PR but we are unable to see the details.

@NimishaS
Copy link
Author

@hovsepm , we are finally able to run the tests in recording mode. But we are getting this error for each spec:

System.Exception : Logged in account had no associated subscriptions. We are in Prod environment
and the tenant is common. Please check if the subscription is in the correct tenant and environment.
You can set the envt. variable - TEST_CSM_ORGID_AUTHENTICATION=SubscriptionId=<subscription-id>;Environment=<Env-name>;Tenant=<tenant-id>

We have set the environment variables following https://github.com/Azure/azure-powershell/wiki/Microsoft-Azure-PowerShell-Developer-Guide#ad-scenario-tests.
There is a possibility that the values provided here are not correct. We are not able to understand if the values provided for UserId in the four variables are same or different.

@NimishaS
Copy link
Author

@hovsepm , any suggestions here?

@NimishaS NimishaS force-pushed the nim/Update_Set-AzureRmVMChefExtension branch from 7bd4854 to 7ba829b Compare January 29, 2016 11:52
@NimishaS
Copy link
Author

NimishaS commented Feb 4, 2016

@hovsepm we are waiting for your response to record test responses. Please refer my comment #1676 (comment). That's the problem we are currently stuck on.

Rest everything is complete for this PR.

@hovsepm
Copy link
Contributor

hovsepm commented Feb 9, 2016

@NimishaS the issue is that you did not include recorded mock recordings to the PR.

Microsoft.Azure.Commands.Compute.Test.ScenarioTests.ChefExtensionTests.TestChefExtensionBasic
System.ArgumentException : Unable to find recorded mock directory 'SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.ChefExtensionTests'.
Parameter name: callerIdentity
   at Microsoft.Azure.Test.HttpRecorder.HttpMockServer.Initialize(String callerIdentity, String testIdentity, HttpRecorderMode mode)
   at Microsoft.Rest.ClientRuntime.Azure.TestFramework.MockContext.Start(String className, String methodName)
   at Microsoft.Azure.Commands.Compute.Test.ScenarioTests.ComputeTestController.RunPsTestWorkflow(Func`1 scriptBuilder, Action`1 initialize, Action cleanup, String callingClassType, String mockName) in d:\workspace\powershell\src\ResourceManager\Compute\Commands.Compute.Test\Common\ComputeTestController.cs:line 105
   at Microsoft.Azure.Commands.Compute.Test.ScenarioTests.ComputeTestController.RunPsTest(String[] scripts) in d:\workspace\powershell\src\ResourceManager\Compute\Commands.Compute.Test\Common\ComputeTestController.cs:line 84
   at Microsoft.Azure.Commands.Compute.Test.ScenarioTests.ChefExtensionTests.TestChefExtensionBasic() in d:\workspace\powershell\src\ResourceManager\Compute\Commands.Compute.Test\ScenarioTests\ChefExtensionTests.cs:line 12
Traits:

@hovsepm
Copy link
Contributor

hovsepm commented Feb 9, 2016

@NimishaS please see SessionRecords folder for an example. You will need to add your session record json file there in the correct folder, and add that file to Commands.Compute.Test.csproj. Make sure CopyToOutputDirectory setting will me set to "Always" in the csproj.

$vmname = $vm.Name
$version = "1210.12"
$client_rb = ".\Templates\client.rb";
$validationPemFile = ".\Templates\tstorgnztn-validator.pem";
Copy link
Contributor

Choose a reason for hiding this comment

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

please align the white-spaces in this file.

@NimishaS
Copy link
Author

@hovsepm , issue is that we aren't able to record specs. When we run the tests in recording mode, we get this error:

System.Exception : Logged in account had no associated subscriptions. We are in Prod environment 
and the tenant is common. Please check if the subscription is in the correct tenant and environment. 
You can set the envt. variable - 
TEST_CSM_ORGID_AUTHENTICATION=SubscriptionId=<subscription-id>;Environment=<Env-name>;Tenant=<tenant-id>

We get this error for all specs. We have tried setting the environment variables mentioned here https://github.com/Azure/azure-powershell/wiki/Microsoft-Azure-PowerShell-Developer-Guide#ad-scenario-tests

@markcowl
Copy link
Member

@NimishaS You should set TEST_CSM_ORGID_AUTHENTICATION, as specified in the error message - if you specify SubscriptionId and Environment, you will be prompted for credentials during the test.

@NimishaS
Copy link
Author

NimishaS commented Mar 7, 2016

@markcowl, TEST_CSM_ORGID_AUTHENTICATION is set. Still we are getting the same error.

@markcowl
Copy link
Member

markcowl commented May 2, 2016

@NimishaS What help do you need to get these changes in? We will have to close this pull request soon, as it is quite out of date.

@markcowl
Copy link
Member

markcowl commented May 9, 2016

@NimishaS closing this PR, as there has been no activity in 2 months. Open a new PR if you weant us to consider changes.

@markcowl markcowl closed this May 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants