Skip to content

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

Merged
merged 11 commits into from
Mar 30, 2018
Merged

Conversation

vladimir-shcherbakov
Copy link
Contributor

@vladimir-shcherbakov vladimir-shcherbakov commented Mar 2, 2018

Description

Checklist

@maddieclayton
Copy link
Contributor

@vladimir-shcherbakov the test that failed is one of the flaky tests, so pulling from upstream should stop this from failing.

Copy link
Member

@markcowl markcowl left a 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
Copy link
Member

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

Copy link
Contributor Author

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;
Copy link
Member

Choose a reason for hiding this comment

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

Attrubutes -> Attributes

Copy link
Contributor Author

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]
Copy link
Member

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

Copy link
Contributor Author

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]
Copy link
Member

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(
Copy link
Member

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.

Copy link
Contributor Author

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>
Copy link
Member

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.

Copy link
Contributor Author

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>
Copy link
Member

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

Copy link
Contributor Author

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(
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

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

Copy link
Contributor Author

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);
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@markcowl
Copy link
Member

markcowl
markcowl previously approved these changes Mar 25, 2018
/// Gets or sets subscription State
/// </summary>
/// <inheritdoc />
[Ps1Xml]
Copy link
Member

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

@markcowl
Copy link
Member

@markcowl markcowl removed their assignment Mar 25, 2018
@vladimir-shcherbakov
Copy link
Contributor Author

@vladimir-shcherbakov
Copy link
Contributor Author

@markcowl markcowl merged commit ef88f7b into Azure:preview Mar 30, 2018
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