-
Notifications
You must be signed in to change notification settings - Fork 4k
Tool to generate format.ps1xml #5666
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
Conversation
@vladimir-shcherbakov the test that failed is one of the flaky tests, so pulling from upstream should stop this from failing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comm ents. This looks great. I have kicked off a signed build so I can try it out as well.
@@ -0,0 +1,33 @@ | |||
// Copyright Microsoft Corporation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please correct the folder name to 'Attributes' - not sure if this already existed, but we should fix regardless
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
@@ -17,6 +17,7 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Management.Automation; | |||
using Microsoft.WindowsAzure.Commands.Common.Attrubutes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Attrubutes -> Attributes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
if (_domain != null) AppDomain.Unload(_domain); | ||
} | ||
|
||
[Fact] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
[Trait(Category.AcceptanceType, Category.CheckIn)]
for each of these tests, this will make them run in the check-in build. Also, please add this path and assembly to the test mappings file:https://github.com/Azure/azure-powershell/blob/preview/TestMappings.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markcowl
The project that owns the Category class with the constants (AcceptanceType, CheckIn) is dependent on many others. Is it a good idea just to copy paste the requires constants instead of adding all the dependencies?
private const string CmdletName = "New-FormatPs1Xml"; | ||
private const string ExpectedAssemblyName = "RepoTasks.CmdletsForTest"; | ||
|
||
[Fact] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add Trait attribute as above
{ | ||
var initialSessionState = InitialSessionState.CreateDefault(); | ||
|
||
initialSessionState.Commands.Add( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a little worried about polluting the environment and leaving commands arround. We have an IDataStore interface here, with implementations for MockDataStore (for testing) and DiskDataStore (for runtime). If you provide this at runtime (say through a static property, or the like) , then your tests could test this functionality without leaving files behind. Let me know if this is too time-consuming to take up right now, as we could simply take this as test debt and schedule it later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markcowl
What if I just delete all the test artifacts, for example, in a final block?
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\System.Management.Automation.6.1.7601.17515\lib\net45\System.Management.Automation.dll</HintPath> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't need a HintPath for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\System.Management.Automation.6.1.7601.17515\lib\net45\System.Management.Automation.dll</HintPath> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not need the hintpath
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
|
||
foreach (var cmdletType in cmdletTypList) | ||
{ | ||
var attributes = cmdletType.GetCustomAttributes( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might find these extensions useful: https://github.com/Azure/azure-powershell/blob/preview/tools/StaticAnalysis/HelpAnalyzer/ReflectionExtensions.cs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not any required change, just FYI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok.
{ | ||
if (!Path.IsPathRooted(ModulePath)) | ||
{ | ||
ModulePath = Path.GetFullPath(ModulePath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To resolve the path in powershell, you should use the SessionState.Path property to get a path from the given provider, see: https://github.com/Azure/azure-powershell/blob/preview/src/ResourceManager/Websites/Commands.Websites/Strategies/GitCommand.cs#L45-L46 for an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
/// Gets or sets subscription State | ||
/// </summary> | ||
/// <inheritdoc /> | ||
[Ps1Xml] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we only want this one to go in the table view
Description
Checklist
CONTRIBUTING.md
platyPS
module