예제 #1
0
        public void ShouldBeEnabled(string clusterUrl, string aksClusterName, string eksClusterName, ScriptSyntax syntax, bool expected)
        {
            var variables = new CalamariVariableDictionary
            {
                { SpecialVariables.ClusterUrl, clusterUrl },
                { SpecialVariables.AksClusterName, aksClusterName },
                { SpecialVariables.EksClusterName, eksClusterName }
            };
            var target = new KubernetesContextScriptWrapper(variables);
            var actual = target.IsEnabled(syntax);

            actual.Should().Be(expected);
        }
예제 #2
0
        public void ShouldBeEnabledIfScriptSyntaxIsPreferredSyntaxOnEnvironment()
        {
            var variables = new CalamariVariableDictionary
            {
                { SpecialVariables.ClusterUrl, "Url" },
                { SpecialVariables.AksClusterName, "" },
                { SpecialVariables.EksClusterName, "" }
            };
            var target = new KubernetesContextScriptWrapper(variables);
            var actual = target.IsEnabled(ScriptSyntaxHelper.GetPreferredScriptSyntaxForEnvironment());

            actual.Should().BeTrue();
        }
예제 #3
0
        public void ShouldBeEnabledIfAnyVariablesAreProvided(string clusterUrl, string aksClusterName,
                                                             string eksClusterName, bool expected)
        {
            var variables = new CalamariVariables
            {
                { SpecialVariables.ClusterUrl, clusterUrl },
                { SpecialVariables.AksClusterName, aksClusterName },
                { SpecialVariables.EksClusterName, eksClusterName }
            };
            var target = new KubernetesContextScriptWrapper(variables);
            var actual = target.IsEnabled(ScriptSyntaxHelper.GetPreferredScriptSyntaxForEnvironment());

            actual.Should().Be(expected);
        }
예제 #4
0
        public void ShouldBeDisabledIfScriptSyntaxIsNotPreferredSyntaxOnEnvironment()
        {
            var variables = new CalamariVariableDictionary
            {
                { SpecialVariables.ClusterUrl, "Url" },
                { SpecialVariables.AksClusterName, "" },
                { SpecialVariables.EksClusterName, "" }
            };
            var target           = new KubernetesContextScriptWrapper(variables);
            var possibleSyntaxes = Enum.GetValues(typeof(ScriptSyntax)).Cast <ScriptSyntax>();

            foreach (var syntax in possibleSyntaxes.Except(new [] { ScriptSyntaxHelper.GetPreferredScriptSyntaxForEnvironment() }))
            {
                var actual = target.IsEnabled(syntax);
                actual.Should().BeFalse();
            }
        }
        public void BashKubeCtlScripts()
        {
            var wrapper = new KubernetesContextScriptWrapper(new CalamariVariableDictionary());

            TestScript(wrapper, "Test-Script.sh");
        }
        public void PowershellKubeCtlScripts()
        {
            var wrapper = new KubernetesContextScriptWrapper(new CalamariVariableDictionary());

            TestScript(wrapper, "Test-Script.ps1");
        }