Skip to content

Test controller as nuget package #7314

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
Dec 17, 2018

Conversation

vladimir-shcherbakov
Copy link
Contributor

@vladimir-shcherbakov vladimir-shcherbakov commented Sep 20, 2018

Description

Change TestController implementation.
Issue #6180

Checklist

<package id="Microsoft.WindowsAzure.Management" version="4.1.1" targetFramework="net45" />
<package id="Moq" version="4.2.1510.2205" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure these packages.config changes actually affect anything. These packages should be loaded from restoring Profile.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -3,4 +3,5 @@
<package id="Microsoft.Azure.Management.Authorization" version="2.8.0-preview" targetFramework="net452" />
<package id="Microsoft.Azure.Management.ManagementGroups" version="1.1.0-preview" targetFramework="net452" />
<package id="Microsoft.Azure.Management.ResourceManager" version="1.9.0-preview" targetFramework="net452" />
<package id="Microsoft.Azure.PowerShell.TestFx" version="1.0.137-preview" targetFramework="net452" />
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be added to the Profile packages.config.

<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
<package id="Microsoft.Rest.ClientRuntime.Azure.Authentication" version="2.3.0" targetFramework="net452" />
<package id="Microsoft.Rest.ClientRuntime.Azure.TestFramework" version="1.7.2" targetFramework="net452" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here with packages.config changes should be in Profile.

@@ -2,6 +2,7 @@
<packages>
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net452" />
<package id="Microsoft.Azure.Management.Storage" version="8.1.0-preview" targetFramework="net452" />
<package id="Microsoft.Azure.PowerShell.TestFx" version="1.0.137-preview" targetFramework="net452" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here with packages.config changes should be in Profile.

@@ -88,7 +87,8 @@ public void TestGetADGroupWithSearchString()
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetADGroupWithBadSearchString()
{
ResourcesController.NewInstance.RunPsTest(interceptor, "Test-GetADGroupWithBadSearchString");
//ResourcesController.NewInstance.RunPsTest("Test-GetADGroupWithBadSearchString");
Copy link
Contributor

Choose a reason for hiding this comment

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

Commented code.

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.

See changes to common code first. Also, what are the changes to the developer guide on adding a new test project that will come with this change?

@@ -64,6 +64,10 @@
<HintPath>$(LibraryNugetPackageFolder)\Microsoft.Rest.ClientRuntime.Azure.TestFramework.1.7.2\lib\net452\Microsoft.Rest.ClientRuntime.Azure.TestFramework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.PowerShell.TestFx, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>$(LibraryNugetPackageFolder)\Microsoft.Azure.PowerShell.TestFx.1.0.137-preview\lib\net452\Microsoft.Azure.PowerShell.TestFx.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.

Can we make this one of the published packages from the common repo?

@vladimir-shcherbakov
Copy link
Contributor Author

I'll update the guide as soon as the review has signed off to be sure there won't be any changes.

Copy link
Contributor

@MiYanni MiYanni left a comment

Choose a reason for hiding this comment

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

Can you remove the TestController.cs from each of the test projects you've updated? You'd have to delete them and remove the entry in the .Test.csproj for Profile/Resources/Storage.

@vladimir-shcherbakov
Copy link
Contributor Author

vladimir-shcherbakov commented Oct 30, 2018

I removed ProfileController as redundant, but 2 others are still in use: ResourcesController uses library calls to setup and cleanup an environment like this:

ADGroup newGroup = null;
var controllerAdmin = ResourcesController.NewInstance;

controllerAdmin.RunPsTestWorkflow(
	interceptor,
	// scriptBuilder
	() =>
	{
		newGroup = CreateNewAdGroup(controllerAdmin);
		return new[] { scriptMethod };
	},
	// cleanup
	() =>
	{
		DeleteAdGroup(controllerAdmin, newGroup);
	},
	MethodBase.GetCurrentMethod().ReflectedType?.ToString(),
	MethodBase.GetCurrentMethod().Name);
}

but this functionality is not supported in the new controller because the setup and cleanup should be performed as part of the test script.

and Storage TestController is still in use for blob containers tests because to get the new one work the tests need to be re-recorded but they use some experimental environment I don't have access to:
Get-ProviderLocation_Stage function returns the "eastus2(stage)" string as a location. And the location is used to create a storage account, like this:

$loc = Get-ProviderLocation_Stage;
New-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -Type $stotype -Kind $kind

MiYanni
MiYanni previously approved these changes Oct 30, 2018
Copy link
Contributor

@MiYanni MiYanni left a comment

Choose a reason for hiding this comment

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

LGTM

@markcowl
Copy link
Member

@vladimir-shcherbakov Can you update this PR for the new released common libraries, pull the latest and fix merge conflicts, and clean up the commits?

@cormacpayne cormacpayne changed the base branch from preview to master November 30, 2018 22:29
@cormacpayne
Copy link
Member

@vladimir-shcherbakov re-targeted the PR at the new default branch, master, so you will need to pull from that branch to resolve the merge conflicts rather than preview

@cormacpayne
Copy link
Member

@vladimir-shcherbakov ping on the above comments

})
.WithExtraRmModules(helper => new[]
{
#if !NETSTANDARD
Copy link
Member

Choose a reason for hiding this comment

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

We can remove this IFDEF, now

@markcowl markcowl merged commit 893de03 into Azure:master Dec 17, 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.

6 participants