def main():
    Benchmark.debug()
    user = Config()["cloudmesh.profile.user"]

    name_generator = Name()
    name_generator.set(f"benchmark-{user}-vm-" + "{counter}")
    name_generator.incr()

    results = {}

    for provider in providers:
        results[provider] = {}

        for f_name in functionality_benchmark:
            results[provider][f_name] = []

            x = ComputeBenchmark(provider, f_name)

            try:
                results[provider][f_name].append(test_function(x))

            except Exception as e:
                print(e)

    #TODO use Tabulate writer to print
    print(results)

    with open('benchmark.txt', 'w') as f:
        for provider, functions in results.items():
            for function in functions.keys():
                for result in functions[function]:
                    f.write(f"{result.__str__()}\n")
Example #2
0
###############################################################
# pytest -v --capture=no tests/test_server_cms_cpu.py
# pytest -v  tests/test_server_cms_cpu.py
# pytest -v --capture=no  tests/test_server_cms_cpu..py::Test_server_sampleFunction::<METHODNAME>
###############################################################
import pytest
from cloudmesh.common.Benchmark import Benchmark
from cloudmesh.common.Shell import Shell
from cloudmesh.common.debug import VERBOSE
from cloudmesh.common.util import HEADING

Benchmark.debug()

cloud = "local"

name = "sampleFunction"

@pytest.mark.incremental
class TestServerSampleFunction:

    def test_start(self):
        HEADING()

        Benchmark.Start()
        result = Shell.execute(f"cms openapi server start ./tests/{name}.yaml",
                               shell=True)
        Benchmark.Stop()
        VERBOSE(result)

        #assert False # find test