Ejemplo n.º 1
0
    def setUpClass(cls):
        TestCase.setUpClass()
        manager.eon.db = mock.MagicMock()
        manager.rpcapi = mock.MagicMock()
        cls.manager = manager.ResourceManager()
        cls.context = "context"
        cls.resource_type = "vmware"

        cls.db_resource_mgr = mock.MagicMock()
        cls.db_resource = mock.MagicMock()
        cls.db_resource_mgrs = [
            cls.db_resource_mgr,
        ]
        cls.db_resources = [
            cls.db_resource,
        ]

        cls.db_resource_mgr_pty = {
            "key": "vcenter_uuid",
            "value": "vcenter-123",
            "id": "123",
        }
        cls.db_resource_ptys = [
            cls.db_resource_mgr_pty,
        ]
        cls.data_without_meta = {
            "name": "vcenter1",
            "port": "443",
            "ip_address": "10.1.192.98",
            "username": "******",
            "password": "******",
            "type": "vmware",
        }
        cls.data = cls._get_data()
 def setUp(self):
     self.builder = jenkins_jobs.builder.Builder(
         'http://jenkins.example.com',
         'doesnot', 'matter',
         plugins_list=['plugin1', 'plugin2'],
     )
     TestCase.setUp(self)
Ejemplo n.º 3
0
 def setUp(self):
     self.builder = jenkins_jobs.builder.Builder(
         'http://jenkins.example.com',
         'doesnot', 'matter',
         plugins_list=['plugin1', 'plugin2'],
     )
     TestCase.setUp(self)
Ejemplo n.º 4
0
 def setUp(self):
     TestCase.setUp(self)
     out = StringIO()
     out.writelines(["Q1,373,string,Universe\n",
                     "Q1,31,wikibase-entityid,Q223557\n",
                     "Q1,31,wikibase-entityid,Q1088088\n"])
     out.seek(0)
     self.result = list(CsvReader.read_csv(out))
Ejemplo n.º 5
0
def on_test_case_retry_exception(attempt: RetryAttempt,
                                 test_case: testtools.TestCase,
                                 *_args, **_kwargs):
    # pylint: disable=protected-access
    _exception.check_valid_type(test_case, testtools.TestCase)
    test_case._report_traceback(sys.exc_info(),
                                f"traceback[attempt={attempt.number}]")
    LOG.exception("Re-run test after failed attempt. "
                  f"(attempt={attempt.number}, test='{test_case.id()}')")
Ejemplo n.º 6
0
 def setUp(self):
     TestCase.setUp(self)
     out = StringIO()
     out.writelines([
         "Q1,373,string,Universe\n", "Q1,31,wikibase-entityid,Q223557\n",
         "Q1,31,wikibase-entityid,Q1088088\n"
     ])
     out.seek(0)
     self.result = list(CsvReader.read_csv(out))
Ejemplo n.º 7
0
 def setUp(self):
     TestCase.setUp(self)
     self.result = [
         Entity("Q1", [
             Claim(373, "string", "Universe"),
             Claim(31, "wikibase-entityid", "Q223557"),
             Claim(31, "wikibase-entityid", "Q1088088")
         ])
     ]
Ejemplo n.º 8
0
 def setUp(self):
     self.yaml_fn = os.path.join(os.path.dirname(__file__), 'job.yaml')
     self.xml_fn = os.path.join(os.path.dirname(__file__), 'job.xml')
     self.builder = jenkins_jobs.builder.Builder(
         'http://jenkins.example.com',
         'doesnot', 'matter',
         plugins_list=[],
     )
     TestCase.setUp(self)
Ejemplo n.º 9
0
 def setUp(self):
     self.yaml_fn = os.path.join(os.path.dirname(__file__), 'job.yaml')
     self.xml_fn = os.path.join(os.path.dirname(__file__), 'job.xml')
     self.builder = jenkins_jobs.builder.Builder(
         'http://jenkins.example.com',
         'doesnot',
         'matter',
         plugins_list=[],
     )
     TestCase.setUp(self)
