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

Eliminate duplicate list of test suites to run #2844

Merged
merged 3 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion tests_e2e/orchestrator/runbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ variable:
#
# The test suites to execute
- name: test_suites
value: "agent_bvt, no_outbound_connections, extensions_disabled, agent_not_provisioned, fips"
value: "agent_bvt, no_outbound_connections, extensions_disabled, agent_not_provisioned, agent_update, fips"
- name: cloud
value: "AzureCloud"
is_case_visible: true
Expand Down
11 changes: 7 additions & 4 deletions tests_e2e/pipeline/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@
#

parameters:
#
# See the test wiki for a description of the parameters
- name: test_suites
displayName: Test Suites
type: string
default: agent_bvt, no_outbound_connections, extensions_disabled, agent_not_provisioned, agent_update, fips
#
# NOTES:
# * 'image', 'location' and 'vm_size' override any values in the test suites/images definition
# files. Those parameters are useful for 1-off tests, like testing a VHD or checking if
# an image is supported in a particular location.
# * Azure Pipelines do not allow empty string for the parameter value, using "-" instead.
#
- name: test_suites
displayName: Test Suites (comma-separated list of test suites to run)
type: string
default: "-"

- name: image
displayName: Image (image/image set name, URN, or VHD)
type: string
Expand Down
9 changes: 7 additions & 2 deletions tests_e2e/pipeline/scripts/execute_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ docker pull waagenttests.azurecr.io/waagenttests:latest

# Azure Pipelines does not allow an empty string as the value for a pipeline parameter; instead we use "-" to indicate
# an empty value. Change "-" to "" for the variables that capture the parameter values.
if [[ $TEST_SUITES == "-" ]]; then
TEST_SUITES="" # Don't set the test_suites variable
else
TEST_SUITES="-v test_suites:\"$TEST_SUITES\""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these values pulled from runbook? does this mean when we go to do a manual pipeline run, the default value will be "-" and we'll need to manually list each test suite we want to run?

Copy link
Member Author

@narrieta narrieta Jun 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The runbook has a variable with the default list of tests:

  # The test suites to execute
  - name: test_suites
    value: "agent_bvt, no_outbound_connections, extensions_disabled, agent_not_provisioned, agent_update, fips"

"-" is only for the pipeline (Azure Pipelines does not allow empty string for the default value of pipeline parameters).

Then the script (execute_tests.sh, which is used only by the pipeline) changes the value to empty string so the script won't override the runbook variable when invoking LISA.

When starting a pipeline run manually, one can set the test suite to FOO (just as before), and in that case execute_tests.sh will override the runbook variable with FOO (just as before).

Runs from dev machines are not affected by this change.

fi
if [[ $IMAGE == "-" ]]; then
IMAGE=""
fi
Expand Down Expand Up @@ -69,13 +74,13 @@ docker run --rm \
-v cloud:$CLOUD \
-v subscription_id:$SUBSCRIPTION_ID \
-v identity_file:\$HOME/.ssh/id_rsa \
-v test_suites:\"$TEST_SUITES\" \
-v log_path:\$HOME/logs \
-v collect_logs:\"$COLLECT_LOGS\" \
-v keep_environment:\"$KEEP_ENVIRONMENT\" \
-v image:\"$IMAGE\" \
-v location:\"$LOCATION\" \
-v vm_size:\"$VM_SIZE\"" \
-v vm_size:\"$VM_SIZE\" \
$TEST_SUITES" \
|| echo "exit $?" > /tmp/exit.sh

#
Expand Down
6 changes: 3 additions & 3 deletions tests_e2e/test_suites/no_outbound_connections.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ name: "NoOutboundConnections"
tests:
- source: "no_outbound_connections/check_no_outbound_connections.py"
blocks_suite: true # If the NSG is not setup correctly, there is no point in executing the rest of the tests.
- "bvts/extension_operations.py"
- "bvts/run_command.py"
- "bvts/vm_access.py"
- "agent_bvt/extension_operations.py"
- "agent_bvt/run_command.py"
- "agent_bvt/vm_access.py"
- "no_outbound_connections/check_fallback_to_hgap.py"
images: "random(endorsed)"
template: "no_outbound_connections/template.py"
Expand Down