def test_provider_init(self):
     HEADING()
     Benchmark.Start()
     self.provider = Provider()
     Benchmark.Stop()
     assert True
     Benchmark.Status(True)
 def test_info(self):
     HEADING()
     Benchmark.Start()
     result = Shell.execute("cms multipass info", shell=True)
     Benchmark.Stop()
     VERBOSE(result)
     assert result != None, "result cannot be null"
     Benchmark.Status(True)
Example #3
0
    def test_cms_images(self):
        HEADING()
        Benchmark.Start()
        result = Shell.execute("cms multipass images", shell=True)
        Benchmark.Stop()
        VERBOSE(result)

        assert "18.04" in result
        Benchmark.Status(True)
    def test_banner_hello(self):
        HEADING()
        Benchmark.Start()
        result = Shell.execute("cmsd banner hello", shell=True)
        Benchmark.Stop()
        VERBOSE(result)

        assert "# hello" in result
        Benchmark.Status(True)
Example #5
0
    def test_vm_list_json(self):
        HEADING()
        Benchmark.Start()
        result = Shell.execute("cmsd vm list --output=json", shell=True)
        Benchmark.Stop()
        # VERBOSE(result)

        assert result.endswith("}")
        Benchmark.Status(True)
Example #6
0
 def exclude_test_setup(self):
     HEADING()
     Benchmark.Start()
     result = Shell.execute("cmsd --setup", shell=True)
     Benchmark.Stop()
     VERBOSE(result)
     raise NotImplementedError
     assert "not implemented" in result
     Benchmark.Status(True)
Example #7
0
    def test_provider_vm(self):
        HEADING()

        Benchmark.Start()
        result = self.provider.vm()
        Benchmark.Stop()
        VERBOSE(result)

        assert "18.04" in result
        Benchmark.Status(True)
Example #8
0
    def test_help(self):
        HEADING()

        Benchmark.Start()
        result = Shell.execute("cmsd --help", shell=True)
        Benchmark.Stop()
        VERBOSE(result)

        assert "cmsd --setup" in result
        Benchmark.Status(True)
    def exclude_test_clean(self):
        HEADING()
        Benchmark.Start()
        result = Shell.execute("cmsd --clean", shell=True)
        Benchmark.Stop()
        VERBOSE(result)

        assert "Removing volumes ..." in result
        assert "Removing temp dir" in result
        Benchmark.Status(True)
    def test_cms_get(self):
        HEADING()

        Benchmark.Start()
        result = Shell.execute("cms get", shell=True)
        Benchmark.Stop()
        VERBOSE(result)

        assert "missing" in result
        Benchmark.Status(True)
    def test_cms_help(self):
        HEADING()

        Benchmark.Start()
        result = Shell.execute("cms help multipass", shell=True)
        Benchmark.Stop()
        VERBOSE(result)

        assert " multipass create NAMES" in result
        Benchmark.Status(True)
    def exclude_test_update(self):
        HEADING()

        Benchmark.Start()
        result = Shell.execute("cmsd --update", shell=True)
        Benchmark.Stop()
        VERBOSE(result)

        assert "quit" in result
        assert "clear" in result
        Benchmark.Status(True)
Example #13
0
    def test_list_kinds(self):
        """
        Method to return list of kinds for all supported services.
        :return:
        """
        HEADING()
        #Get kind for each service.
        for service in self.services:
            result = self._test_list_kinds(service)
            self.rprint(result)

        Benchmark.Status(True)
Example #14
0
 def test_list(self):
     """
     Method to return list of all services and related kinds.
     :return:
     """
     HEADING()
     Benchmark.Start()
     result = Shell.execute("cms register list", shell=True)
     Benchmark.Stop()
     assert 'INFO: Services to be registered' in result, "result cannot be null"
     self.rprint(result)
     Benchmark.Status(True)
Example #15
0
    def test_provider_run_buffer(self):
        HEADING()

        Benchmark.Start()
        result = self.provider.run(command="uname -a", executor="buffer")
        Benchmark.Stop()
        VERBOSE(result)

        # find a good assertion

        assert "18.04" in result
        Benchmark.Status(True)
    def test_provider_shell(self):
        HEADING()

        Benchmark.Start()
        Shell.execute(f"cms multipass launch --name={instance}", shell=True)
        result = self.provider.shell(name=instance)
        Shell.execute(f"cms multipass delete {instance}", shell=True)
        Shell.execute(f"cms multipass purge", shell=True)
        Benchmark.Stop()
        VERBOSE(result)
        # assertion missing
        Benchmark.Status(True)
    def test_create(self):
        HEADING()
        vm_name = f"{self.vm_name_prefix}1"

        Benchmark.Start()
        result = Shell.execute(f"cms multipass create {vm_name}", shell=True)
        Benchmark.Stop()

        VERBOSE(result)

        assert f'Launched: {vm_name}' in result, "Error creating instance"
        Benchmark.Status(True)
    def test_setup(self):
        HEADING()

        print("WARNING: this will take quite a while ...")
        print()

        Benchmark.Start()
        result = Shell.execute("cmsd --setup", shell=True)
        Benchmark.Stop()
        VERBOSE(result)

        assert "cloudmesh-mongo container running!" in result
        Benchmark.Status(True)
