diff --git a/e2etests/boot_tests.bzl b/e2etests/boot_tests.bzl index 9ac6b3368da..f215fe2f0da 100644 --- a/e2etests/boot_tests.bzl +++ b/e2etests/boot_tests.bzl @@ -1,9 +1,9 @@ -def launch_cvd_boot_test(name, branch, target): +def launch_cvd_boot_test(name, branch, target, credential_source = ""): native.sh_test( name = name, size = "medium", srcs = ["launch_cvd_boot_test.sh"], - args = ["-b", branch, "-t", target], + args = ["-b", branch, "-t", target, "-c", credential_source], tags = [ "exclusive", "external", @@ -11,12 +11,12 @@ def launch_cvd_boot_test(name, branch, target): ], ) -def cvd_load_boot_test(name, env_file, size = "medium"): +def cvd_load_boot_test(name, env_file, size = "medium", credential_source = ""): native.sh_test( name = name, size = size, srcs = ["cvd_load_boot_test.sh"], - args = [env_file], + args = ["-c", credential_source, env_file], data = [env_file], tags = [ "exclusive", diff --git a/e2etests/cvd_load_boot_test.sh b/e2etests/cvd_load_boot_test.sh index 90176cd86ae..fefd7cabd8b 100755 --- a/e2etests/cvd_load_boot_test.sh +++ b/e2etests/cvd_load_boot_test.sh @@ -2,13 +2,25 @@ set -e -x +usage="Usage: $0 [-c CREDENTIAL_SOURCE] ENVIRONMENT_SPECIFICATION_FILE" + +CREDENTIAL_SOURCE="" +while getopts "c:" opt; do + case "${opt}" in + c) + CREDENTIAL_SOURCE="${OPTARG}" + ;; + *) + echo "${usage}" + exit 1 + esac +done + if [[ $# != 1 ]]; then - echo "Usage: $0 ENVIRONMENT_SPECIFICATION_FILE" + echo "${usage}" exit 1 fi -ls - ENV_FILE="$1" CMD_OUT="cvd_load_stdout.txt" CMD_ERR="cvd_load_stderr.txt" @@ -45,4 +57,4 @@ trap collect_logs_and_cleanup EXIT # Make sure there is no cvd server around cvd reset -y -cvd load "${ENV_FILE}" >"${CMD_OUT}" 2>"${CMD_ERR}" +cvd load --override="fetch.credential_source:${CREDENTIAL_SOURCE}" "${ENV_FILE}" >"${CMD_OUT}" 2>"${CMD_ERR}" diff --git a/e2etests/launch_cvd_boot_test.sh b/e2etests/launch_cvd_boot_test.sh index 0b12ec49712..102d7452e9f 100755 --- a/e2etests/launch_cvd_boot_test.sh +++ b/e2etests/launch_cvd_boot_test.sh @@ -4,12 +4,16 @@ set -e -x BRANCH="" TARGET="" +CREDENTIAL_SOURCE="" -while getopts "b:t:" opt; do +while getopts "c:b:t:" opt; do case "${opt}" in b) BRANCH="${OPTARG}" ;; + c) + CREDENTIAL_SOURCE="${OPTARG}" + ;; t) TARGET="${OPTARG}" ;; @@ -51,7 +55,10 @@ trap collect_logs_and_cleanup EXIT # client can still connect to the server outside the sandbox and cause issues. cvd reset -y -cvd fetch --default_build="${BRANCH}/${TARGET}" --target_directory="${workdir}" +cvd fetch \ + --default_build="${BRANCH}/${TARGET}" \ + --target_directory="${workdir}" \ + --credential_source="${CREDENTIAL_SOURCE}" ( cd "${workdir}"