summaryrefslogtreecommitdiff
path: root/test/end-to-end/remote-execution
diff options
context:
space:
mode:
authorAlberto Sartori <alberto.sartori@huawei.com>2023-01-18 14:26:14 +0100
committerAlberto Sartori <alberto.sartori@huawei.com>2023-01-20 11:58:07 +0100
commit3d95b0adc81d155ad9020e9efbc50799c89953ff (patch)
treef7b391ff47439a4d09b1309326b9d6bbcef13654 /test/end-to-end/remote-execution
parentfe8983f3444ca0f287d54d673ddda3aa9fb1a17c (diff)
downloadjustbuild-3d95b0adc81d155ad9020e9efbc50799c89953ff.tar.gz
tests: pass tls certificates and key
Diffstat (limited to 'test/end-to-end/remote-execution')
-rw-r--r--test/end-to-end/remote-execution/TARGETS14
-rw-r--r--test/end-to-end/remote-execution/large-blobs.sh13
-rw-r--r--test/end-to-end/remote-execution/native-protocol.sh13
-rw-r--r--test/end-to-end/remote-execution/upload-test.sh13
4 files changed, 47 insertions, 6 deletions
diff --git a/test/end-to-end/remote-execution/TARGETS b/test/end-to-end/remote-execution/TARGETS
index 0f7b5118..f2ba00f5 100644
--- a/test/end-to-end/remote-execution/TARGETS
+++ b/test/end-to-end/remote-execution/TARGETS
@@ -5,23 +5,31 @@
, "deps":
[ ["test/end-to-end", "tool-under-test"]
, ["test/end-to-end", "mr-tool-under-test"]
+ , ["@", "credentials", "", ""]
]
}
, "large-blobs":
{ "type": ["@", "rules", "shell/test", "script"]
, "name": ["large-blobs"]
, "test": ["large-blobs.sh"]
- , "deps": [["test/end-to-end", "tool-under-test"]]
+ , "deps":
+ [["test/end-to-end", "tool-under-test"], ["@", "credentials", "", ""]]
}
, "upload-test":
{ "type": ["@", "rules", "shell/test", "script"]
, "name": ["upload-test"]
, "test": ["upload-test.sh"]
- , "deps": [["test/end-to-end", "tool-under-test"]]
+ , "deps":
+ [["test/end-to-end", "tool-under-test"], ["@", "credentials", "", ""]]
}
, "TESTS":
{ "type": "install"
, "tainted": ["test"]
- , "deps": ["native-protocol", "large-blobs", "upload-test"]
+ , "deps":
+ [ "native-protocol"
+ , "large-blobs"
+ , "upload-test"
+ , ["@", "credentials", "", ""]
+ ]
}
}
diff --git a/test/end-to-end/remote-execution/large-blobs.sh b/test/end-to-end/remote-execution/large-blobs.sh
index 17839e86..a4d25ffa 100644
--- a/test/end-to-end/remote-execution/large-blobs.sh
+++ b/test/end-to-end/remote-execution/large-blobs.sh
@@ -17,6 +17,7 @@
set -eu
readonly JUST="${PWD}/bin/tool-under-test"
+readonly CREDENTIALS_DIR="${PWD}/credentials"
# create a sufficiently large (>4MB) file for testing upload/download (16MB)
dd if=/dev/zero of=large.file bs=1024 count=$((16*1024))
@@ -43,12 +44,22 @@ run_tests() {
local TYPE="local"
local REMOTE_ARGS=""
local REMOTE_BUILD_ARGS=""
+ local AUTH_ARGS=""
if [ -n "${1:-}" ] && [ -n "${2:-}" ]; then
TYPE="remote"
REMOTE_ARGS="-r $1"
REMOTE_BUILD_ARGS="--remote-execution-property $2"
+ if [ -f "${CREDENTIALS_DIR}/ca.crt" ]; then
+ AUTH_ARGS=" --tls-ca-cert ${CREDENTIALS_DIR}/ca.crt "
+ if [ -f "${CREDENTIALS_DIR}/client.crt" ]; then
+ AUTH_ARGS=" --tls-client-cert ${CREDENTIALS_DIR}/client.crt "${AUTH_ARGS}
+ fi
+ if [ -f "${CREDENTIALS_DIR}/client.key" ]; then
+ AUTH_ARGS=" --tls-client-key ${CREDENTIALS_DIR}/client.key "${AUTH_ARGS}
+ fi
+ fi
fi
- ARGS="$COMMON_ARGS $REMOTE_ARGS"
+ ARGS="$COMMON_ARGS $REMOTE_ARGS ${AUTH_ARGS}"
BUILD_ARGS="$ARGS $REMOTE_BUILD_ARGS"
echo
diff --git a/test/end-to-end/remote-execution/native-protocol.sh b/test/end-to-end/remote-execution/native-protocol.sh
index aea047ad..bef83e46 100644
--- a/test/end-to-end/remote-execution/native-protocol.sh
+++ b/test/end-to-end/remote-execution/native-protocol.sh
@@ -23,6 +23,7 @@ readonly LBRDIR="${TEST_TMPDIR}/local-build-root"
readonly JUST_MR="${PWD}/bin/mr-tool-under-test"
readonly JUST="${PWD}/bin/tool-under-test"
readonly RESULT="out.txt"
+readonly CREDENTIALS_DIR="${PWD}/credentials"
echo
echo Create Git repository
@@ -84,15 +85,25 @@ echo
TREE_ID="$(jq -r ".${OUT_DIRNAME}.id" "${RESULT}" 2>&1)"
test ${TREE_ID} ${EQUAL} ${GIT_TREE_ID}
+AUTH_ARGS=""
if [ "${REMOTE_EXECUTION_ADDRESS:-}" != "" ]; then
REMOTE_EXECUTION_ARGS="-r ${REMOTE_EXECUTION_ADDRESS}"
if [ "${REMOTE_EXECUTION_PROPERTIES:-}" != "" ]; then
REMOTE_EXECUTION_ARGS="${REMOTE_EXECUTION_ARGS} --remote-execution-property ${REMOTE_EXECUTION_PROPERTIES}"
fi
+ if [ -f "${CREDENTIALS_DIR}/ca.crt" ]; then
+ AUTH_ARGS=" --tls-ca-cert ${CREDENTIALS_DIR}/ca.crt "
+ if [ -f "${CREDENTIALS_DIR}/client.crt" ]; then
+ AUTH_ARGS=" --tls-client-cert ${CREDENTIALS_DIR}/client.crt "${AUTH_ARGS}
+ fi
+ if [ -f "${CREDENTIALS_DIR}/client.key" ]; then
+ AUTH_ARGS=" --tls-client-key ${CREDENTIALS_DIR}/client.key "${AUTH_ARGS}
+ fi
+ fi
echo
echo Upload and download Git tree to remote CAS in ${NAME} mode
echo
- "${JUST}" build -C "${CONF}" --main test test ${REMOTE_EXECUTION_ARGS} --local-build-root="${LBRDIR}" --dump-artifacts "${RESULT}" ${ARGS} 2>&1
+ "${JUST}" build -C "${CONF}" --main test test ${REMOTE_EXECUTION_ARGS} ${AUTH_ARGS} --local-build-root="${LBRDIR}" --dump-artifacts "${RESULT}" ${ARGS} 2>&1
TREE_ID="$(jq -r ".${OUT_DIRNAME}.id" "${RESULT}" 2>&1)"
test ${TREE_ID} ${EQUAL} ${GIT_TREE_ID}
fi
diff --git a/test/end-to-end/remote-execution/upload-test.sh b/test/end-to-end/remote-execution/upload-test.sh
index b04b6125..40d2628b 100644
--- a/test/end-to-end/remote-execution/upload-test.sh
+++ b/test/end-to-end/remote-execution/upload-test.sh
@@ -19,6 +19,7 @@ set -eu
readonly JUST="${PWD}/bin/tool-under-test"
readonly GITDIR="${TEST_TMPDIR}/src"
readonly LBRDIR="${TEST_TMPDIR}/local-build-root"
+readonly CREDENTIALS_DIR="${PWD}/credentials"
mkdir -p ${GITDIR}
cd ${GITDIR}
@@ -57,10 +58,20 @@ export CONF="$(realpath repos.json)"
"${JUST}" build -C "${CONF}" --local-build-root="${LBRDIR}" ${ARGS} 2>&1
# Build remotely
+AUTH_ARGS=""
if [ "${REMOTE_EXECUTION_ADDRESS:-}" != "" ]; then
REMOTE_EXECUTION_ARGS="-r ${REMOTE_EXECUTION_ADDRESS}"
if [ "${REMOTE_EXECUTION_PROPERTIES:-}" != "" ]; then
REMOTE_EXECUTION_ARGS="${REMOTE_EXECUTION_ARGS} --remote-execution-property ${REMOTE_EXECUTION_PROPERTIES}"
fi
- "${JUST}" build -C "${CONF}" --local-build-root="${LBRDIR}" ${ARGS} ${REMOTE_EXECUTION_ARGS} 2>&1
+ if [ -f "${CREDENTIALS_DIR}/ca.crt" ]; then
+ AUTH_ARGS=" --tls-ca-cert ${CREDENTIALS_DIR}/ca.crt "
+ if [ -f "${CREDENTIALS_DIR}/client.crt" ]; then
+ AUTH_ARGS=" --tls-client-cert ${CREDENTIALS_DIR}/client.crt "${AUTH_ARGS}
+ fi
+ if [ -f "${CREDENTIALS_DIR}/client.key" ]; then
+ AUTH_ARGS=" --tls-client-key ${CREDENTIALS_DIR}/client.key "${AUTH_ARGS}
+ fi
+ fi
+ "${JUST}" build -C "${CONF}" --local-build-root="${LBRDIR}" ${ARGS} ${REMOTE_EXECUTION_ARGS} ${AUTH_ARGS} 2>&1
fi