def test_real(self):
        """
        function to test if the server is started and available to return
        a successful http code
        """
        HEADING()
        Benchmark.Start()

        Shell.run("cd ~/cm/cloudmesh-openapi/tests/")
        test_loc = Shell.run("pwd")
        test_loc = test_loc.strip() + "/"

        assert test_loc == "/Users/andrewgoldfarb/e516-spring/cm/cloudmesh-openapi/tests/"

        server_output = Shell.cms(
            "openapi3 server start ./server-cpu/cpu.yaml")
        assert server_output.__contains__("starting server")

        time.sleep(2)
        baseurl = "http://127.0.0.1:8080/cloudmesh"
        response = Shell.run("curl " + baseurl + "/cpu")
        assert response.__contains__("200")

        Shell.cms("openapi3 server stop cpu")
        response = Shell.run("curl " + baseurl + "/cpu")
        fail_message = "Failed to connect to 127.0.0.1 port 80: Connection refuse"
        assert response.__contains__(fail_message)

        Benchmark.Stop()
Exemple #2
0
    def test_service(self):
        """
        function to test if the server is started and available to return
        a successful http code
        """
        HEADING()
        Benchmark.Start()

        server_output = Shell.cms("openapi server start {filename}")
        assert server_output.__contains__("starting server")

        time.sleep(2)
        baseurl = "http://127.0.0.1:8080/cloudmesh"

        curl = f"curl {baseurl}/cpu"

        response = Shell.run(curl)
        assert response.__contains__("200")

        Shell.cms("openapi server stop cpu")
        response = Shell.run(curl)
        fail_message = "Failed to connect to 127.0.0.1 port 80: Connection refuse"
        assert response.__contains__(fail_message)

        Benchmark.Stop()
    def test_service_stop(self):
        """
        function to test if the server is returns the result from the url
        """
        HEADING()

        Shell.cms("openapi server stop cpu")
        response = Shell.run(curl)
        fail_message = "Failed to connect to 127.0.0.1 port 80: Connection refuse"
        assert response.__contains__(fail_message)

        Benchmark.Stop()
Exemple #4
0
    def start(self):
        """
        start the registry

        possibly not needed as we have cms start

        :return:
        """
        r = Shell.cms("start")
Exemple #5
0
    def stop(self):
        """
        stop the registry

        possibly not needed as we have cms start
        this will not just sto the registry but mongo

        :return:
        """
        r = Shell.cms("stop")
    def test_service_start(self):
        """
        function to test if the server is starts
        """
        HEADING()

        os.chdir("tests")
        test_loc = Shell.pwd().strip() + "/"

        assert test_loc == "tests/"

        Benchmark.Start()
        server_output = Shell.cms("openapi server start {filename}")
        Benchmark.Start()

        assert server_output.__contains__("starting server")
# fa20-516-223 E.Cloudmesh.Common.5

from cloudmesh.common.Shell import Shell
from cloudmesh.common.StopWatch import StopWatch

StopWatch.start("cmshelp")
# Get cms help.
cms_help = Shell.cms("help")
print(cms_help)
StopWatch.stop("cmshelp")

print(StopWatch.get("cmshelp"))

StopWatch.benchmark()