01/27/2021, 9:09 AM
Yesterday I stated that testing Kubernetes, helm and azure on pulumi gave mysterious crashes with stacktraces. You encuraged me write a minimal version of
, and provide as an example. with Network Security Groups (NSGs), Role Based Access Control (RBAC), fluentd, in that stack I don’t think that is possible. However today i tried setting up a single Kubernetes cluster as a mock in pulumi. I hade a similar issue. If I can get some input how to create KubernetesCluster , then I can probably fix my BlueGreenStack. Here is thee example and the test tesult. What can I to test this?
using Moq;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using Pulumi;
using Pulumi.Azure.ContainerService;
using Pulumi.Azure.ContainerService.Inputs;
using Pulumi.Testing;
using Xunit;

namespace Vipps.Vce.Core.Tests.K8s
    public class KubernetesClusterStack : Stack
        public KubernetesClusterStack()
            KubernetesClusterArgs args = new KubernetesClusterArgs
                DefaultNodePool = new KubernetesClusterDefaultNodePoolArgs
                    Name = "any node pool name",
                    VmSize = "any VM size"
                DnsPrefix = "any string",
                ResourceGroupName = "any string"
            CustomResourceOptions options = new CustomResourceOptions();
            var _ = new KubernetesCluster("foo", args, options);

    public class KubernetesClusterTests
        private async Task<KubernetesCluster> CreateCluster()
            string projectName = "project";
            string stackName = "project-blue";
            var mocks = new Mock<IMocks>();
            var deployment = await Deployment.TestAsync<KubernetesClusterStack>(mocks.Object,
                new TestOptions {ProjectName = projectName, StackName = stackName});
            return deployment.OfType<KubernetesCluster>().FirstOrDefault();

        public async Task Test_Create_Cluster()
            var akscluster = await CreateCluster();
And the related test result