Ejemplo n.º 10
0
    def setUpClass(cls):
        TestCase.setUpClass()

        cls.ip = "10.1.8.8"
        cls.port = "5985"
        cls.username = "******"
        cls.password = "******"

        cls.ps_script = "ls"
        cls.cmd_script = "dir"

        cls.cmd_output_tuple = ("std_out", "std_err", 0)
        cls.connection_err = \
            "Connection fail OR WinRM not properly configured..."
Ejemplo n.º 11
0
def wait_no_exception(lfunction, exc_class=None, exc_matcher=None):
    """Stops waiting on success."""
    start_time = time.time()
    if exc_matcher is not None:
        exc_class = boto.exception.BotoServerError

    if exc_class is None:
        exc_class = BaseException
    while True:
        result = None
        try:
            result = lfunction()
            LOG.info('No Exception in %d second', time.time() - start_time)
            return result
        except exc_class as exc:
            if exc_matcher is not None:
                res = exc_matcher.match(exc)
                if res is not None:
                    LOG.info(res)
                    raise exc
        # Let the other exceptions propagate
        dtime = time.time() - start_time
        if dtime > default_timeout:
            raise TestCase.failureException("Wait timeout exceeded! (%ds)" %
                                            dtime)
        time.sleep(default_check_interval)
Ejemplo n.º 12
0
def wait_no_exception(lfunction, exc_class=None, exc_matcher=None):
    """Stops waiting on success."""
    start_time = time.time()
    if exc_matcher is not None:
        exc_class = boto.exception.BotoServerError

    if exc_class is None:
        exc_class = BaseException
    while True:
        result = None
        try:
            result = lfunction()
            LOG.info('No Exception in %d second',
                     time.time() - start_time)
            return result
        except exc_class as exc:
            if exc_matcher is not None:
                res = exc_matcher.match(exc)
                if res is not None:
                    LOG.info(res)
                    raise exc
        # Let the other exceptions propagate
        dtime = time.time() - start_time
        if dtime > CONF.boto.build_timeout:
            raise TestCase.failureException("Wait timeout exceeded! (%ds)" %
                                            dtime)
        time.sleep(CONF.boto.build_interval)
Ejemplo n.º 13
0
def state_wait(lfunction, final_set=set(), valid_set=None):
    #TODO(afazekas): evaluate using ABC here
    if not isinstance(final_set, set):
        final_set = set((final_set, ))
    if not isinstance(valid_set, set) and valid_set is not None:
        valid_set = set((valid_set, ))
    start_time = time.time()
    old_status = status = lfunction()
    while True:
        if status != old_status:
            LOG.info('State transition "%s" ==> "%s" %d second', old_status,
                     status,
                     time.time() - start_time)
        if status in final_set:
            return status
        if valid_set is not None and status not in valid_set:
            return status
        dtime = time.time() - start_time
        if dtime > default_timeout:
            raise TestCase.failureException("State change timeout exceeded!"
                                            '(%ds) While waiting'
                                            'for %s at "%s"' %
                                            (dtime, final_set, status))
        time.sleep(default_check_interval)
        old_status = status
        status = lfunction()
Ejemplo n.º 14
0
def state_wait(lfunction, final_set=set(), valid_set=None):
    # TODO(afazekas): evaluate using ABC here
    if not isinstance(final_set, set):
        final_set = set((final_set,))
    if not isinstance(valid_set, set) and valid_set is not None:
        valid_set = set((valid_set,))
    start_time = time.time()
    old_status = status = lfunction()
    while True:
        if status != old_status:
            LOG.info('State transition "%s" ==> "%s" %d second', old_status,
                     status, time.time() - start_time)
        if status in final_set:
            return status
        if valid_set is not None and status not in valid_set:
            return status
        dtime = time.time() - start_time
        if dtime > CONF.boto.build_timeout:
            raise TestCase.failureException("State change timeout exceeded!"
                                            '(%ds) While waiting'
                                            'for %s at "%s"' %
                                            (dtime, final_set, status))
        time.sleep(CONF.boto.build_interval)
        old_status = status
        status = lfunction()
