Skip to content

Commit 5a3bc1f

Browse files
authored
Skip tests requiring a scale set when using a VHD (#3582)
1 parent b752690 commit 5a3bc1f

2 files changed

Lines changed: 32 additions & 14 deletions

File tree

tests_e2e/orchestrator/lib/agent_test_result.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,29 @@
2020

2121
# Disable those warnings, since 'lisa' is an external, non-standard, dependency
2222
# E0401: Unable to import 'lisa' (import-error)
23-
# etc
24-
from lisa import ( # pylint: disable=E0401
25-
notifier
26-
)
23+
from lisa import notifier # pylint: disable=E0401
2724
from lisa.messages import TestStatus, TestResultMessage # pylint: disable=E0401
25+
26+
from typing import Optional
27+
2828
from azurelinuxagent.common.future import UTC
2929

3030

31+
class AgentTestResultMessage(TestResultMessage):
32+
def __init__(self, suite_name: str, test_name: str, status: TestStatus):
33+
super().__init__()
34+
self.type: str = "AgentTestResultMessage"
35+
self.id_: str = str(uuid.uuid4())
36+
self.status: TestStatus = status
37+
self.suite_full_name: str = suite_name
38+
self.suite_name: str = suite_name
39+
self.full_name: str = test_name
40+
self.name: str = test_name
41+
self.elapsed: float = 0
42+
self.message: str = ""
43+
self.stacktrace: Optional[str] = None
44+
45+
3146
class AgentTestResult:
3247
@staticmethod
3348
def report(
@@ -42,15 +57,7 @@ def report(
4257
Reports a test result to the junit notifier
4358
"""
4459
# The junit notifier requires an initial RUNNING message in order to register the test in its internal cache.
45-
msg: TestResultMessage = TestResultMessage()
46-
msg.type = "AgentTestResultMessage"
47-
msg.id_ = str(uuid.uuid4())
48-
msg.status = TestStatus.RUNNING
49-
msg.suite_full_name = suite_name
50-
msg.suite_name = msg.suite_full_name
51-
msg.full_name = test_name
52-
msg.name = msg.full_name
53-
msg.elapsed = 0
60+
msg: AgentTestResultMessage = AgentTestResultMessage(suite_name, test_name, TestStatus.RUNNING)
5461

5562
notifier.notify(msg)
5663

tests_e2e/orchestrator/lib/agent_test_suite_combinator.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ def create_environment_list(self, test_suites: List[str]) -> List[Dict[str, Any]
154154

155155
runbook_images = self._get_runbook_images(loader)
156156

157+
all_suites_require_vmss = all(s.executes_on_scale_set for s in loader.test_suites)
158+
157159
skip_test_suites: List[str] = []
158160
skip_test_suites_images: List[Tuple[str, str]] = []
159161
for test_suite_info in loader.test_suites:
@@ -190,7 +192,16 @@ def create_environment_list(self, test_suites: List[str]) -> List[Dict[str, Any]
190192
shared_gallery = ""
191193

192194
if test_suite_info.executes_on_scale_set and (vhd != "" or shared_gallery != ""):
193-
raise Exception("VHDS and images from galleries are currently not supported on scale sets.")
195+
if all_suites_require_vmss:
196+
raise Exception("VHDs and images from galleries are currently not supported on scale sets")
197+
198+
AgentTestResult.report(
199+
f"{test_suite_info.name}-{image_name}",
200+
test_suite_info.name,
201+
TestStatus.SKIPPED,
202+
datetime.datetime.now(datetime.timezone.utc),
203+
message="VHDs and images from galleries are currently not supported on scale sets.")
204+
continue
194205

195206
vm_size = self._get_vm_size(image)
196207

0 commit comments

Comments
 (0)