Skip to content

Commit

Permalink
acceptance: bazelify trc ceremony tests (#4209)
Browse files Browse the repository at this point in the history
Bazelify TRC ceremony tests.
The motivation/goal is that developers can run all integration tests locally with a single command.

Change invocation of test in CI to explicitly run these tests with bazel; this will be streamlined by combining this with the acceptance test steps in a follow up PR.
  • Loading branch information
matzf authored Jun 8, 2022
1 parent 35510df commit dc32230
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test:unit --test_tag_filters=unit
test:unit_all --config=unit //...

test:integration --test_tag_filters=integration,-lint
test:integration_go --config=integration -- //... -//acceptance/... -//demo/...
test:acceptance_all --config=integration //acceptance/... //demo/...
test:integration_go --config=integration -- //... -//acceptance/... -//demo/... -//tools/cryptoplayground/...
test:acceptance_all --config=integration //acceptance/... //demo/... //tools/cryptoplayground/...

test:lint --test_tag_filters=lint --test_summary=terse --noshow_progress --experimental_convenience_symlinks=ignore //...
10 changes: 2 additions & 8 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,10 @@ steps:
automatic:
- exit_status: -1 # Agent was lost
- exit_status: 255 # Forced agent shutdown
- label: "TRC ceremony :bash:"
- label: "TRC ceremony :bazel:"
if: build.message !~ /\[doc\]/
command:
- echo "--- build"
- make scion-topo
- echo "--- run test"
- mkdir -p /tmp/test-artifacts/trc-ceremony
- export SAFEDIR="/tmp/test-artifacts/trc-ceremony"
- ./tools/cryptoplayground/trc_ceremony.sh
- ./tools/cryptoplayground/trc_ceremony_sensitive.sh
- bazel test //tools/cryptoplayground:trc_ceremony_test //tools/cryptoplayground:trc_ceremony_sensitive_test
timeout_in_minutes: 15
key: trc_ceremony_test
artifact_paths:
Expand Down
33 changes: 33 additions & 0 deletions tools/cryptoplayground/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
exports_files([
"crypto_lib.sh",
])

sh_test(
name = "trc_ceremony_test",
srcs = ["trc_ceremony.sh"],
data = [
":crypto_lib.sh",
"//scion-pki/cmd/scion-pki",
],
env = {
"SCION_PKI_BIN": "$(location //scion-pki/cmd/scion-pki)",
},
tags = [
"exclusive",
"integration",
],
)

sh_test(
name = "trc_ceremony_sensitive_test",
srcs = ["trc_ceremony_sensitive.sh"],
data = [
"trc_ceremony.sh",
":crypto_lib.sh",
"//scion-pki/cmd/scion-pki",
],
env = {
"SCION_PKI_BIN": "$(location //scion-pki/cmd/scion-pki)",
},
tags = [
"exclusive",
"integration",
],
)
4 changes: 2 additions & 2 deletions tools/cryptoplayground/crypto_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ start_docker() {

docker run --name $name \
-v $(pwd):/workdir \
-v $PLAYGROUND:/scripts \
-v $PLAYGROUND/crypto_lib.sh:/scripts/crypto_lib.sh \
-d emberstack/openssl tail -f /dev/null
}

Expand Down Expand Up @@ -86,7 +86,7 @@ in_docker() {
-e KEYDIR=/keydir \
-v $PUBDIR:/pubdir \
-e PUBDIR=/pubdir \
-v $PLAYGROUND:/scripts \
-v $PLAYGROUND/crypto_lib.sh:/scripts/crypto_lib.sh \
-e STARTDATE=$STARTDATE \
-e ENDDATE=$ENDDATE \
-e TRCID=$TRCID \
Expand Down
5 changes: 3 additions & 2 deletions tools/cryptoplayground/trc_ceremony.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
# Do not remove or modify them!

export SCION_ROOT=${SCION_ROOT:-$(pwd)}
export PLAYGROUND=${PLAYGROUND:-$SCION_ROOT/tools/cryptoplayground}
export PLAYGROUND=$(realpath "${PLAYGROUND:-$SCION_ROOT/tools/cryptoplayground}")
export SAFEDIR=${SAFEDIR:-$(mktemp -d)}
export PATH="$PATH:$SCION_ROOT/bin"
export SCION_PKI_BIN=${SCION_PKI_BIN:-$SCION_ROOT/bin/scion-pki}
export PATH="$(realpath $(dirname "$SCION_PKI_BIN")):$PATH"

. $PLAYGROUND/crypto_lib.sh

Expand Down
9 changes: 5 additions & 4 deletions tools/cryptoplayground/trc_ceremony_sensitive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
# Do not remove or modify them!

export SCION_ROOT=${SCION_ROOT:-$(pwd)}
export PLAYGROUND=${PLAYGROUND:-$SCION_ROOT/tools/cryptoplayground}
export PLAYGROUND=$(realpath "${PLAYGROUND:-$SCION_ROOT/tools/cryptoplayground}")
export SAFEDIR=${SAFEDIR:-$(mktemp -d)}
export PATH="$PATH:$SCION_ROOT/bin"
export SCION_PKI_BIN=${SCION_PKI_BIN:-$SCION_ROOT/bin/scion-pki}
export PATH="$(realpath $(dirname "$SCION_PKI_BIN")):$PATH"

. $PLAYGROUND/crypto_lib.sh

set -e

if [ ! -d "$SAFEDIR/admin" ]; then
echo "#########################"
echo "# Running Base Ceremony #"
Expand All @@ -24,8 +27,6 @@ if [ ! -d "$SAFEDIR/admin" ]; then
echo ""
fi

set -e

STARTDATE="20210524120000Z"
ENDDATE="20220524120000Z"
PREDID="ISD1-B1-S1"
Expand Down

0 comments on commit dc32230

Please sign in to comment.