Ejemplo n.º 15
0
def wait_exception(lfunction):
    """Returns with the exception or raises one."""
    start_time = time.time()
    while True:
        try:
            lfunction()
        except BaseException as exc:
            LOG.info('Exception in %d second', time.time() - start_time)
            return exc
        dtime = time.time() - start_time
        if dtime > default_timeout:
            raise TestCase.failureException("Wait timeout exceeded! (%ds)" %
                                            dtime)
        time.sleep(default_check_interval)
Ejemplo n.º 16
0
def wait_exception(lfunction):
    """Returns with the exception or raises one."""
    start_time = time.time()
    while True:
        try:
            lfunction()
        except BaseException as exc:
            LOG.info('Exception in %d second',
                     time.time() - start_time)
            return exc
        dtime = time.time() - start_time
        if dtime > CONF.boto.build_timeout:
            raise TestCase.failureException("Wait timeout exceeded! (%ds)" %
                                            dtime)
        time.sleep(CONF.boto.build_interval)
Ejemplo n.º 17
0
def re_search_wait(lfunction, regexp):
    """Stops waiting on success."""
    start_time = time.time()
    while True:
        text = lfunction()
        result = re.search(regexp, text)
        if result is not None:
            LOG.info('Pattern "%s" found in %d second in "%s"', regexp,
                     time.time() - start_time, text)
            return result
        dtime = time.time() - start_time
        if dtime > default_timeout:
            raise TestCase.failureException('Pattern find timeout exceeded!'
                                            '(%ds) While waiting for'
                                            '"%s" pattern in "%s"' %
                                            (dtime, regexp, text))
        time.sleep(default_check_interval)
Ejemplo n.º 18
0
def re_search_wait(lfunction, regexp):
    """Stops waiting on success."""
    start_time = time.time()
    while True:
        text = lfunction()
        result = re.search(regexp, text)
        if result is not None:
            LOG.info('Pattern "%s" found in %d second in "%s"',
                     regexp,
                     time.time() - start_time,
                     text)
            return result
        dtime = time.time() - start_time
        if dtime > CONF.boto.build_timeout:
            raise TestCase.failureException('Pattern find timeout exceeded!'
                                            '(%ds) While waiting for'
                                            '"%s" pattern in "%s"' %
                                            (dtime, regexp, text))
        time.sleep(CONF.boto.build_interval)
Ejemplo n.º 19
0
 def setUp(self):
     TestCase.setUp(self)
     self._result_calls = []
     self.test = TestAddCleanup.LoggingTest('runTest')
     self.logging_result = LoggingResult(self._result_calls)
Ejemplo n.º 20
0
 def setUp(self):
     TestCase.setUp(self)
     manager.eon.db = mock.MagicMock()
     self.mocked_obj = mock.Mock()
Ejemplo n.º 21
0
 def tearDown(self):
     self._calls.append('tearDown')
     TestCase.tearDown(self)
Ejemplo n.º 22
0
 def setUp(self):
     TestCase.setUp(self)
     raise self.skipException("skipping this test")
Ejemplo n.º 23
0
 def tearDownClass(cls):
     TestCase.tearDownClass()
Ejemplo n.º 24
0
 def setUp(self):
     TestCase.setUp(self)
     with gzip.open(resource_filename(__name__, "Wikidata-Q1.xml.gz"), "r") as f:
         self.result = list(XmlReader.read_xml(f))
 def setUp(self):
     TestCase.setUp(self)
     self.result = [Entity("Q1", [Claim(373, "string", "Universe"),
                                  Claim(31, "wikibase-entityid", "Q223557"),
                                  Claim(31, "wikibase-entityid", "Q1088088")])]
Ejemplo n.º 26
0
 def setUp(self):
     TestCase.setUp(self)
     self.data = {"testcase": {"test-level": 1}}
Ejemplo n.º 27
0
 def setUp(self):
     TestCase.setUp(self)
     self.dbname = self._testMethodName
     self.db = CouchDatabase(self.dbname, create=True)
     self.record_type = "test_record_type"
Ejemplo n.º 28
0
 def tearDown(self):
     self._calls.append('tearDown')
     TestCase.tearDown(self)
Ejemplo n.º 29
0
 def setUp(self):
     TestCase.setUp(self)
     self._calls = ['setUp']
