Skip to content

Fix error in Test-AzureRmVMAEMExtension and improve error message #3102

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 6 commits into from
Nov 18, 2016
Merged

Fix error in Test-AzureRmVMAEMExtension and improve error message #3102

merged 6 commits into from
Nov 18, 2016

Conversation

MSSedusch
Copy link
Member

@MSSedusch MSSedusch commented Oct 20, 2016

Description

  • fix error in Test-AzureRmVMAEMExtension: Primary and secondary location URIs in a StorageUri must point to the same resource
  • Improve error message when VM does not have a disk that resides standard storage account

This checklist is used to make sure that common guidelines for a pull request are followed. You can find a more complete discussion of PowerShell cmdlet best practices here.

General Guidelines

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.
  • The pull request does not introduce breaking changes (unless a major version change occurs in the assembly and module).

Testing Guidelines

  • Pull request includes test coverage for the included changes.
  • PowerShell scripts used in tests should do any necessary setup as part of the test or suite setup, and should not use hard-coded values for locations or existing resources.

Cmdlet Signature Guidelines

  • New cmdlets that make changes or have side effects should implement ShouldProcess and have SupportShouldProcess=true specified in the cmdlet attribute. You can find more information on ShouldProcess here.
  • Cmdlet specifies OutputType attribute if any output is produced - if the cmdlet produces no output, it should implement a PassThrough parameter.

Cmdlet Parameter Guidelines

  • Parameter types should not expose types from the management library - complex parameter types should be defined in the module.
  • Complex parameter types are discouraged - a parameter type should be simple types as often as possible. If complex types are used, they should be shallow and easily creatable from a constructor or another cmdlet.
  • Cmdlet parameter sets should be mutually exclusive - each parameter set must have at least one mandatory parameter not in other parameter sets.
    … standard storage

@azurecla
Copy link

Hi @MSSedusch, I'm your friendly neighborhood Azure Pull Request Bot (You can call me AZPRBOT). Thanks for your contribution!


It looks like you're working at Microsoft (sedusch). If you're full-time, we DON'T require a contribution license agreement.



If you are a vendor, DO please sign the electronic contribution license agreement. It will take 2 minutes and there's no faxing! https://cla.azure.com.

TTYL, AZPRBOT;

@cormacpayne cormacpayne self-assigned this Oct 24, 2016
Copy link
Member

@cormacpayne cormacpayne left a comment

Choose a reason for hiding this comment

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

@MSSedusch Hey Sebastian, a couple comments. Do you plan on adding test coverage for these changes?

public SwitchParameter DisableWAD { get; set; }

[Parameter(
Mandatory = false,
Position = 2,
Copy link
Member

Choose a reason for hiding this comment

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

@MSSedusch switch parameters do not need to have a position. You can remove this from both EnableWAD and DisableWAD

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Position = 2,
ValueFromPipelineByPropertyName = false,
HelpMessage = "If this parameter is provided, the commandlet will enable Windows Azure Diagnostics for this virtual machine.")]
public SwitchParameter EnableWAD { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

@MSSedusch currently EnableWAD and DisableWAD can be called in the same command. Can you create two parameter sets, one that contains EnableWAD and one that contains DisableWAD, so that this scenario is not possible?

Copy link
Member Author

Choose a reason for hiding this comment

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

As far as I know, Parameter Sets need to contain at least one parameter specific to the set. How would I define parameter sets that only differ in those two switch parameters? Only using ResourceGroup and VMName must work. I also don't think this is a real issue. Using both switch parameters work

@cormacpayne
Copy link
Member

cormacpayne commented Oct 24, 2016

@MSSedusch oops, I accidently "approved" the changes rather than "requested" them for the review above. I will sign-off when the above comments are resolved.

@MSSedusch
Copy link
Member Author

Please update the developer documentation especially the part about adding and recording tests if you want people to write tests (e.g. SetupHttpRecordEnv.ps1 does not longer exist in tools directory).

@markcowl
Copy link
Member

@MSSedusch You need to have tests in order to meet the requirements for check-in. If you are willing to verify the functionality manually, you can file an issue to add automated tests in the next sprint. Reference this issue here, and we will be able to merge.

@MSSedusch
Copy link
Member Author

I added four additional tests to cover the new scenarios

@@ -24,24 +24,48 @@ public AEMExtensionTests(Xunit.Abstractions.ITestOutputHelper output)
}

[Fact]
Copy link
Member

Choose a reason for hiding this comment

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

@MSSedusch Is there a reason why these tests are not marked as check-in tests (Category.AcceptanceType, Category.CheckIn)?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, see #2084
The test runtime is too long, hovsepm asked me to remove the checkin attribute

@markcowl
Copy link
Member

on demand run here: http://azuresdkci.cloudapp.net/view/1-AzurePowerShell/job/powershell-demand/1299/

Note that the included tests are not running as part of check-in

@cormacpayne
Copy link
Member

@MSSedusch Hey Sebastian, would you mind taking a look at the comments that Mark left?

@MSSedusch
Copy link
Member Author

MSSedusch commented Nov 15, 2016

@cormacpayne
Copy link
Member

@markcowl do these changes look good to you?

@markcowl markcowl merged commit 38ab463 into Azure:dev Nov 18, 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