-
Notifications
You must be signed in to change notification settings - Fork 372
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial (bare-bones) implementation of the infrastructure for end-to-…
…end tests (#2691) * Prototype for end-to-end tests * Add agent BVT * Cleanup SSH key; delete cleanup pipeline * Delete unused references * Delete unused references - Part 2 * Remove local configuration * Remove unused references, Part 3 * Disable proxy Co-authored-by: narrieta <narrieta>
- Loading branch information
Showing
19 changed files
with
840 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
variables: | ||
- name: azureConnection | ||
value: 'AzLinux DCR Public (8e037ad4-618f-4466-8bc8-5099d41ac15b)' | ||
- name: subId | ||
value: '8e037ad4-618f-4466-8bc8-5099d41ac15b' | ||
- name: testsSourcesDirectory | ||
value: "$(Build.SourcesDirectory)/tests_e2e" | ||
|
||
trigger: | ||
- develop | ||
|
||
pr: none | ||
|
||
pool: | ||
vmImage: ubuntu-latest | ||
|
||
stages: | ||
- stage: "Execute" | ||
jobs: | ||
- template: 'templates/execute-tests.yml' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: azure | ||
extension: | ||
- "../testsuites" | ||
variable: | ||
- name: location | ||
value: "westus2" | ||
- name: subscription_id | ||
value: "" | ||
- name: resource_group_name | ||
value: "" | ||
# | ||
# Set the vm_name to run on an existing VM | ||
# | ||
- name: vm_name | ||
value: "" | ||
- name: marketplace_image | ||
value: "Canonical UbuntuServer 18.04-LTS latest" | ||
- name: vhd | ||
value: "" | ||
- name: vm_size | ||
value: "" | ||
# | ||
# Turn off deploy to run on an existing VM | ||
# | ||
- name: deploy | ||
value: true | ||
- name: keep_environment | ||
value: "no" | ||
- name: wait_delete | ||
value: false | ||
- name: user | ||
value: "waagent" | ||
- name: identity_file | ||
value: "" | ||
is_secret: true | ||
- name: admin_password | ||
value: "" | ||
is_secret: true | ||
- name: proxy_host | ||
value: "" | ||
- name: proxy_user | ||
value: "" | ||
- name: proxy_identity_file | ||
value: "" | ||
is_secret: true | ||
notifier: | ||
- type: html | ||
- type: env_stats | ||
platform: | ||
- type: azure | ||
admin_username: $(user) | ||
admin_private_key_file: $(identity_file) | ||
admin_password: $(admin_password) | ||
keep_environment: $(keep_environment) | ||
azure: | ||
resource_group_name: $(resource_group_name) | ||
deploy: $(deploy) | ||
subscription_id: $(subscription_id) | ||
wait_delete: $(wait_delete) | ||
requirement: | ||
core_count: | ||
min: 2 | ||
azure: | ||
marketplace: "$(marketplace_image)" | ||
vhd: $(vhd) | ||
location: $(location) | ||
name: $(vm_name) | ||
vm_size: $(vm_size) | ||
|
||
testcase: | ||
- criteria: | ||
area: bvt | ||
|
||
# | ||
# Set to do SSH proxy jumps | ||
# | ||
#dev: | ||
# mock_tcp_ping: True | ||
# jump_boxes: | ||
# - private_key_file: $(proxy_identity_file) | ||
# address: $(proxy_host) | ||
# username: $(proxy_user) |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env python | ||
|
||
from __future__ import print_function | ||
|
||
import subprocess | ||
import sys | ||
|
||
|
||
def main(): | ||
print("Executing waagent --version") | ||
|
||
pipe = subprocess.Popen(['waagent', '-version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
stdout_lines = list(map(lambda s: s.decode('utf-8'), pipe.stdout.readlines())) | ||
exit_code = pipe.wait() | ||
|
||
for line in stdout_lines: | ||
print(line) | ||
|
||
return exit_code | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import argparse | ||
import os | ||
import uuid | ||
import sys | ||
|
||
from tests_e2e.scenario_utils.extensions.CustomScriptExtension import CustomScriptExtension | ||
|
||
|
||
def main(subscription_id, resource_group_name, vm_name): | ||
os.environ["VMNAME"] = vm_name | ||
os.environ['RGNAME'] = resource_group_name | ||
os.environ["SUBID"] = subscription_id | ||
os.environ["SCENARIONAME"] = "BVT" | ||
os.environ["LOCATION"] = "westus2" | ||
os.environ["ADMINUSERNAME"] = "somebody" | ||
os.environ["BUILD_SOURCESDIRECTORY"] = "/somewhere" | ||
|
||
cse = CustomScriptExtension(extension_name="testCSE") | ||
|
||
ext_props = [ | ||
cse.get_ext_props(settings={'commandToExecute': f"echo \'Hello World! {uuid.uuid4()} \'"}), | ||
cse.get_ext_props(settings={'commandToExecute': "echo \'Hello again\'"}) | ||
] | ||
|
||
cse.run(ext_props=ext_props) | ||
|
||
|
||
if __name__ == "__main__": | ||
try: | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('--subscription') | ||
parser.add_argument('--group') | ||
parser.add_argument('--vm') | ||
|
||
args = parser.parse_args() | ||
|
||
main(args.subscription, args.group, args.vm) | ||
|
||
except Exception as exception: | ||
print(str(exception)) | ||
sys.exit(1) | ||
|
||
sys.exit(0) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from assertpy import assert_that | ||
from pathlib import Path | ||
from tests_e2e.lisa.tests.agent_bvt import custom_script | ||
|
||
from lisa import ( | ||
CustomScriptBuilder, | ||
Logger, | ||
Node, | ||
simple_requirement, | ||
TestCaseMetadata, | ||
TestSuite, | ||
TestSuiteMetadata, | ||
) | ||
from lisa.sut_orchestrator.azure.common import get_node_context | ||
|
||
|
||
@TestSuiteMetadata( | ||
area="bvt", | ||
category="functional", | ||
description=""" | ||
A POC test suite for the waagent BVTs. | ||
""", | ||
requirement=simple_requirement(unsupported_os=[]), | ||
) | ||
class AgentBvt(TestSuite): | ||
@TestCaseMetadata(description="", priority=0) | ||
def check_agent_version(self, node: Node, log: Logger) -> None: | ||
script_path = CustomScriptBuilder(Path(__file__).parent.parent.joinpath("tests", "agent_bvt"), ["check_agent_version.py"]) | ||
script = node.tools[script_path] | ||
result = script.run() | ||
log.info(result.stdout) | ||
log.error(result.stderr) | ||
assert_that(result.exit_code).is_equal_to(0) | ||
|
||
@TestCaseMetadata(description="", priority=0) | ||
def custom_script(self, node: Node) -> None: | ||
node_context = get_node_context(node) | ||
subscription_id = node.features._platform.subscription_id | ||
resource_group_name = node_context.resource_group_name | ||
vm_name = node_context.vm_name | ||
custom_script.main(subscription_id, resource_group_name, vm_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# This is a list of pip packages that will be installed on both the orchestrator and the test VM | ||
# Only add the common packages here, for more specific modules, add them to the scenario itself | ||
azure-identity | ||
azure-keyvault-keys | ||
azure-mgmt-compute>=22.1.0 | ||
azure-mgmt-keyvault>=7.0.0 | ||
azure-mgmt-network>=16.0.0 | ||
azure-mgmt-resource>=15.0.0 | ||
cryptography | ||
distro | ||
junitparser | ||
msrestazure | ||
python-dotenv |
Empty file.
Oops, something went wrong.