Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
maddieford committed May 19, 2023
2 parents fb03e07 + 3d713a2 commit 6a8e0d6
Show file tree
Hide file tree
Showing 13 changed files with 243 additions and 158 deletions.
23 changes: 14 additions & 9 deletions azurelinuxagent/common/rdma.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,28 +419,33 @@ def update_iboip_interfaces(self, mac_ip_array):

@staticmethod
def update_iboip_interface(ipv4_addr, timeout_sec, check_interval_sec):
logger.info("Wait for ib0 become available")
logger.info("Wait for ib become available")
total_retries = timeout_sec / check_interval_sec
n = 0
found_ib0 = None
while not found_ib0 and n < total_retries:
found_ib = None
while not found_ib and n < total_retries:
ret, output = shellutil.run_get_output("ifconfig -a")
if ret != 0:
raise Exception("Failed to list network interfaces")
found_ib0 = re.search("ib0", output, re.IGNORECASE)
if found_ib0:
found_ib = re.search(r"(ib\S+):", output, re.IGNORECASE)
if found_ib:
break
time.sleep(check_interval_sec)
n += 1

if not found_ib0:
raise Exception("ib0 is not available")
if not found_ib:
raise Exception("ib is not available")

ibname = found_ib.groups()[0]
if shellutil.run("ifconfig {0} up".format(ibname)) != 0:
raise Exception("Could not run ifconfig {0} up".format(ibname))

netmask = 16
logger.info("RDMA: configuring IPv4 addr and netmask on ipoib interface")
addr = '{0}/{1}'.format(ipv4_addr, netmask)
if shellutil.run("ifconfig ib0 {0}".format(addr)) != 0:
raise Exception("Could set addr to {0} on ib0".format(addr))
if shellutil.run("ifconfig {0} {1}".format(ibname, addr)) != 0:
raise Exception("Could not set addr to {0} on {1}".format(addr, ibname))

logger.info("RDMA: ipoib address and netmask configured on interface")

@staticmethod
Expand Down
17 changes: 16 additions & 1 deletion tests_e2e/orchestrator/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,25 @@ RUN \
# \
groupadd waagent && \
useradd --shell /bin/bash --create-home -g waagent waagent && \
\
# \
# Install the Azure CLI \
# \
apt-get install ca-certificates curl apt-transport-https lsb-release gnupg && \
mkdir -p /etc/apt/keyrings && \
curl -sLS https://packages.microsoft.com/keys/microsoft.asc \
| gpg --dearmor \
| tee /etc/apt/keyrings/microsoft.gpg > /dev/null && \
chmod go+r /etc/apt/keyrings/microsoft.gpg && \
AZ_REPO=$(lsb_release -cs) && \
echo "deb [arch=`dpkg --print-architecture` signed-by=/etc/apt/keyrings/microsoft.gpg] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" \
| tee /etc/apt/sources.list.d/azure-cli.list && \
apt-get update && \
apt-get install azure-cli && \
:

#
# Do the Poetry and LISA setup as waagent
# Install LISA as user waagent
#
USER waagent

Expand Down
14 changes: 10 additions & 4 deletions tests_e2e/orchestrator/lib/agent_junit.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from lisa.messages import ( # pylint: disable=E0401
MessageBase,
TestResultMessage,
TestStatus
)


Expand All @@ -48,19 +49,24 @@ def type_schema(cls) -> Type[schema.TypedSchema]:
return AgentJUnitSchema

def _received_message(self, message: MessageBase) -> None:
# The Agent sends its own TestResultMessage and marks them as "AgentTestResultMessage"; for the
# test results sent by LISA itself, we change the suite name to "_Runbook_" in order to separate them
# from actual test results.
# The Agent sends its own TestResultMessages setting their type as "AgentTestResultMessage".
# Any other message types are sent by LISA.
if isinstance(message, TestResultMessage) and message.type != "AgentTestResultMessage":
if "Unexpected error in AgentTestSuite" in message.message:
# Ignore these errors, they are already reported as AgentTestResultMessages
return
# Change the suite name to "_Runbook_" for LISA messages in order to separate them
# from actual test results.
message.suite_full_name = "_Runbook_"
message.suite_name = message.suite_full_name
image = message.information.get('image')
if image is not None:
# NOTE: message.information['environment'] is similar to "[generated_2]" and can be correlated
# NOTE: The value of message.information['environment'] is similar to "[generated_2]" and can be correlated
# with the main LISA log to find the specific VM for the message.
message.full_name = f"{image} [{message.information['environment']}]"
message.name = message.full_name
# LISA silently skips tests on situations that should be errors (e.g. trying to create a test VM using an image that is not available).
# Mark these messages as failed so that the JUnit report shows them as errors.
if message.status == TestStatus.SKIPPED:
message.status = TestStatus.FAILED
super()._received_message(message)
7 changes: 7 additions & 0 deletions tests_e2e/orchestrator/lib/agent_test_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# limitations under the License.
#
import importlib.util
import re
# E0401: Unable to import 'yaml' (import-error)
import yaml # pylint: disable=E0401

Expand Down Expand Up @@ -118,13 +119,19 @@ def images(self) -> Dict[str, List[VmImageInfo]]:
"""
return self.__images

# Matches a reference to a random subset of images within a set with an optional count: random(<image_set>, [<count>]), e.g. random(endorsed, 3), random(endorsed)
RANDOM_IMAGES_RE = re.compile(r"random\((?P<image_set>[^,]+)(\s*,\s*(?P<count>\d+))?\)")

def _validate(self):
"""
Performs some basic validations on the data loaded from the YAML description files
"""
for suite in self.test_suites:
# Validate that the images the suite must run on are in images.yml
for image in suite.images:
match = AgentTestLoader.RANDOM_IMAGES_RE.match(image)
if match is not None:
image = match.group('image_set')
if image not in self.images:
raise Exception(f"Invalid image reference in test suite {suite.name}: Can't find {image} in images.yml")

Expand Down
6 changes: 2 additions & 4 deletions tests_e2e/orchestrator/lib/agent_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def _initialize(self, node: Node, variables: Dict[str, Any], lisa_working_path:

self.__context = self._Context(
vm=VmIdentifier(
cloud=self._get_required_parameter(variables, "c_cloud"),
cloud=self._get_required_parameter(variables, "cloud"),
location=self._get_required_parameter(variables, "c_location"),
subscription=node.features._platform.subscription_id,
resource_group=node_context.resource_group_name,
Expand Down Expand Up @@ -454,8 +454,6 @@ def _execute_test_suite(self, suite: TestSuiteInfo) -> bool:
suite_full_name = f"{suite_name}-{self.context.environment_name}"
suite_start_time: datetime.datetime = datetime.datetime.now()

success: bool = True # True if all the tests succeed

with _set_thread_name(suite_full_name): # The thread name is added to the LISA log
log_path: Path = self.context.log_path/f"{suite_full_name}.log"
with set_current_thread_log(log_path):
Expand Down Expand Up @@ -550,7 +548,7 @@ def _execute_test_suite(self, suite: TestSuiteInfo) -> bool:
if not suite_success:
self._mark_log_as_failed()

return success
return suite_success

def _check_agent_log(self) -> bool:
"""
Expand Down
Loading

0 comments on commit 6a8e0d6

Please sign in to comment.