Skip to content

Commit

Permalink
Update Track 2 Mgmt Plane Template (#21876)
Browse files Browse the repository at this point in the history
* Update Track 2 Mgmt Plane Template

* Moving the package ref into the actual project file

* Fixing Management tests and updating sln to include missed project

* Update build for core.test and invert the mgmt shared test code include.

* Fix CI
  • Loading branch information
allenjzhang authored Jun 16, 2021
1 parent 75b312b commit c6665ba
Show file tree
Hide file tree
Showing 21 changed files with 44 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,7 @@ protected ManagementRecordedTestBase(bool isAsync, RecordedTestMode mode) : base

protected ValueTask<Response<T>> WaitForCompletionAsync<T>(Operation<T> operation)
{
if (Mode == RecordedTestMode.Playback)
{
return operation.WaitForCompletionAsync(ZeroPollingInterval, default);
}
else
{
return operation.WaitForCompletionAsync();
}
return operation.WaitForCompletionAsync();
}

protected ResourcesManagementClient GetResourceManagementClient()
Expand Down
4 changes: 2 additions & 2 deletions eng/Azure.Management.Test.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<RbacSharedSources>$(MSBuildThisFileDirectory)/../sdk/testcommon/Azure.Graph.Rbac/src</RbacSharedSources>
</PropertyGroup>

<ItemGroup Condition="'$(TestHelperProjects)' != '' and '$(UseNewMgmtFramework)' != 'true'">
<ItemGroup Condition="'$(UseNewMgmtFramework)' == 'false'">
<Compile Include="$(ManagementTestSharedSources)/Current/**/*.cs"
Link="TestShared/%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>

<ItemGroup Condition="'$(TestHelperProjects)' != '' and '$(UseNewMgmtFramework)' == 'true'">
<ItemGroup Condition="'$(UseNewMgmtFramework)' == '' or '$(UseNewMgmtFramework)' == 'true'">
<Compile Include="$(ManagementTestSharedSources)/Redesign/**/*.cs"
Link="TestShared/%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
Expand Down
5 changes: 5 additions & 0 deletions eng/Packages.Data.props
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@
<PackageReference Update="Newtonsoft.Json" Version="10.0.3" />
</ItemGroup>

<!-- Packages intended for Management libraries only -->
<ItemGroup Condition="'$(IsMgmtLibrary)' == 'true'">
<PackageReference Update="Azure.ResourceManager.Core" Version="1.0.0-alpha.20210526.3" />
</ItemGroup>

<!-- Packages intended for Extensions libraries only -->
<ItemGroup Condition="'$(IsExtensionClientLibrary)' == 'true'">
<PackageReference Update="Microsoft.AspNetCore.DataProtection" Version="2.1.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@
<Description>Azure Resource Manager client SDK for Azure resource provider ProviderFullName</Description>
<PackageTags>azure;management;arm;resource manager;ProviderNameLowercase</PackageTags>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.ResourceManager.Core"/>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TestHelperProjects>;</TestHelperProjects>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(AzureCoreTestFramework)" />
<PackageReference Include="Azure.ResourceManager.Core"/>
<ProjectReference Include="..\src\Azure.ResourceManager.Template.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Azure.ResourceManager.Resources"/>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TestHelperProjects>;</TestHelperProjects>
<UseNewMgmtFramework>false</UseNewMgmtFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\src\Azure.ResourceManager.AppConfiguration.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TestHelperProjects>;</TestHelperProjects>
<UseNewMgmtFramework>false</UseNewMgmtFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(AzureCoreTestFramework)" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TestHelperProjects>;</TestHelperProjects>
<UseNewMgmtFramework>false</UseNewMgmtFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\src\Azure.ResourceManager.Compute.csproj" />
Expand Down
6 changes: 6 additions & 0 deletions sdk/core/Azure.Core/Azure.Core.sln
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Test.Perf", "..\..\..
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Core", "..\..\resourcemanager\Azure.ResourceManager.Core\src\Azure.ResourceManager.Core.csproj", "{8E60A748-3973-471A-B103-EC9406BB3313}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.AI.TextAnalytics", "..\..\textanalytics\Azure.AI.TextAnalytics\src\Azure.AI.TextAnalytics.csproj", "{B1FFA603-1CAA-4CE0-97E9-CA6CE9D498B9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -93,6 +95,10 @@ Global
{8E60A748-3973-471A-B103-EC9406BB3313}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E60A748-3973-471A-B103-EC9406BB3313}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E60A748-3973-471A-B103-EC9406BB3313}.Release|Any CPU.Build.0 = Release|Any CPU
{B1FFA603-1CAA-4CE0-97E9-CA6CE9D498B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B1FFA603-1CAA-4CE0-97E9-CA6CE9D498B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1FFA603-1CAA-4CE0-97E9-CA6CE9D498B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B1FFA603-1CAA-4CE0-97E9-CA6CE9D498B9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
22 changes: 10 additions & 12 deletions sdk/core/Azure.Core/tests/TestClients/TestResourceContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,57 +17,55 @@ public class TestResourceContainer
[ForwardsClientCalls]
public virtual Pageable<TestResource> List(int pages = 1, CancellationToken cancellation = default)
{
FuncPageable<object> results = GetSyncResults(pages);
return new PhWrappingPageable<object, TestResource>(results, o => new TestResource());
return GetSyncResults(pages);
}

private FuncPageable<object> GetSyncResults(int pages)
private FuncPageable<TestResource> GetSyncResults(int pages)
{
Page<object> pageFunc(int? pageSizeHint)
Page<TestResource> pageFunc(int? pageSizeHint)
{
//simulates forwarding with todays wrapper. This should go away after codegen is finished
using var scope = _diagnostic.CreateScope("TestResourceContainer.GetSyncResults");
scope.Start();

try
{
return Page<object>.FromValues(new object[] { new object(), new object() }, null, null);
return Page<TestResource>.FromValues(new TestResource[] { new TestResource(), new TestResource() }, null, null);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return new FuncPageable<object>((cToken, pageSize) => pageFunc(pageSize));
return new FuncPageable<TestResource>((cToken, pageSize) => pageFunc(pageSize));
}

[ForwardsClientCalls]
public virtual AsyncPageable<TestResource> ListAsync(int pages = 1, CancellationToken cancellation = default)
{
FuncAsyncPageable<object> results = GetAsyncResults(pages);
return new PhWrappingAsyncPageable<object, TestResource>(results, o => new TestResource());
return GetAsyncResults(pages);
}

private FuncAsyncPageable<object> GetAsyncResults(int pages)
private FuncAsyncPageable<TestResource> GetAsyncResults(int pages)
{
async Task<Page<object>> pageFunc(int? pageSizeHint)
async Task<Page<TestResource>> pageFunc(int? pageSizeHint)
{
using var scope = _diagnostic.CreateScope("TestResourceContainer.GetAsyncResults");
scope.Start();

try
{
await Task.Delay(10);
return Page<object>.FromValues(new object[] { new object(), new object() }, null, null);
return Page<TestResource>.FromValues(new TestResource[] { new TestResource(), new TestResource() }, null, null);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return new FuncAsyncPageable<object>((cToken, pageSize) => pageFunc(pageSize));
return new FuncAsyncPageable<TestResource>((cToken, pageSize) => pageFunc(pageSize));
}

public virtual string Method()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TestHelperProjects>;</TestHelperProjects>
<UseNewMgmtFramework>false</UseNewMgmtFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(AzureCoreTestFramework)" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<TestHelperProjects>;</TestHelperProjects>
<UseNewMgmtFramework>false</UseNewMgmtFramework>
<NoWarn>$(NoWarn);SA1649</NoWarn>
<FileUpgradeFlags>
</FileUpgradeFlags>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TestHelperProjects>;</TestHelperProjects>
<UseNewMgmtFramework>false</UseNewMgmtFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(AzureCoreTestFramework)" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TestHelperProjects>;</TestHelperProjects>
<UseNewMgmtFramework>false</UseNewMgmtFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(AzureCoreTestFramework)" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TestHelperProjects>Rbac1.6;</TestHelperProjects>
<UseNewMgmtFramework>false</UseNewMgmtFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\src\Azure.ResourceManager.KeyVault.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
<UseNewMgmtFramework>false</UseNewMgmtFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="$(AzureCoreTestFramework)" />
<PackageReference Include="Azure.ResourceManager.Resources"/>
<ProjectReference Include="..\src\Azure.ResourceManager.MachineLearningServices.csproj" />
<PackageReference Include="Microsoft.Azure.AutoRest.CSharp" VersionOverride="$(MgmtAutorestVersion)" PrivateAssets="All" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="Current">
<PropertyGroup>
<TestHelperProjects>;</TestHelperProjects>
<PropertyGroup>
<UseNewMgmtFramework>false</UseNewMgmtFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\src\Azure.ResourceManager.Network.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

<PropertyGroup>
<DefineConstants>$(DefineConstants);RESOURCES_RP</DefineConstants>
<TestHelperProjects>;</TestHelperProjects>
<UseNewMgmtFramework>true</UseNewMgmtFramework>
</PropertyGroup>
<PropertyGroup>
<NoWarn>SA1649;SA1633;SA1000;SA1028;SA1400;SA1508</NoWarn>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<DefineConstants>$(DefineConstants);RESOURCES_RP</DefineConstants>
<TestHelperProjects>;</TestHelperProjects>
<UseNewMgmtFramework>false</UseNewMgmtFramework>
</PropertyGroup>
<PropertyGroup>
<NoWarn>SA1649</NoWarn>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TestHelperProjects>;</TestHelperProjects>
<UseNewMgmtFramework>false</UseNewMgmtFramework>
</PropertyGroup>
<ItemGroup>
<Compile Remove="ServerCrudScenarioTests.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TestHelperProjects>;</TestHelperProjects>
<TemporaryUsePreviousGeneratorVersion>true</TemporaryUsePreviousGeneratorVersion>
<UseNewMgmtFramework>false</UseNewMgmtFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\src\Azure.ResourceManager.Storage.csproj" />
Expand All @@ -10,4 +9,4 @@
<PackageReference Include="Azure.ResourceManager.Resources" />
<PackageReference Include="Microsoft.Azure.AutoRest.CSharp" VersionOverride="$(MgmtAutorestVersion)" PrivateAssets="All" />
</ItemGroup>
</Project>
</Project>

0 comments on commit c6665ba

Please sign in to comment.