Exemple #1
0
        public void TestDeployAppUbuntu()
        {
            Context.Configuration.AddService("my-service", "dummy-svc");
            Context.Configuration.AddApp("my-app", "dummy-framework", "ubuntu");
            _driver.DeployApp("my-app");
            Shell.Commands.Count.ShouldBe(2);
            Shell.Commands[0].ShouldBe("dotnet publish -f dummy-framework -r ubuntu");
            Shell.Commands[1].ShouldBe("cf push -f manifest-steeltoe.yaml -p bin/Debug/dummy-framework/ubuntu/publish");
            var manifestFile =
                new CloudFoundryManifestFile(Path.Combine(Context.ProjectDirectory, "manifest-steeltoe.yaml"));

            manifestFile.Exists().ShouldBeTrue();
            manifestFile.CloudFoundryManifest.Applications.Count.ShouldBe(1);
            var app = manifestFile.CloudFoundryManifest.Applications[0];

            app.Name.ShouldBe("my-app");
            app.Command.ShouldBe($"cd ${{HOME}} && ./{Path.GetFileName(Context.ProjectDirectory)}");
            app.BuildPacks.Count.ShouldBe(1);
            app.BuildPacks[0].ShouldBe("dotnet_core_buildpack");
            app.Stack.ShouldBeNull();
            app.Memory.ShouldBe("512M");
            app.Environment["ASPNETCORE_ENVIRONMENT"].ShouldBe("development");
            app.ServiceNames[0].ShouldBe("my-service");
            app.ServiceNames.Count.ShouldBe(1);
        }
Exemple #2
0
        public void TestDeployApp()
        {
            Context.Configuration.AddService("my-service", "dummy-svc");
            Context.Configuration.AddApp("my-app");
            _driver.DeployApp("my-app");
            Shell.Commands.Count.ShouldBe(2);
            Shell.Commands[0].ShouldBe("dotnet publish -f netcoreapp2.1 -r win10-x64");
            Shell.Commands[1].ShouldBe("cf push -f manifest-steeltoe.yml -p bin/Debug/netcoreapp2.1/win10-x64/publish");
            var manifestFile =
                new CloudFoundryManifestFile(Path.Combine(Context.ProjectDirectory, "manifest-steeltoe.yml"));

            manifestFile.Exists().ShouldBeTrue();
            manifestFile.CloudFoundryManifest.Applications.Count.ShouldBe(1);
            var app = manifestFile.CloudFoundryManifest.Applications[0];

            app.Name.ShouldBe("my-app");
            app.Command.ShouldBe($"cmd /c .\\{Path.GetFileName(Context.ProjectDirectory)}");
            app.BuildPacks.Count.ShouldBe(1);
            app.BuildPacks[0].ShouldBe("binary_buildpack");
            app.Stack.ShouldBe("windows2016");
            app.Memory.ShouldBe("512M");
            app.Environment["ASPNETCORE_ENVIRONMENT"].ShouldBe("development");
            app.ServiceNames[0].ShouldBe("my-service");
            app.ServiceNames.Count.ShouldBe(1);
        }
Exemple #3
0
        public void TestLoadFromFile()
        {
            File.WriteAllText(_configFile, SampleConfig);
            var cfgFile = new CloudFoundryManifestFile(_configFile);

            cfgFile.CloudFoundryManifest.Applications.Count.ShouldBe(1);
            var app = cfgFile.CloudFoundryManifest.Applications[0];

            app.Name.ShouldBe("myapp");
            app.Command.ShouldBe("my command");
            app.BuildPacks.Count.ShouldBe(1);
            app.BuildPacks[0].ShouldBe("my_build_pack");
            app.Stack.ShouldBe("my stack");
            app.Memory.ShouldBe("my mem");
            app.Environment.Count.ShouldBe(1);
            app.Environment["myenv"].ShouldBe("my var");
            app.ServiceNames.Count.ShouldBe(2);
            app.ServiceNames.ShouldContain("my-service");
            app.ServiceNames.ShouldContain("my-other-service");
        }
Exemple #4
0
        public void TestStoreToFile()
        {
            var cfgFile = new CloudFoundryManifestFile(_configFile);

            cfgFile.CloudFoundryManifest.Applications.Add(new CloudFoundryManifest.Application
            {
                Name       = "myapp",
                Command    = "my command",
                BuildPacks = new List <string> {
                    "my_build_pack"
                },
                Stack       = "my stack",
                Memory      = "my mem",
                Environment = new Dictionary <string, string> {
                    { "myenv", "my var" }
                },
                ServiceNames = new List <string> {
                    "my-service", "my-other-service"
                },
            });
            cfgFile.Store();
            File.ReadAllText(_configFile).ShouldBe(SampleConfig);
        }