Пример #1
0
        public void CloneFileTest()
        {
            //To make code coverate 100%

            var cn = new GitCloner();

            cn.SetGitCmd("echo");

            var wf = new WorkflowGeneric();

            wf.GetContext().SourceDir = ".";
            wf.GetContext().WipDir    = ".";
            wf.GetContext().VcsMode   = "git";
            wf.SetCloner(cn);

            wf.CloneFiles();
        }
Пример #2
0
        public void YamlTransformTest()
        {
            Environment.SetEnvironmentVariable("IASC_GSUTIL_PATH", "echo");

            var cn = new GitCloner();

            cn.SetGitCmd("echo");

            var wf = new WorkflowGeneric();

            wf.GetContext().SourceDir = ".";
            wf.GetContext().WipDir    = ".";
            var result = wf.Load(yaml1);

            UtilsHelm.SetCmd("echo");
            wf.SetCopier(CreateGenericCopier());
            wf.SetCloner(cn);
            wf.Transform();
            UtilsHelm.ResetHelmCmd();
        }
Пример #3
0
        public void YamlParseNormalTest()
        {
            var wf  = new WorkflowGeneric();
            var ctx = wf.GetContext();

            var result = wf.Load(yaml1);
            var m      = wf.GetManifest();

            Assert.AreEqual(0, result);
            Assert.NotNull(m);
            Assert.NotNull(ctx);

            Assert.AreEqual("helm-terraform-gcp", m.Config.DefaultChartId);
            Assert.AreEqual(1, m.Charts.Count);
            Assert.AreEqual(5, m.InfraIasc.Length);

            var chart = m.Charts["helm-terraform-gcp"];

            Assert.AreEqual("https://its-software-services-devops.github.io/helm-terraform-gcp/", chart.ChartUrl);
            Assert.AreEqual("1.1.5-rc8", chart.Version);

            var iasc = m.InfraIasc[0];

            Assert.AreEqual("iasc-its-global.yaml", iasc.ValuesFiles[0]);
            Assert.AreEqual("helm-terraform-gcp", iasc.ChartId);
            Assert.AreEqual("1.1.5-rc8", iasc.Version);
            Assert.AreEqual("global", iasc.Alias);

            var nrmIasc = m.InfraIasc[2];

            Assert.AreEqual("iasc-its-gce-manager.yaml", nrmIasc.ValuesFiles[0]);
            Assert.AreEqual("helm-terraform-gcp", nrmIasc.ChartId);
            Assert.AreEqual("1.1.5-rc8", nrmIasc.Version);
            Assert.AreEqual("default-3", nrmIasc.Alias);
            Assert.AreEqual("https://its-software-services-devops.github.io/helm-terraform-gcp/", nrmIasc.ChartUrl);

            Assert.AreEqual("ccccc.txt", m.Copy[0].ToFile);
            Assert.AreEqual("configs", m.Copy[2].ToDir);
        }
Пример #4
0
        public void YamlLoadFileTest()
        {
            var path = "dummy.yaml";

            File.WriteAllText(path, yaml1);

            var cn = new GitCloner();

            cn.SetGitCmd("echo");

            var wf = new WorkflowGeneric();

            wf.GetContext().SourceDir = ".";
            wf.GetContext().WipDir    = ".";
            wf.SetCloner(cn);
            wf.SetCopier(CreateGenericCopier());
            var result = wf.LoadFile(path);

            UtilsHelm.SetCmd("echo");
            wf.Transform();
            UtilsHelm.ResetHelmCmd();
        }