Skip to content

Commit

Permalink
Use xsvm image for e2e testing
Browse files Browse the repository at this point in the history
  • Loading branch information
maru-ava committed Jan 2, 2025
1 parent 68305a2 commit ee9fcab
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
21 changes: 21 additions & 0 deletions scripts/build_xsvm_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

set -euo pipefail

if ! [[ "$0" =~ scripts/build_xsvm_image.sh ]]; then
echo "must be run from repository root"
exit 255
fi

# Directory above this script
AVALANCHE_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd )

# TODO(marun) This image name should be configurable
DOCKER_IMAGE="localhost:5001/avalanchego"

# Build the avalancehgo node image
FORCE_TAG_LATEST=1 SKIP_BUILD_RACE=1 DOCKER_IMAGE="${DOCKER_IMAGE}" ./scripts/build_image.sh

GO_VERSION="$(go list -m -f '{{.GoVersion}}')"
docker buildx build --build-arg GO_VERSION="${GO_VERSION}" --build-arg AVALANCHEGO_NODE_IMAGE="${DOCKER_IMAGE}" \
-t "${DOCKER_IMAGE}-xsvm" -f "${AVALANCHE_PATH}/vms/example/xsvm/Dockerfile" .
4 changes: 3 additions & 1 deletion scripts/tests.e2e.kube.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ fi
# TODO(marun) Make the namespace configurable
PATH="${PWD}/bin:$PATH" kubectl create namespace tmpnet || true

bash -x ./scripts/build_xsvm_image.sh

# TODO(marun) Is the path still necessary?
KUBECONFIG="$HOME/.kube/config" PATH="${PWD}/bin:$PATH" bash -x ./scripts/tests.e2e.sh --runtime=kube
E2E_SERIAL=1 KUBECONFIG="$HOME/.kube/config" PATH="${PWD}/bin:$PATH" bash -x ./scripts/tests.e2e.sh --runtime=kube --image-name=localhost:5001/avalanchego-xsvm:latest
13 changes: 6 additions & 7 deletions scripts/tests.e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@ fi
# the instructions to build non-portable BLST.
source ./scripts/constants.sh

# Enable subnet testing by building xsvm
./scripts/build_xsvm.sh
echo ""

# Ensure an absolute path to avoid dependency on the working directory
# of script execution.
AVALANCHEGO_PATH="$(realpath "${AVALANCHEGO_PATH:-./build/avalanchego}")"
E2E_ARGS="${*:-}"
if ! [[ "${E2E_ARGS}" =~ "--runtime=kube" ]]; then
# If not running in kubernetes, use the local avalanchego binary
AVALANCHEGO_PATH="$(realpath "${AVALANCHEGO_PATH:-./build/avalanchego}")"
E2E_ARGS+=" --avalanchego-path=${AVALANCHEGO_PATH}"

# Enable subnet testing by building the xsvm binary
./scripts/build_xsvm.sh
fi

#################################
Expand Down Expand Up @@ -62,5 +61,5 @@ else
fi

#################################
# shellcheck disable=SC2086
./scripts/ginkgo.sh ${GINKGO_ARGS} -v ./tests/e2e -- "${E2E_ARGS[@]}" "${@}"
# shellcheck disable=SC2086,SC2068
./scripts/ginkgo.sh ${GINKGO_ARGS} -v ./tests/e2e -- ${E2E_ARGS[@]}
2 changes: 1 addition & 1 deletion vms/example/xsvm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ RUN ./scripts/build_xsvm.sh
FROM $AVALANCHEGO_NODE_IMAGE AS execution

# Copy the xsvm binary to the container plugin path
COPY --from=builder $BUILDER_WORKDIR/build/xsvm /avalanchego/build/plugins/v3m4wPxaHpvGr8qfMeyK6PRW3idZrPHmYcMTt7oXdK47yurVH
COPY --from=builder /build/build/xsvm /avalanchego/build/plugins/v3m4wPxaHpvGr8qfMeyK6PRW3idZrPHmYcMTt7oXdK47yurVH

# The node image's entrypoint will be reused.

0 comments on commit ee9fcab

Please sign in to comment.