Exemplo n.º 1
0
    def test_execute_tests(self):
        #NOTE: This test goes through lots of code by calling many private methods.
        #But this test does not check which code was actually executed.
        self.testrun.id = "1"
        self.executor.env = "testenvironment"
        self.executor.target = Stub_Hardware()
        self.executor.chroot = Chroot(self.testrun)

        timestamp = time.strftime("%y%m%d-%H%M%S")

        #test_package must match to string in Stub_Hardware
        test_package = "mypackage-test"

        path = os.path.join(self.workdir, "conductor",
                            self.testrun.id + "_%s" % (timestamp),
                            self.executor.env)
        expected_stdout_file = \
                os.path.join(path, "%s_testrunner_stdout.txt" % test_package)
        expected_stderr_file = \
                os.path.join(path, "%s_testrunner_stderr.txt" % test_package)
        expected_env_info_file = os.path.join(path, \
                    "%s_environment_before_testing.txt" % self.executor.target)

        #Check that files do not exist yet
        self.assertFalse(os.path.isfile(expected_stdout_file))
        self.assertFalse(os.path.isfile(expected_stderr_file))
        self.assertFalse(os.path.isfile(expected_env_info_file))

        errors = self.executor.execute_tests()  #Here's the code to be tested.

        self.assertEquals(errors, 0)

        #Check that files were created.
        self.assertTrue(os.path.isfile(expected_stdout_file))
        self.assertTrue(os.path.isfile(expected_stderr_file))
        self.assertTrue(os.path.isfile(expected_env_info_file))
Exemplo n.º 2
0
 def setUp(self):
     self.testrun = TestRunData(Options(),
                                config = _conductor_config_simple())
     self.testrun.is_chrooted = True
     self.testrun.rootstrap_path = self._fake_rootstrap_path()
     self.chroot = Chroot(self.testrun)