Skip to content
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

Analysis tests #37065

Merged
merged 6 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ namespace Azure.ResourceManager.Analysis.Tests
public class AnaltsisManagementTestBase : ManagementRecordedTestBase<AnaltsisManagementTestEnvironment>
mcgallan marked this conversation as resolved.
Show resolved Hide resolved
{
protected ArmClient Client { get; private set; }
protected AzureLocation DefaultLocation => TestEnvironment.Location;
protected SubscriptionResource DefaultSubscription { get; private set; }

protected AnaltsisManagementTestBase(bool isAsync, RecordedTestMode mode)
: base(isAsync, mode)
Expand All @@ -25,17 +27,26 @@ protected AnaltsisManagementTestBase(bool isAsync)
}

[SetUp]
public void CreateCommonClient()
public async Task CreateCommonClient()
{
Client = GetArmClient();
DefaultSubscription = await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false);
}

protected async Task<ResourceGroupResource> CreateResourceGroup(SubscriptionResource subscription, string rgNamePrefix, AzureLocation location)
protected async Task<ResourceGroupResource> CreateResourceGroupAsync()
{
string rgName = Recording.GenerateAssetName(rgNamePrefix);
ResourceGroupData input = new ResourceGroupData(location);
var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, input);
return lro.Value;
var resourceGroupName = Recording.GenerateAssetName("testRG-");
var rgOp = await DefaultSubscription.GetResourceGroups().CreateOrUpdateAsync(
WaitUntil.Completed,
resourceGroupName,
new ResourceGroupData(DefaultLocation)
{
Tags =
{
{ "test", "env" }
}
});
return rgOp.Value;
}
}
}
Loading