Example #19
0
    def test_provider_start(self):
        HEADING()
        vm_name = f"{self.vm_name_prefix}2"
        provider = Provider(vm_name)

        Benchmark.Start()
        result = provider.start(vm_name)
        Benchmark.Stop()

        VERBOSE(result)

        assert 'Running' in result['status'], "Error starting instance"
        Benchmark.Status(True)
Example #20
0
    def test_provider_destroy(self):
        HEADING()
        vm_name = f"{self.vm_name_prefix}2"
        provider = Provider(vm_name)

        Benchmark.Start()
        result = provider.destroy(vm_name)
        Benchmark.Stop()

        VERBOSE(result)

        assert 'destroyed' in result['status'], "Error destroying instance"
        Benchmark.Status(True)
    def test_destroy(self):
        HEADING()
        #Using 2 VMs to test_created usingn test_create* methods.
        vm_names = f"{self.vm_name_prefix}1,{self.vm_name_prefix}3"

        Benchmark.Start()
        result = Shell.execute(f"cms multipass destroy {vm_names}", shell=True)
        Benchmark.Stop()

        VERBOSE(result)

        assert 'destroyed' in result, "Error destroying instance"
        Benchmark.Status(True)
    def test_provider_resume(self):
        HEADING()
        vm_name = f"{self.vm_name_prefix}2"
        provider = Provider(vm_name)
        Provider.suspend(vm_name)
        Benchmark.Start()
        result = provider.resume(vm_name)
        Benchmark.Stop()

        VERBOSE(result)

        assert 'Resume' in result['status'], "Error resuming instance"
        Benchmark.Status(True)
    def test_version(self):
        HEADING()

        version = readfile("VERSION")
        Benchmark.Start()
        result = Shell.execute("cmsd --version", shell=True)
        Benchmark.Stop()
        VERBOSE(result)

        msg = f"cmsd: {version}"
        print("Version string to be tested:", msg)
        assert msg in result
        Benchmark.Status(True)
    def test_create_with_options(self):
        HEADING()

        vm_name = f"{self.vm_name_prefix}3"

        Benchmark.Start()
        result = Shell.execute(
            f"cms multipass create {vm_name} --cpus=2 --size=3G --image=bionic --mem=1G",
            shell=True)
        Benchmark.Stop()
        VERBOSE(result)

        assert f'Launched: {vm_name}' in result, "Error creating instance"
        Benchmark.Status(True)
    def test_provider_get(self):
        HEADING()

        self.provider = Provider()

        Benchmark.Start()
        result = self.provider.get()
        Benchmark.Stop()
        VERBOSE(result)

        result = str(result)

        assert "missing" in result
        Benchmark.Status(True)
    def test_cms_vm(self):
        HEADING()

        self.provider = Provider()

        Benchmark.Start()
        result = Shell.execute("cms multipass vm", shell=True)
        Benchmark.Stop()
        VERBOSE(result)

        result = str(result)

        assert "18.04" in result
        Benchmark.Status(True)
    def test_provider_images(self):
        HEADING()

        self.provider = Provider()

        Benchmark.Start()
        result = self.provider.images()
        Benchmark.Stop()
        VERBOSE(result)

        result = str(result)

        assert "18.04" in result
        Benchmark.Status(True)
Example #28
0
    def test_list_google_storage_sample(self):
        """
        Method to return sample for google storage.
        :return:
        """
        HEADING()
        service = self.services[0]
        kind = "google"
        list_sample_cmd = f"cms register list sample --service={service} --kind={kind}"
        Benchmark.Start()
        result = Shell.execute(list_sample_cmd, shell=True)
        Benchmark.Stop()
        assert 'Error' not in result and 'suitable' not in result \
               and result != None, f"Error listing sample for {kind}-{service}."

        # If success, print the result.
        self.rprint(result)
        Benchmark.Status(True)
Example #29
0
    def test_remove(self):
        """
        Method to remove google compute entry with default name google.
        :return:
        """
        HEADING()
        service = self.services[1]  # compute service
        kind = "google"
        update_json_cmd = f"cms register remove --service={service} --kind={kind}"
        Benchmark.Start()
        result = Shell.execute(update_json_cmd, shell=True)
        Benchmark.Stop()

        assert f"Removed {kind} from {kind} service" not in result, \
                f"Error removing {kind} from cloudmesh.yaml."

        # If success, print the result.
        self.rprint(result)
        Benchmark.Status(True)
Example #30
0
    def test_list_google_compute_sample(self):
        """
        Method to list sample for google compute.
        :return:
        """
        HEADING()
        service = self.services[1]
        kind = "google"
        list_sample_cmd = f"cms register list sample --service={service} --kind={kind}"
        Benchmark.Start()
        result = Shell.execute(list_sample_cmd, shell=True)
        Benchmark.Stop()
        assert 'Error' not in result, f"Error listing sample for {kind}-{service}."
        assert 'suitable provider not found' not in result, f"Error listing sample for {kind}-{service}."
        assert result is not None, f"Error listing sample for {kind}-{service}."

        #If success, print the result.
        self.rprint(result)
        Benchmark.Status(True)