Skip to content

Commit

Permalink
Include KubernetesCluster Feature and Kubernetescluster agentpool tes…
Browse files Browse the repository at this point in the history
…ts recording

Include Cluster Manager tests recording
  • Loading branch information
Priya shet committed Sep 26, 2024
1 parent 3fd00b7 commit dd7ab5d
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "net",
"TagPrefix": "net/networkcloud/Azure.ResourceManager.NetworkCloud",
"Tag": "net/networkcloud/Azure.ResourceManager.NetworkCloud_9efbb40e1f"
"Tag": "net/networkcloud/Azure.ResourceManager.NetworkCloud_a281995009"
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ public async Task AgentPool()
AdminUsername = "azure",
SshPublicKeys =
{
new NetworkCloudSshPublicKey("ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= fake-public-key")
new NetworkCloudSshPublicKey("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDHvXnJdrBmW052RUfpkGLj30ndi6jf4+i161ECfrVcUglfKmAlU8cfDCW/s6Bfppz80GkFscZpOH8h0erfigggPpFq5/2XblFitooqQ0Hxm091/rswg4t/27N49l5fiom8sD3kki4zRkmpgenwHTcZgUpBpQjd4DUrJxZ5zYF1wLop9Qu3ptsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsnv4ixQyU00X5Dt1G/3nLUdrz9A3s3b7K1w+BdB5E9v9gdBVSF2+XwZI9ooaAxfuOb0f/jP3CYLJ43SXISTRnIDpcf5qytjs1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@test-vm")
},
},
AgentOptions = new NetworkCloudAgentConfiguration(12)
{
HugepagesSize = HugepagesSize.TwoM,
HugepagesCount = 2
},
UpgradeMaxSurge = "1",
Tags =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using Azure.Core;
using Azure.Core.TestFramework;
using Azure.ResourceManager.NetworkCloud.Models;
using Azure.ResourceManager.Resources;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Azure.ResourceManager.NetworkCloud.Tests.ScenarioTests
{
public class KubernetesClusterFeatureTests : NetworkCloudManagementTestBase
{
public KubernetesClusterFeatureTests (bool isAsync, RecordedTestMode mode) : base(isAsync, mode) {}
public KubernetesClusterFeatureTests (bool isAsync) : base(isAsync) {}

[Test, MaxTime(1800000)]
[RecordedTest]
public async Task KubernetesClusterFeature()
{
string featureName = Recording.GenerateAssetName("csi-volume");
ResourceIdentifier featureId = NetworkCloudKubernetesClusterFeatureResource.CreateResourceIdentifier(TestEnvironment.SubscriptionId, TestEnvironment.KubernetesClusterRG, TestEnvironment.KubernetesClusterName, featureName);
NetworkCloudKubernetesClusterFeatureResource feature = Client.GetNetworkCloudKubernetesClusterFeatureResource(featureId);

NetworkCloudKubernetesClusterResource kubernetesCluster = Client.GetNetworkCloudKubernetesClusterResource(TestEnvironment.KubernetesClusterId);
kubernetesCluster = await kubernetesCluster.GetAsync();
NetworkCloudKubernetesClusterFeatureCollection collection = kubernetesCluster.GetNetworkCloudKubernetesClusterFeatures();

// Create
NetworkCloudKubernetesClusterFeatureData data = new NetworkCloudKubernetesClusterFeatureData(TestEnvironment.Location)
{
Tags =
{
["key1"] = "myvalue1",
["key2"] = "myvalue2",
},
Options =
{
new StringKeyValuePair("featureOptionName","featureOptionValue")
},
};
// Create
ArmOperation<NetworkCloudKubernetesClusterFeatureResource> createResult = await collection.CreateOrUpdateAsync(WaitUntil.Completed, featureName, data);
Assert.AreEqual(featureName, createResult.Value.Data.Name);

// Get
var getResult = await feature.GetAsync();
Assert.AreEqual(featureName, getResult.Value.Data.Name);

// List
var listByKubernetesCluster = new List<NetworkCloudKubernetesClusterFeatureResource>();
await foreach (NetworkCloudKubernetesClusterFeatureResource item in collection.GetAllAsync())
{
listByKubernetesCluster.Add(item);
}
Assert.IsNotEmpty(listByKubernetesCluster);

// Update
NetworkCloudKubernetesClusterFeaturePatch patch = new NetworkCloudKubernetesClusterFeaturePatch()
{
Tags =
{
["key1"] = "newvalue1",
["key2"] = "newvalue2",
}
};
ArmOperation<NetworkCloudKubernetesClusterFeatureResource> updateResult = await feature.UpdateAsync(WaitUntil.Completed, patch);
Assert.AreEqual(patch.Tags, updateResult.Value.Data.Tags);

// Delete
ArmOperation<NetworkCloudOperationStatusResult> deleteResult = await feature.DeleteAsync(WaitUntil.Completed);
NetworkCloudOperationStatusResult result = deleteResult.Value;
Assert.IsNotNull(result);
}
}
}

0 comments on commit dd7ab5d

Please sign in to comment.