Skip to content

Commit

Permalink
Sanity Test for nodes running in k8s (BFT-394) (#63)
Browse files Browse the repository at this point in the history
## What ❔

Add a first sanity test to check node liveness running with the new
Kubernetes script.

## Why ❔

We need this basic test to see how to address the test suite development
and have a layer used to communicate a local environment (like CI) with
the nodes running in kubernetes.

---------

Co-authored-by: Bruno França <[email protected]>
Co-authored-by: Grzegorz Prusak <[email protected]>
Co-authored-by: Esteban Dimitroff Hódi <[email protected]>
  • Loading branch information
4 people authored Mar 7, 2024
1 parent 86648cb commit 2bc31fc
Show file tree
Hide file tree
Showing 17 changed files with 527 additions and 167 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ logs/
.terraform
.ssh
**/*terraform.tfstate*

# Binaries generated in Docker
node/tools/docker_binaries
27 changes: 21 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# Build Stage
FROM rust:latest as builder
COPY /node/ /node/
WORKDIR /node
COPY /node/ /app/
WORKDIR /app
RUN apt-get update && apt-get install -y libclang-dev
RUN cargo build --release

# Binary copy stage
FROM scratch as binary
COPY --from=builder /node/target/release/executor .
FROM scratch as executor-binary
COPY --from=builder /app/target/release/executor .

# Binary copy stage
FROM scratch as tester-binary
COPY --from=builder /app/target/release/tester .

# Runtime Stage
FROM debian:stable-slim as runtime
# Executor runtime Stage
FROM debian:stable-slim as executor-runtime

COPY /node/tools/docker_binaries/executor /node/
COPY /node/tools/k8s_configs/ /node/k8s_config
Expand All @@ -26,3 +30,14 @@ ENTRYPOINT ["./docker-entrypoint.sh"]

EXPOSE 3054
EXPOSE 3051

# Tester runtime Stage
FROM debian:stable-slim as tester-runtime
COPY node/tools/docker_binaries/tester /test/
COPY node/tests/tester_entrypoint.sh /test/
COPY node/tests/config.txt /test/

WORKDIR /test

RUN chmod +x tester_entrypoint.sh

9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ nodes_config:
# Docker commands

docker_build_executor:
docker build --output=node/tools/docker_binaries --target=binary .
docker build --output=node/tools/docker_binaries --target=executor-binary .

docker_node_image:
docker build -t consensus-node --target=runtime .
docker build -t consensus-node --target=executor-runtime .

docker_nodes_config:
cd ${EXECUTABLE_NODE_DIR} && cargo run --release --bin localnet_config -- --input-addrs docker-config/addresses.txt --output-dir docker-config
cd ${EXECUTABLE_NODE_DIR} && cargo run --bin localnet_config -- --input-addrs docker-config/addresses.txt --output-dir docker-config

docker_node:
$(MAKE) docker_node_image
Expand All @@ -39,7 +39,7 @@ stop_docker_nodes:
docker stop consensus-node-1 consensus-node-2

start_k8s_nodes:
cd ${EXECUTABLE_NODE_DIR} && cargo run --release --bin deployer generate-config --nodes ${NODES}
cd ${EXECUTABLE_NODE_DIR} && cargo run --bin deployer generate-config --nodes ${NODES}
$(MAKE) docker_node_image
minikube image load consensus-node:latest
cd ${EXECUTABLE_NODE_DIR} && cargo run --release --bin deployer deploy --nodes ${NODES} --seed-nodes ${SEED_NODES}
Expand All @@ -60,6 +60,7 @@ clean_docker:
docker rm -f consensus-node-2
docker network rm -f node-net
docker image rm -f consensus-node
docker image rm -f test-suite

addresses_file:
mkdir -p ${EXECUTABLE_NODE_DIR}/docker-config
Expand Down
Loading

0 comments on commit 2bc31fc

Please sign in to comment.