Ejemplo n.º 30
0
 def test_nonIdenticalInUnequal(self):
     # TestCase's are not equal if they are not identical.
     self.assertNotEqual(TestCase(methodName='run'),
         TestCase(methodName='skip'))
Ejemplo n.º 31
0
 def setUp(self):
     TestCase.setUp(self)
     ResourcedTestCase.setUp(self)
Ejemplo n.º 32
0
 def setUp(self):
     TestCase.setUp(self)
     with gzip.open(resource_filename(__name__, "Wikidata-Q1.xml.gz"),
                    "r") as f:
         self.result = list(XmlReader.read_xml(f))
Ejemplo n.º 33
0
 def setUp(self):
     TestCase.setUp(self)
     manager.manager = mock.MagicMock()
     manager.greenpool = mock.MagicMock()
     self.context = "context"
     self.manager = manager.ConductorManager("host", "topic")
Ejemplo n.º 34
0
 def setUp(self):
     TestCase.setUp(self)
     self.skip("skipping this test")
Ejemplo n.º 35
0
 def tearDown(self):
     """tear down each test"""
     TestCase.tearDown(self)
     #delete the database
     del self.db._server[self.dbname]
Ejemplo n.º 36
0
 def setUp(self):
     TestCase.setUp(self)
     raise self.skipException("skipping this test")
Ejemplo n.º 37
0
 def _skipper(*args, **kw):
     """Wrapped skipper function."""
     testobj = args[0]
     if not getattr(testobj, self.attr, False):
         raise TestCase.skipException(self.message)
     func(*args, **kw)
Ejemplo n.º 38
0
 def setUp(self):
     TestCase.setUp(self)
     self.data = {"a": {"b": {"c": "d"}, "e": "f"}}
Ejemplo n.º 39
0
 def setUp(self):
     TestCase.setUp(self)
     message_notifier.notifier = TestNotifier()
     global NOTIFICATIONS
     self.notifications = NOTIFICATIONS = []
Ejemplo n.º 40
0
 def setUp(self):
     TestCase.setUp(self)
     self.data = {"testcase": {"test-level": 1}}
Ejemplo n.º 41
0
 def tearDown(self):
     ResourcedTestCase.tearDown(self)
     TestCase.tearDown(self)
Ejemplo n.º 42
0
 def setUp(self):
     TestCase.setUp(self)
     result = testresources._get_result()
     testresources.setUpResources(self, self.resources, result)
     self.addCleanup(
         testresources.tearDownResources, self, self.resources, result)
Ejemplo n.º 43
0
 def tearDown(self):
     TestCase.tearDown(self)
Ejemplo n.º 44
0
 def tearDown(self):
     self._calls.append("tearDown")
     TestCase.tearDown(self)
Ejemplo n.º 45
0
 def setUp(self):
     TestCase.setUp(self)
     self.skip("skipping this test")
Ejemplo n.º 46
0
 def __init__(self, *args, **kwargs):
     TestCase.__init__(self, *args, **kwargs)
     self._workdir = None
     self._environ_restore = None
Ejemplo n.º 47
0
 def setUp(self):
     TestCase.setUp(self)
     self._calls = ['setUp']
 def setUp(self):
     TestCase.setUp(self)
Ejemplo n.º 49
0
 def setUp(self):
     TestCase.setUp(self)
     self._result_calls = []
     self.test = TestAddCleanup.LoggingTest('runTest')
     self.logging_result = LoggingResult(self._result_calls)
Ejemplo n.º 50
0
 def setUp(self):
     TestCase.setUp(self)
     self.file = StringIO()
Ejemplo n.º 51
0
 def __init__(self, *args, **kwargs):
     TestCase.__init__(self, *args, **kwargs)
     self._workdir = None
     self._environ_restore = None
Ejemplo n.º 52
0
 def setUp(self):
     TestCase.setUp(self)
Ejemplo n.º 53
0
 def setUp(self):
     TestCase.setUp(self)
     self._calls = ["setUp"]
Ejemplo n.º 54
0
 def setUp(self):
     TestCase.setUp(self)
     self.data = {"a": {"b": {"c": "d"}, "e": "f"}}