a handful of test fixes, warning cleanup, and added Dockerfile for execing tests with stacks-node

This commit is contained in:
Aaron Blankstein
2022-03-25 14:49:33 -05:00
parent 0094094406
commit 34c7e34bc3
14 changed files with 142 additions and 95 deletions

View File

@@ -12,7 +12,7 @@ ENV RUSTFLAGS="-Zinstrument-coverage" \
COPY . .
RUN cargo build --workspace && \
cargo test --workspace --bin=stacks-node -- --ignored --test-threads 1
cargo test --workspace --bin=hyperchain-node -- --ignored --test-threads 1
# Generate coverage report and upload it to codecov
RUN grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info

View File

@@ -0,0 +1,26 @@
FROM blockstack/stacks-blockchain:2.05.0.1.0-stretch as stacks-node
FROM rust:stretch AS test
WORKDIR /build
RUN rustup override set nightly-2022-01-14 && \
rustup component add llvm-tools-preview && \
cargo install grcov
ENV RUSTFLAGS="-Zinstrument-coverage" \
LLVM_PROFILE_FILE="stacks-blockchain-%p-%m.profraw" \
STACKS_NODE_TEST="1"
COPY --from=stacks-node /bin/stacks-node /bin/
COPY . .
RUN cargo build --workspace && \
cargo test --workspace --bin=hyperchain-node -- l1_observer_test --test-threads 1
# Generate coverage report and upload it to codecov
RUN grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info
FROM scratch AS export-stage
COPY --from=test /build/lcov.info /

View File

@@ -53,7 +53,23 @@ jobs:
files: ./coverage-output/lcov.info
name: unit_tests
fail_ci_if_error: true
# Run tests that require stacks-node
layer-1-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run units tests (with coverage)
env:
DOCKER_BUILDKIT: 1
# Remove .dockerignore file so codecov has access to git info
run: |
rm .dockerignore
docker build -o coverage-output -f ./.github/actions/bitcoin-int-tests/Dockerfile.stacks-node .
- uses: codecov/codecov-action@v2
with:
files: ./coverage-output/lcov.info
name: integration_tests
fail_ci_if_error: true
# Run integration tests
integration-tests:
runs-on: ubuntu-latest