def test_validateState_fails_after_retry_limit(self):
        retries = 3
        timeout = 2
        api_client = MockApiClient(retries, 'initial state', 'final state')
        storage_pool = StoragePool({'id': 'snapshot_id'})
        state = storage_pool.validateState(api_client, 'final state', timeout=timeout, interval=1)

        self.assertEqual(state, [FAIL, 'StoragePool state not transited to final state, operation timed out'])
        self.assertEqual(retries, api_client.retry_counter)
    def test_validateState_succeeds_at_retry_limit(self):
        retries = 3
        timeout = 3
        api_client = MockApiClient(retries, 'initial state', 'final state')
        storage_pool = StoragePool({'id': 'snapshot_id'})
        state = storage_pool.validateState(api_client, 'final state', timeout=timeout, interval=1)

        self.assertEqual(state, [PASS, None])
        self.assertEqual(retries, api_client.retry_counter)
Beispiel #3
0
    def test_validateState_succeeds_at_retry_limit(self):
        retries = 3
        timeout = 3
        api_client = MockApiClient(retries, 'initial state', 'final state')
        storage_pool = StoragePool({'id': 'snapshot_id'})
        state = storage_pool.validateState(api_client,
                                           'final state',
                                           timeout=timeout,
                                           interval=1)

        self.assertEqual(state, [PASS, None])
        self.assertEqual(retries, api_client.retry_counter)
Beispiel #4
0
    def test_validateState_fails_after_retry_limit(self):
        retries = 3
        timeout = 2
        api_client = MockApiClient(retries, 'initial state', 'final state')
        storage_pool = StoragePool({'id': 'snapshot_id'})
        state = storage_pool.validateState(api_client,
                                           'final state',
                                           timeout=timeout,
                                           interval=1)

        self.assertEqual(state, [
            FAIL,
            'StoragePool state not trasited to final state, operation timed out'
        ])
        self.assertEqual(retries, api_client.retry_counter)