Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Onboarding MDE for Linux to LISA #3113

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Onboard MDE for Linux to LISA
  • Loading branch information
Zeeshan Akhter committed Dec 7, 2023
commit 7577bcbf704729c5a40512ba442c00f34728a61a
30 changes: 30 additions & 0 deletions lisa/sut_orchestrator/azure/tools.py
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
# Licensed under the MIT license.

import re
import json
from pathlib import PurePath
from typing import Any, Dict, List, Optional, Tuple, Type

@@ -561,3 +562,32 @@ def get_pool_records(self, pool_id: int, force_run: bool = False) -> Dict[str, s
records[content_split[i]] = content_split[i + 1]

return records

class mdatp(Tool):
@property
def command(self) -> str:
return "mdatp"

@property
def can_install(self) -> bool:
return False

def get_result(
self,
arg: str,
json_out: bool = False,
sudo: bool = False,
) -> None:
if json_out:
arg += ' --output json'
result = self.run(
arg,
sudo=sudo,
shell=True,
)

result.assert_exit_code()
if json_out:
return json.loads(result.stdout)
return result.stdout.split()

54 changes: 54 additions & 0 deletions microsoft/testsuites/vm_extensions/mde.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import time
from typing import cast

from assertpy import assert_that
from retry import retry

from lisa import (
Logger,
Node,
TestCaseMetadata,
TestSuite,
TestSuiteMetadata,
simple_requirement,
)
from lisa.operating_system import BSD, Posix
from lisa.sut_orchestrator.azure.common import (
add_tag_for_vm,
add_user_assign_identity,
get_managed_service_identity_client,
get_node_context,
)
from lisa.sut_orchestrator.azure.features import AzureExtension
from lisa.sut_orchestrator.azure.platform_ import AzurePlatform
from lisa.sut_orchestrator.azure.tools import Azsecd
from lisa.sut_orchestrator.azure.tools import mdatp
from lisa.testsuite import TestResult
from lisa.tools import Cat, Journalctl, Service
from lisa.util import LisaException, UnsupportedDistroException


@TestSuiteMetadata(
area="vm_extension",
category="functional",
description="""
MDE Test Suite
""",
)
class MDE(TestSuite):
@TestCaseMetadata(
description="""
Verify if MDE is healthy
""",
priority=1,
requirement=simple_requirement(
#supported_features=[AzureExtension], unsupported_os=[BSD]
),
)
def verify_health(self, node: Node, log: Logger, result: TestResult) -> None:
output = node.tools[mdatp].get_result('health', json_out=True)

log.info(output)

assert_that(output['healthy']).is_equal_to(True)