-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add image tests for the experiments binary
- Loading branch information
Joshua Krstic
committed
Oct 25, 2023
1 parent
d4994a5
commit 700772c
Showing
7 changed files
with
95 additions
and
5 deletions.
There are no files selected for viewing
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
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
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 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
source util/read_serial.sh | ||
|
||
# This test requires the workload to run and print | ||
# corresponding messages to the serial console. | ||
SERIAL_OUTPUT=$(read_serial $2 $3) | ||
print_serial=false | ||
|
||
if echo $SERIAL_OUTPUT | grep -q "EnableTestFeatureForImage:$1" | ||
then | ||
echo "- test experiment verified $1" | ||
else | ||
echo "FAILED: experiment status expected to be $1" | ||
echo "TEST FAILED. Test experiment status expected to be $1" > /workspace/status.txt | ||
print_serial=true | ||
fi | ||
|
||
if $print_serial; then | ||
echo $SERIAL_OUTPUT | ||
fi |
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,12 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
source util/read_serial.sh | ||
|
||
# This test requires the workload to run and print | ||
# corresponding messages to the serial console. | ||
SERIAL_OUTPUT=$(read_serial $1 $2 "Launch Spec") | ||
print_serial=false | ||
|
||
if $print_serial; then | ||
echo $SERIAL_OUTPUT | ||
fi |
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,40 @@ | ||
substitutions: | ||
'_IMAGE_NAME': '' | ||
'_IMAGE_PROJECT': '' | ||
'_CLEANUP': 'true' | ||
'_VM_NAME_PREFIX': 'cs-experiments-test' | ||
'_ZONE': 'us-central1-a' | ||
'_WORKLOAD_IMAGE': 'us-west1-docker.pkg.dev/confidential-space-images-dev/cs-integ-test-images/basic-test:latest' | ||
steps: | ||
- name: 'gcr.io/cloud-builders/gcloud' | ||
id: CreateVM | ||
entrypoint: 'bash' | ||
env: | ||
- 'BUILD_ID=$BUILD_ID' | ||
args: ['create_vm.sh','-i', '${_IMAGE_NAME}', | ||
'-p', '${_IMAGE_PROJECT}', | ||
'-m', 'tee-image-reference=${_WORKLOAD_IMAGE},tee-container-log-redirect=true', | ||
'-n', '${_VM_NAME_PREFIX}-${BUILD_ID}', | ||
'-z', '${_ZONE}', | ||
] | ||
- name: 'gcr.io/cloud-builders/gcloud' | ||
id: TestExperimentTrue | ||
entrypoint: 'bash' | ||
args: ['scripts/test_experiment_value.sh', "true", '${_VM_NAME_PREFIX}-${BUILD_ID}', '${_ZONE}'] | ||
- name: 'gcr.io/cloud-builders/gcloud' | ||
id: CleanUp | ||
entrypoint: 'bash' | ||
env: | ||
- 'CLEANUP=$_CLEANUP' | ||
args: ['cleanup.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}', '${_ZONE}'] | ||
# Must come after cleanup. | ||
- name: 'gcr.io/cloud-builders/gcloud' | ||
id: CheckFailure | ||
entrypoint: 'bash' | ||
env: | ||
- 'BUILD_ID=$BUILD_ID' | ||
args: ['check_failure.sh'] | ||
|
||
options: | ||
pool: | ||
name: 'projects/confidential-space-images-dev/locations/us-west1/workerPools/cs-image-build-vpc' |
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
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