Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -4,12 +4,12 @@
using System.Text.Json;
using Azure.Mcp.Tests;
using Azure.Mcp.Tests.Client;
using Azure.Mcp.Tests.Client.Helpers;
using Xunit;

namespace Azure.Mcp.Tools.Aks.LiveTests;

public sealed class AksCommandTests(ITestOutputHelper output)
: CommandTestsBase(output)
public sealed class AksCommandTests(ITestOutputHelper output, TestProxyFixture fixture) : RecordedCommandTestsBase(output, fixture)
{

[Fact]
Expand Down Expand Up @@ -149,8 +149,8 @@ public async Task Should_get_specific_aks_cluster()

// Get the first cluster's details
var firstCluster = clusters.EnumerateArray().First();
var clusterName = firstCluster.GetProperty("name").GetString()!;
var resourceGroupName = firstCluster.GetProperty("resourceGroupName").GetString()!;
var clusterName = RegisterOrRetrieveVariable("firstClusterName", firstCluster.GetProperty("name").GetString()!);
var resourceGroupName = RegisterOrRetrieveVariable("firstResourceGroupName", firstCluster.GetProperty("resourceGroupName").GetString()!);

// Now test the get command
var getResult = await CallToolAsync(
Expand All @@ -172,33 +172,33 @@ public async Task Should_get_specific_aks_cluster()

// Verify the cluster details
var nameProperty = cluster.AssertProperty("name");
Assert.Equal(clusterName, nameProperty.GetString());
Assert.Equal(TestMode == Tests.Helpers.TestMode.Playback ? "Sanitized" : clusterName, nameProperty.GetString());

var rgProperty = cluster.AssertProperty("resourceGroupName");
Assert.Equal(resourceGroupName, rgProperty.GetString());

// Verify other common properties exist
Assert.True(cluster.TryGetProperty("subscriptionId", out _));
Assert.True(cluster.TryGetProperty("location", out _));
cluster.AssertProperty("subscriptionId");
cluster.AssertProperty("location");

// Enriched cluster checks
Assert.True(cluster.TryGetProperty("id", out _));
Assert.True(cluster.TryGetProperty("enableRbac", out _));
Assert.True(cluster.TryGetProperty("skuName", out _));
Assert.True(cluster.TryGetProperty("skuTier", out _));
Assert.True(cluster.TryGetProperty("nodeResourceGroup", out _));
Assert.True(cluster.TryGetProperty("maxAgentPools", out _));
Assert.True(cluster.TryGetProperty("supportPlan", out _));
cluster.AssertProperty("id");
cluster.AssertProperty("enableRbac");
cluster.AssertProperty("skuName");
cluster.AssertProperty("skuTier");
cluster.AssertProperty("nodeResourceGroup");
cluster.AssertProperty("maxAgentPools");
cluster.AssertProperty("supportPlan");

// Profiles present or null
Assert.True(cluster.TryGetProperty("networkProfile", out _));
Assert.True(cluster.TryGetProperty("windowsProfile", out _));
Assert.True(cluster.TryGetProperty("servicePrincipalProfile", out _));
Assert.True(cluster.TryGetProperty("addonProfiles", out _));
Assert.True(cluster.TryGetProperty("identityProfile", out _));
cluster.AssertProperty("networkProfile");
cluster.AssertProperty("windowsProfile");
cluster.AssertProperty("servicePrincipalProfile");
cluster.AssertProperty("addonProfiles");
cluster.AssertProperty("identityProfile");

// Get-specific should return agentPoolProfiles (we populate on Get)
Assert.True(cluster.TryGetProperty("agentPoolProfiles", out var pools));
var pools = cluster.AssertProperty("agentPoolProfiles");
Assert.Equal(JsonValueKind.Array, pools.ValueKind);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
using System.Text.Json;
using Azure.Mcp.Tests;
using Azure.Mcp.Tests.Client;
using Azure.Mcp.Tests.Client.Helpers;
using Xunit;

namespace Azure.Mcp.Tools.Aks.LiveTests;

public sealed class NodepoolCommandTests(ITestOutputHelper output)
: CommandTestsBase(output)
public sealed class NodepoolCommandTests(ITestOutputHelper output, TestProxyFixture fixture) : RecordedCommandTestsBase(output, fixture)
{
[Fact]
public async Task Should_list_nodepools_for_cluster()
Expand All @@ -26,8 +26,8 @@ public async Task Should_list_nodepools_for_cluster()
Assert.True(clusters.GetArrayLength() > 0, "Expected at least one AKS cluster for testing nodepool get command");

var firstCluster = clusters.EnumerateArray().First();
var clusterName = firstCluster.GetProperty("name").GetString()!;
var resourceGroupName = firstCluster.GetProperty("resourceGroupName").GetString()!;
var clusterName = RegisterOrRetrieveVariable("firstClusterName", firstCluster.GetProperty("name").GetString()!);
var resourceGroupName = RegisterOrRetrieveVariable("firstResourceGroupName", firstCluster.GetProperty("resourceGroupName").GetString()!);

// List node pools for that cluster
var nodepoolResult = await CallToolAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
using System.Text.Json;
using Azure.Mcp.Tests;
using Azure.Mcp.Tests.Client;
using Azure.Mcp.Tests.Client.Helpers;
using Xunit;

namespace Azure.Mcp.Tools.Aks.LiveTests;

public sealed class NodepoolGetCommandTests(ITestOutputHelper output)
: CommandTestsBase(output)
public sealed class NodepoolGetCommandTests(ITestOutputHelper output, TestProxyFixture fixture) : RecordedCommandTestsBase(output, fixture)
{
[Fact]
public async Task Should_get_nodepool_for_cluster()
Expand All @@ -26,8 +26,8 @@ public async Task Should_get_nodepool_for_cluster()
Assert.True(clusters.GetArrayLength() > 0, "Expected at least one AKS cluster for testing nodepool get command");

var firstCluster = clusters.EnumerateArray().First();
var clusterName = firstCluster.GetProperty("name").GetString()!;
var resourceGroupName = firstCluster.GetProperty("resourceGroupName").GetString()!;
var clusterName = RegisterOrRetrieveVariable("firstClusterName", firstCluster.GetProperty("name").GetString()!);
var resourceGroupName = RegisterOrRetrieveVariable("firstResourceGroupName", firstCluster.GetProperty("resourceGroupName").GetString()!);

// Find a node pool to query
var nodepoolList = await CallToolAsync(
Expand All @@ -43,7 +43,7 @@ public async Task Should_get_nodepool_for_cluster()
Assert.True(nodePools.GetArrayLength() > 0, "Expected at least one node pool in the cluster");

var firstPool = nodePools.EnumerateArray().First();
var nodepoolName = firstPool.GetProperty("name").GetString()!;
var nodepoolName = RegisterOrRetrieveVariable("firstNodepoolName", firstPool.GetProperty("name").GetString()!);

// Get details for that node pool
var nodepoolGet = await CallToolAsync(
Expand All @@ -62,7 +62,7 @@ public async Task Should_get_nodepool_for_cluster()

var nodePool = nodePools.EnumerateArray().First();
Assert.Equal(JsonValueKind.Object, nodePool.ValueKind);
Assert.Equal(nodepoolName, nodePool.GetProperty("name").GetString());
Assert.Equal(TestMode == Tests.Helpers.TestMode.Playback ? "Sanitized" : nodepoolName, nodePool.GetProperty("name").GetString());

if (nodePool.TryGetProperty("mode", out var modeProperty))
{
Expand All @@ -74,12 +74,12 @@ public async Task Should_get_nodepool_for_cluster()
Assert.False(string.IsNullOrEmpty(stateProperty.GetString()));
}

Assert.True(nodePool.TryGetProperty("orchestratorVersion", out _));
Assert.True(nodePool.TryGetProperty("currentOrchestratorVersion", out _));
Assert.True(nodePool.TryGetProperty("enableAutoScaling", out _));
Assert.True(nodePool.TryGetProperty("maxPods", out _));
Assert.True(nodePool.TryGetProperty("osSKU", out _));
Assert.True(nodePool.TryGetProperty("nodeImageVersion", out _));
nodePool.AssertProperty("orchestratorVersion");
nodePool.AssertProperty("currentOrchestratorVersion");
nodePool.AssertProperty("enableAutoScaling");
nodePool.AssertProperty("maxPods");
nodePool.AssertProperty("osSKU");
nodePool.AssertProperty("nodeImageVersion");

// Enriched node pool fields (presence/type checks)
if (nodePool.TryGetProperty("tags", out var tags))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "",
"TagPrefix": "Azure.Mcp.Tools.Aks.LiveTests",
"Tag": "Azure.Mcp.Tools.Aks.LiveTests_2f1814827b"
}