exception: move and rename to ResourceAwaitableException

The original name is WaitMoreResourceError.
This commit is contained in:
Chi Song 2022-08-31 12:36:09 -07:00 коммит произвёл Chi Song
Родитель deed84eb49
Коммит c5f244c9fd
5 изменённых файлов: 23 добавлений и 15 удалений

Просмотреть файл

@ -17,6 +17,7 @@ from lisa.util import (
BadEnvironmentStateException,
LisaException,
PassedException,
ResourceAwaitableException,
SkippedException,
TcpConnectionException,
UnsupportedCpuArchitectureException,
@ -39,6 +40,7 @@ __all__ = [
"Node",
"PassedException",
"RemoteNode",
"ResourceAwaitableException",
"SkippedException",
"TcpConnectionException",
"TestSuiteMetadata",

Просмотреть файл

@ -44,10 +44,6 @@ class PlatformMessage(MessageBase):
status: PlatformStatus = PlatformStatus.INITIALIZED
class WaitMoreResourceError(Exception):
pass
class Platform(subclasses.BaseClassWithRunbookMixin, InitializableMixin):
def __init__(self, runbook: schema.Platform) -> None:
super().__init__(runbook)

Просмотреть файл

@ -5,7 +5,14 @@ import copy
from functools import partial
from typing import Any, Callable, Dict, List, Optional, cast
from lisa import SkippedException, development, notifier, schema, search_space
from lisa import (
ResourceAwaitableException,
SkippedException,
development,
notifier,
schema,
search_space,
)
from lisa.action import ActionStatus
from lisa.environment import (
Environment,
@ -14,12 +21,7 @@ from lisa.environment import (
load_environments,
)
from lisa.messages import TestStatus
from lisa.platform_ import (
Platform,
PlatformMessage,
WaitMoreResourceError,
load_platform,
)
from lisa.platform_ import Platform, PlatformMessage, load_platform
from lisa.runner import BaseRunner
from lisa.testselector import select_testcases
from lisa.testsuite import TestCaseRequirement, TestResult, TestSuite
@ -305,7 +307,7 @@ class LisaRunner(BaseRunner):
assert (
environment.status == EnvironmentStatus.Deployed
), f"actual: {environment.status}"
except WaitMoreResourceError as identifier:
except ResourceAwaitableException as identifier:
self._log.info(
f"[{environment.name}] waiting for more resource: "
f"{identifier}, skip assigning case"

Просмотреть файл

@ -201,6 +201,14 @@ class NotMeetRequirementException(LisaException):
...
class ResourceAwaitableException(Exception):
"""
Wait for more resources to create environment.
"""
...
class TcpConnectionException(LisaException):
"""
This exception is used to indicate that VM can't be connected issue.

Просмотреть файл

@ -18,8 +18,8 @@ from lisa.environment import (
load_environments,
)
from lisa.feature import Feature
from lisa.platform_ import Platform, WaitMoreResourceError, load_platform
from lisa.util import plugin_manager
from lisa.platform_ import Platform, load_platform
from lisa.util import ResourceAwaitableException, plugin_manager
from lisa.util.logger import Logger
from selftests.test_environment import generate_runbook as generate_env_runbook
@ -87,7 +87,7 @@ class MockPlatform(Platform):
def _deploy_environment(self, environment: Environment, log: Logger) -> None:
if self._mock_runbook.wait_more_resource_error:
raise WaitMoreResourceError("wait more resource")
raise ResourceAwaitableException("wait more resource")
if not self._mock_runbook.deploy_success:
raise LisaException("mock deploy failed")
if self._mock_runbook.return_prepared and environment.runbook.nodes_requirement: