예제 #1
0
 def setUp(self):
     """
     Attempt to setup a valid group with clients and test the protocol
     """
     super(TestMultinode, self).setUp()
     factory = Factory()
     self.client_job = factory.create_kvm_job(
         'sample_jobs/kvm-multinode-client.yaml')
     self.server_job = factory.create_kvm_job(
         'sample_jobs/kvm-multinode-server.yaml')
     self.job_id = "100"
     self.coord = TestCoordinator()
예제 #2
0
 def setUp(self):
     super(TestAutoLogin, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job('sample_jobs/kvm-inline.yaml',
                                       mkdtemp())
     self.job.logger = DummyLogger()
     self.max_end_time = time.time() + 30
예제 #3
0
 def setUp(self):
     super(TestDefinitionHandlers, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job('sample_jobs/kvm.yaml')
     with open(
             os.path.join(os.path.dirname(__file__), 'testdefs',
                          'params.yaml'), 'r') as params:
         self.testdef = yaml.safe_load(params)
예제 #4
0
 def setUp(self):
     """
     Attempt to setup a valid group with clients and test the protocol
     """
     super(TestMultinode, self).setUp()
     factory = Factory()
     self.client_job = factory.create_kvm_job('sample_jobs/kvm-multinode-client.yaml')
     self.server_job = factory.create_kvm_job('sample_jobs/kvm-multinode-server.yaml')
     self.coord = TestCoordinator()
 def test_qemu_notest(self):
     factory = Factory()
     job = factory.create_kvm_job('sample_jobs/kvm-notest.yaml', mkdtemp())
     job.validate()
     self.assertIsNotNone(job)
     self.assertIsNotNone(job.pipeline)
     self.assertIsNotNone(job.pipeline.actions)
     for action in job.pipeline.actions:
         action.validate()
         self.assertTrue(action.valid)
     self.assertTrue(find_autologin(job))
 def setUp(self):
     super(TestPatterns, self).setUp()
     self.testdef = os.path.join(os.path.dirname(__file__), 'testdefs', 'params.yaml')
     self.res_data = os.path.join(os.path.dirname(__file__), 'testdefs', 'result-data.txt')
     factory = Factory()
     self.job = factory.create_kvm_job("sample_jobs/kvm.yaml")
     self.job.logger = DummyLogger()
     self.job.validate()
     self.ret = False
     test_retry = [action for action in self.job.pipeline.actions if action.name == 'lava-test-retry'][0]
     self.test_shell = [action for action in test_retry.internal_pipeline.actions if action.name == 'lava-test-shell'][0]
     self.test_shell.logger = DummyLogger()
 def test_qemu_monitor_zephyr_job(self):
     factory = Factory()
     job = factory.create_kvm_job('sample_jobs/zephyr-qemu-test-task.yaml',
                                  mkdtemp())
     job.validate()
     self.assertIsNotNone(job)
     self.assertIsNotNone(job.pipeline)
     self.assertIsNotNone(job.pipeline.actions)
     for action in job.pipeline.actions:
         action.validate()
         self.assertTrue(action.valid)
     self.assertFalse(find_autologin(job))
예제 #8
0
 def setUp(self):
     super(TestDefinitionParams, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job('sample_jobs/kvm-params.yaml')
예제 #9
0
 def setUp(self):
     super(TestKVMInlineTestDeploy, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job('sample_jobs/kvm-inline.yaml', mkdtemp())
예제 #10
0
 def setUp(self):
     super(TestKVMQcow2Deploy, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job('sample_jobs/kvm-qcow2.yaml', mkdtemp())
예제 #11
0
 def setUp(self):
     super(TestKvmUefi, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job('sample_jobs/kvm-uefi.yaml', mkdtemp())
예제 #12
0
 def setUp(self):
     super(TestChecksum, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job('sample_jobs/kvm-inline.yaml',
                                       mkdtemp())
예제 #13
0
 def setUp(self):
     super(TestRepeatBootTest, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job('sample_jobs/kvm-repeat.yaml', mkdtemp())
예제 #14
0
 def setUp(self):
     super(TestKVMDownloadLocalDeploy, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job('sample_jobs/kvm-local.yaml',
                                       mkdtemp())
예제 #15
0
 def setUp(self):
     super(TestMonitor, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job('sample_jobs/qemu-monitor.yaml',
                                       mkdtemp())
예제 #16
0
 def setUp(self):
     super(TestRepeatBootTest, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job('sample_jobs/kvm-repeat.yaml',
                                       mkdtemp())
예제 #17
0
 def setUp(self):
     super(TestDefinitionHandlers, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job('sample_jobs/kvm.yaml')
 def test_autologin_normal_kvm(self):
     factory = Factory()
     job = factory.create_kvm_job('sample_jobs/kvm.yaml', mkdtemp())
     job.validate()
     self.assertTrue(find_autologin(job))
예제 #19
0
 def setUp(self):
     super(TestKVMQcow2Deploy, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job('sample_jobs/kvm-qcow2.yaml',
                                       mkdtemp())
예제 #20
0
 def setUp(self):
     super(TestDefinitionSimple, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job('sample_jobs/kvm-notest.yaml')
예제 #21
0
 def setUp(self):
     super(TestKVMInlineTestDeploy, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job('sample_jobs/kvm-inline.yaml',
                                       mkdtemp())
예제 #22
0
class TestDefinitionParams(StdoutTestCase):  # pylint: disable=too-many-public-methods

    def setUp(self):
        super(TestDefinitionParams, self).setUp()
        self.factory = Factory()
        self.job = self.factory.create_kvm_job('sample_jobs/kvm-params.yaml')

    def test_job_without_tests(self):
        boot = finalize = None
        allow_missing_path(self.job.pipeline.validate_actions, self, 'qemu-system-x86_64')
        deploy = [action for action in self.job.pipeline.actions if action.name == 'deployimages'][0]
        overlay = [action for action in deploy.internal_pipeline.actions if action.name == 'lava-overlay'][0]
        testdef = [action for action in overlay.internal_pipeline.actions if action.name == 'test-definition'][0]
        for action in self.job.pipeline.actions:
            self.assertNotIsInstance(action, TestDefinitionAction)
            self.assertNotIsInstance(action, OverlayAction)
            boot = self.job.pipeline.actions[1]
            finalize = self.job.pipeline.actions[3]
        self.assertIsInstance(overlay, OverlayAction)
        self.assertIsInstance(testdef, TestDefinitionAction)
        test = testdef.internal_pipeline.actions[1]
        install = testdef.internal_pipeline.actions[2]
        runsh = testdef.internal_pipeline.actions[3]
        self.assertIsInstance(deploy, DeployImagesAction)
        self.assertIsInstance(boot, BootAction)
        self.assertIsInstance(finalize, FinalizeAction)
        self.assertEqual(len(self.job.pipeline.actions), 4)  # deploy, boot, test, finalize
        self.assertNotIn('test_params', testdef.parameters)
        self.assertIsInstance(install, TestInstallAction)
        self.assertIsInstance(runsh, TestRunnerAction)
        self.assertIsNot(list(install.parameters.items()), [])
        testdef = {'params': {'VARIABLE_NAME_1': 'value_1',
                              'VARIABLE_NAME_2': 'value_2'}}
        content = test.handle_parameters(testdef)
        self.assertEqual(
            set(content),
            {
                '###default parameters from test definition###\n',
                "VARIABLE_NAME_1='value_1'\n", "VARIABLE_NAME_2='value_2'\n",
                '######\n', '###test parameters from job submission###\n',
                "VARIABLE_NAME_1='eth2'\n", "VARIABLE_NAME_2='wlan0'\n",
                '######\n'
            }
        )
        testdef = {'parameters': {'VARIABLE_NAME_1': 'value_1',
                                  'VARIABLE_NAME_2': 'value_2'}}
        content = test.handle_parameters(testdef)
        self.assertEqual(
            set(content),
            {
                '###default parameters from test definition###\n',
                "VARIABLE_NAME_1='value_1'\n", "VARIABLE_NAME_2='value_2'\n",
                '######\n', '###test parameters from job submission###\n',
                "VARIABLE_NAME_1='eth2'\n", "VARIABLE_NAME_2='wlan0'\n",
                '######\n'
            }
        )

    @unittest.skipIf(infrastructure_error('git'), 'git not installed')
    def test_install_repos(self):
        job = self.factory.create_kvm_job('sample_jobs/kvm-install.yaml')
        allow_missing_path(self.job.pipeline.validate_actions, self, 'qemu-system-x86_64')
        deploy = [action for action in job.pipeline.actions if action.name == 'deployimages'][0]
        overlay = [action for action in deploy.internal_pipeline.actions if action.name == 'lava-overlay'][0]
        testdef = [action for action in overlay.internal_pipeline.actions if action.name == 'test-definition'][0]
        test_install = [
            action for action in testdef.internal_pipeline.actions
            if action.name == 'test-install-overlay'][0]
        self.assertIsNotNone(test_install)
        yaml_file = os.path.join(os.path.dirname(__file__), './testdefs/install.yaml')
        self.assertTrue(os.path.exists(yaml_file))
        with open(yaml_file, 'r') as test_file:
            testdef = yaml.safe_load(test_file)
        repos = testdef['install'].get('git-repos', [])
        self.assertIsNotNone(repos)
        self.assertIsInstance(repos, list)
        for repo in repos:
            self.assertIsNotNone(repo)
        runner_path = tempfile.mkdtemp()
        test_install.install_git_repos(testdef, runner_path)
        shutil.rmtree(runner_path)
예제 #23
0
    def test_kvm_simulation(self):  # pylint: disable=too-many-statements
        """
        Build a pipeline which simulates a KVM LAVA job
        without using the formal objects (to avoid validating
        data known to be broken). The details are entirely
        arbitrary.
        """
        factory = Factory()
        job = factory.create_kvm_job('sample_jobs/kvm.yaml')
        pipe = Pipeline()
        action = Action()
        action.name = "deploy_linaro_image"
        action.description = "deploy action using preset subactions in an internal pipe"
        action.summary = "deploy_linaro_image"
        action.job = job
        # deliberately unlikely location
        # a successful validation would need to use the cwd
        action.parameters = {
            "image": "file:///none/images/bad-kvm-debian-wheezy.img"
        }
        pipe.add_action(action)
        self.assertEqual(action.level, "1")
        deploy_pipe = Pipeline(action)
        action = Action()
        action.name = "downloader"
        action.description = "download image wrapper, including an internal retry pipe"
        action.summary = "downloader"
        action.job = job
        deploy_pipe.add_action(action)
        self.assertEqual(action.level, "1.1")
        # a formal RetryAction would contain a pre-built pipeline which can be inserted directly
        retry_pipe = Pipeline(action)
        action = Action()
        action.name = "wget"
        action.description = "do the download with retries"
        action.summary = "wget"
        action.job = job
        retry_pipe.add_action(action)
        self.assertEqual(action.level, "1.1.1")
        action = Action()
        action.name = "checksum"
        action.description = "checksum the downloaded file"
        action.summary = "md5sum"
        action.job = job
        deploy_pipe.add_action(action)
        self.assertEqual(action.level, "1.2")
        action = Action()
        action.name = "overlay"
        action.description = "apply lava overlay"
        action.summary = "overlay"
        action.job = job
        deploy_pipe.add_action(action)
        self.assertEqual(action.level, "1.3")
        action = Action()
        action.name = "boot"
        action.description = "boot image"
        action.summary = "qemu"
        action.job = job
        # cmd_line built from device configuration
        action.parameters = {
            'cmd_line': [
                'qemu-system-x86_64', '-machine accel=kvm:tcg',
                '-hda'
                '%s' % "tbd", '-nographic', '-net', 'nic,model=virtio'
                '-net user'
            ]
        }
        pipe.add_action(action)
        self.assertEqual(action.level, "2")

        action = Action()
        action.name = "simulated"
        action.description = "lava test shell"
        action.summary = "simulated"
        action.job = job
        # a formal lava test shell action would include an internal pipe
        # which would handle the run.sh
        pipe.add_action(action)
        self.assertEqual(action.level, "3")
        # just a fake action
        action = Action()
        action.name = "fake"
        action.description = "faking results"
        action.summary = "fake action"
        action.job = job
        pipe.add_action(action)
        self.assertEqual(action.level, "4")
        self.assertEqual(len(pipe.describe()), 4)
예제 #24
0
 def setUp(self):
     super(TestDefinitionRepeat, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job("sample_jobs/kvm-multi.yaml")
예제 #25
0
 def setUp(self):
     super(TestKvmUefi, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job('sample_jobs/kvm-uefi.yaml',
                                       mkdtemp())
예제 #26
0
 def setUp(self):
     super(TestCommand, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job('sample_jobs/kvm-command.yaml',
                                       mkdtemp())
예제 #27
0
 def setUp(self):
     super(TestChecksum, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job('sample_jobs/kvm-inline.yaml', mkdtemp())
예제 #28
0
 def setUp(self):
     super(TestDefinitionSimple, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job("sample_jobs/kvm-notest.yaml")
예제 #29
0
 def setUp(self):
     super(TestMonitor, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job('sample_jobs/qemu-monitor.yaml', mkdtemp())
예제 #30
0
 def setUp(self):
     super(TestDefinitionParams, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job("sample_jobs/kvm-params.yaml")
예제 #31
0
 def setUp(self):
     super(TestKVMDownloadLocalDeploy, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job('sample_jobs/kvm-local.yaml', mkdtemp())
예제 #32
0
 def setUp(self):
     super(TestDefinitionRepeat, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job("sample_jobs/kvm-multi.yaml")
예제 #33
0
    def test_kvm_simulation(self):  # pylint: disable=too-many-statements
        """
        Build a pipeline which simulates a KVM LAVA job
        without using the formal objects (to avoid validating
        data known to be broken). The details are entirely
        arbitrary.
        """
        factory = Factory()
        job = factory.create_kvm_job('sample_jobs/kvm.yaml')
        pipe = Pipeline()
        action = Action()
        action.name = "deploy_linaro_image"
        action.description = "deploy action using preset subactions in an internal pipe"
        action.summary = "deploy_linaro_image"
        action.job = job
        # deliberately unlikely location
        # a successful validation would need to use the cwd
        action.parameters = {"image": "file:///none/images/bad-kvm-debian-wheezy.img"}
        pipe.add_action(action)
        self.assertEqual(action.level, "1")
        deploy_pipe = Pipeline(action)
        action = Action()
        action.name = "downloader"
        action.description = "download image wrapper, including an internal retry pipe"
        action.summary = "downloader"
        action.job = job
        deploy_pipe.add_action(action)
        self.assertEqual(action.level, "1.1")
        # a formal RetryAction would contain a pre-built pipeline which can be inserted directly
        retry_pipe = Pipeline(action)
        action = Action()
        action.name = "wget"
        action.description = "do the download with retries"
        action.summary = "wget"
        action.job = job
        retry_pipe.add_action(action)
        self.assertEqual(action.level, "1.1.1")
        action = Action()
        action.name = "checksum"
        action.description = "checksum the downloaded file"
        action.summary = "md5sum"
        action.job = job
        deploy_pipe.add_action(action)
        self.assertEqual(action.level, "1.2")
        action = Action()
        action.name = "overlay"
        action.description = "apply lava overlay"
        action.summary = "overlay"
        action.job = job
        deploy_pipe.add_action(action)
        self.assertEqual(action.level, "1.3")
        action = Action()
        action.name = "boot"
        action.description = "boot image"
        action.summary = "qemu"
        action.job = job
        # cmd_line built from device configuration
        action.parameters = {
            'cmd_line': [
                'qemu-system-x86_64',
                '-machine accel=kvm:tcg',
                '-hda'
                '%s' % "tbd",
                '-nographic',
                '-net',
                'nic,model=virtio'
                '-net user'
            ]
        }
        pipe.add_action(action)
        self.assertEqual(action.level, "2")

        action = Action()
        action.name = "simulated"
        action.description = "lava test shell"
        action.summary = "simulated"
        action.job = job
        # a formal lava test shell action would include an internal pipe
        # which would handle the run.sh
        pipe.add_action(action)
        self.assertEqual(action.level, "3")
        # just a fake action
        action = Action()
        action.name = "fake"
        action.description = "faking results"
        action.summary = "fake action"
        action.job = job
        pipe.add_action(action)
        self.assertEqual(action.level, "4")
        self.assertEqual(len(pipe.describe()), 4)
예제 #34
0
 def setUp(self):
     super(TestDefinitionHandlers, self).setUp()
     factory = Factory()
     self.job = factory.create_kvm_job("sample_jobs/kvm.yaml")