Example #1
0
        public void TestIsHealthy()
        {
            Shell.AddResponse(@"Client Version: version.Info{Major:""9"", Minor:""87"", ...
Server Version: version.Info{Major:""6"", Minor:""54"", ...");
            Shell.AddResponse(@"CURRENT   NAME       CLUSTER    AUTHINFO   NAMESPACE
*         context1   cluster1   authinfo1
          context2   cluster2   authinfo2
");
            var healthy = _target.IsHealthy(Context);

            healthy.ShouldBeTrue();
            var expected = new[]
            {
                "kubectl version",
                "kubectl config get-contexts",
            };

            Shell.Commands.Count.ShouldBe(expected.Length);
            for (int i = 0; i < expected.Length; ++i)
            {
                Shell.Commands[i].ShouldBe(expected[i]);
            }
            Console.ToString().ShouldContain("Kubernetes ... kubectl client version 9.87, server version 6.54");
            Console.ToString().ShouldContain("current context ... context1");
        }
Example #2
0
        public void TestIsHealthy()
        {
            Shell.AddResponse("Docker version SOME VERSION");
            Shell.AddResponse(@"
Operating System: SOME HOST OS
OSType: SOME CONTAINER OS
");
            var healthy = _env.IsHealthy(Context);

            healthy.ShouldBeTrue();
            var expected = new[]
            {
                "docker --version",
                "docker info",
            };

            Shell.Commands.Count.ShouldBe(expected.Length);
            for (int i = 0; i < expected.Length; ++i)
            {
                Shell.Commands[i].ShouldBe(expected[i]);
            }

            Console.ToString().ShouldContain("Docker ... Docker version SOME VERSION");
            Console.ToString().ShouldContain("Docker host OS ... SOME HOST OS");
            Console.ToString().ShouldContain("Docker container OS ... SOME CONTAINER OS");
        }
Example #3
0
 public void TestServiceOffline()
 {
     Context.Configuration.AddService("my-Service", "dummy-svc");
     Shell.AddResponse("");
     Shell.AddResponse("", -1);
     _driver.GetServiceStatus("my-Service").ShouldBe(Lifecycle.Status.Offline);
 }
Example #4
0
 public void TestDeployServiceForOs()
 {
     Context.Configuration.AddService("my-service", "dummy-svc");
     Shell.AddResponse("OSType: dummyos");
     _driver.DeployService("my-service");
     Shell.Commands[1].ShouldBe("docker run --name my-service --publish 0:0 --detach --rm dummy-server:for_dummyos");
 }
Example #5
0
        public void TestServiceStopping()
        {
            Context.Configuration.AddService("my-service", "dummy-svc");
            Shell.AddResponse("status:    delete in progress");
            var status = _driver.GetServiceStatus("my-service");

            status.ShouldBe(Lifecycle.Status.Stopping);
        }
Example #6
0
        public void TestServiceOffline()
        {
            Context.Configuration.AddService("my-service", "dummy-svc");
            Shell.AddResponse("Service instance my-service not found", 1);
            var status = _driver.GetServiceStatus("my-service");

            status.ShouldBe(Lifecycle.Status.Offline);
        }
Example #7
0
 public void TestServiceStarting()
 {
     Context.Configuration.AddService("my-Service", "dummy-svc");
     Shell.AddResponse("Pending");
     _driver.GetServiceStatus("my-Service").ShouldBe(Lifecycle.Status.Starting);
     Shell.AddResponse("ContainerCreating");
     _driver.GetServiceStatus("my-Service").ShouldBe(Lifecycle.Status.Starting);
 }
Example #8
0
 public void TestAppOffline()
 {
     Context.Configuration.AddApp("my-app", "dummy-framework", "dummy-runtime");
     Shell.AddResponse("App my-app not found.", -1);
     _driver.GetAppStatus("my-app").ShouldBe(Lifecycle.Status.Offline);
     Shell.AddResponse("App 'my-app' not found.", -1);
     _driver.GetAppStatus("my-app").ShouldBe(Lifecycle.Status.Offline);
 }
Example #9
0
        public void TestServiceOnline()
        {
            Context.Configuration.AddService("my-service", "dummy-svc");
            Shell.AddResponse("status:    create succeeded");
            var status = _driver.GetServiceStatus("my-service");

            status.ShouldBe(Lifecycle.Status.Online);
        }
Example #10
0
 public void TestServiceStopping()
 {
     Context.Configuration.AddService("my-Service", "dummy-svc");
     Shell.AddResponse("Terminating");
     _driver.GetServiceStatus("my-Service").ShouldBe(Lifecycle.Status.Stopping);
     Shell.AddResponse("");
     _driver.GetServiceStatus("my-Service").ShouldBe(Lifecycle.Status.Stopping);
 }
Example #11
0
        public void TestAppOnline()
        {
            Context.Configuration.AddApp("my-app", "dummy-framework", "dummy-runtime");
            Shell.AddResponse("#0   running   2018-11-02T16:32:37Z   16.9%   129.2M of 512M   124.8M of 1G");
            var status = _driver.GetAppStatus("my-app");

            status.ShouldBe(Lifecycle.Status.Online);
        }
Example #12
0
        public void TestIsHealthyDockerNotRunning()
        {
            Shell.AddResponse("");
            Shell.AddResponse("", 1);
            var healthy = _env.IsHealthy(Context);

            healthy.ShouldBeFalse();
        }
Example #13
0
        public void TestCheckService()
        {
            Context.Configuration.AddService("my-Service", "dummy-svc");
            Shell.AddResponse("Running");
            _driver.GetServiceStatus("my-Service");
            Shell.Commands.Count.ShouldBe(1);
            Shell.Commands[0].ShouldBe("kubectl get pods --selector app=my-service");
//            Shell.Commands[1].ShouldBe("kubectl get services my-service");
        }
        public void TestIsHealthyNotLoggedIn()
        {
            Shell.AddResponse("");
            Shell.AddResponse("", 1);
            var healthy = _target.IsHealthy(Context);

            healthy.ShouldBeFalse();
            Console.ToString().ShouldContain("logged into Cloud Foundry ... !!! no");
        }
Example #15
0
        public void TestGetAppLifecycleStateStarting()
        {
            Context.Configuration.AddApp("my-app");
            Shell.AddResponse(
                @"CONTAINER ID                                                       IMAGE                        COMMAND                                               CREATED             STATUS              PORTS                  NAMES
d2832b55b9e348d98b495f4432e05bc5e54dbe562d7294b48ba1ac5470b591b2   steeltoeoss/dotnet-sdk:2.1   ""dotnet /work/bin/Debug/netcoreapp2.1/MyWebApp.dll""   56 seconds ago      Up 55 seconds       0.0.0.0:8080->80/tcp   my-app
");
            var state = _driver.GetAppStatus("my-app");

            state.ShouldBe(Lifecycle.Status.Starting);
        }
Example #16
0
        public void TestGetServiceLifecycleStateStarting()
        {
            Context.Configuration.AddService("my-service", "dummy-svc");
            Shell.AddResponse(
                @"CONTAINER ID                                                       IMAGE                           COMMAND                                                                 CREATED             STATUS              PORTS                    NAMES
0000000000000000000000000000000000000000000000000000000000000000   dummy-server:0.1                 java -Djava.security.egd=file:/dev/./urandom -jar config-server.jar    37 seconds ago      Up 36 seconds       0.0.0.0:0000->0000/tcp   my-service
");
            var state = _driver.GetServiceStatus("my-service");

            state.ShouldBe(Lifecycle.Status.Starting);
        }
        public void TestIsHealthy()
        {
            Shell.AddResponse("cf version SOME VERSION");
            var healthy = _target.IsHealthy(Context);

            healthy.ShouldBeTrue();
            var expected = new[]
            {
                "cf --version",
                "cf target",
            };

            Shell.Commands.Count.ShouldBe(expected.Length);
            for (int i = 0; i < expected.Length; ++i)
            {
                Shell.Commands[i].ShouldBe(expected[i]);
            }
            Console.ToString().ShouldContain("Cloud Foundry ... cf version SOME VERSION");
            Console.ToString().ShouldContain("logged into Cloud Foundry ... yes");
        }
Example #18
0
 public void TestAppOnline()
 {
     Context.Configuration.AddApp("my-App");
     Shell.AddResponse("Running");
     _driver.GetAppStatus("my-App").ShouldBe(Lifecycle.Status.Online);
 }