Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

Commit

Permalink
Merge pull request #227 from /issues/207
Browse files Browse the repository at this point in the history
Re-enable test harness
  • Loading branch information
thanethomson authored Mar 21, 2019
2 parents 7905fdb + 7f60fc4 commit 4c4eb06
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
13 changes: 5 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ version: 2
jobs:
build:
docker:
- image: tendermint/kms:build-2019-01-25-v0 # bump cache keys when modifying this
- image: tendermint/kms:build-2019-03-21-v0 # bump cache keys when modifying this
steps:
- checkout
- restore_cache:
key: cache-2019-01-25-v0 # bump save_cache key below too
key: cache-2019-03-21-v0 # bump save_cache key below too
- run:
name: rustfmt
command: |
Expand Down Expand Up @@ -47,13 +47,10 @@ jobs:
- run:
name: validate against test harness
command: |
echo "TODO(tarcieri): re-enable me!!!"
# TODO(tarcieri): update Tendermint config files and re-enabled test harness
# See: https://github.com/tendermint/kms/issues/207
# cargo build --features=softsign
# TMKMS_BIN=./target/debug/tmkms sh tests/support/run-harness-tests.sh
cargo build --features=softsign
TMKMS_BIN=./target/debug/tmkms sh tests/support/run-harness-tests.sh
- save_cache:
key: cache-2019-01-25-v0 # bump restore_cache key above too
key: cache-2019-03-21-v0 # bump restore_cache key above too
paths:
- "~/.cargo"
- "./target"
25 changes: 13 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
# integration tests
ARG TENDERMINT_VERSION=latest

FROM tendermint/remote_val_harness:${TENDERMINT_VERSION} AS harness
FROM tendermint/tm-signer-harness:${TENDERMINT_VERSION} AS harness

USER root

RUN mkdir -p /remote_val_harness
RUN mkdir -p /harness

# We need this script to generate configuration for the KMS
COPY tests/support/gen-validator-integration-cfg.sh /remote_val_harness/
COPY tests/support/gen-validator-integration-cfg.sh /harness/

# Generate the base configuration data for the Tendermint validator for use
# during integration testing. This will generate the data, by default, in the
# /tendermint directory.
RUN tendermint init --home=/remote_val_harness && \
remote_val_harness extract_key --tmhome=/remote_val_harness --output=/remote_val_harness/signing.key && \
cd /remote_val_harness && \
RUN tendermint init --home=/harness && \
tm-signer-harness extract_key --tmhome=/harness --output=/harness/signing.key && \
cd /harness && \
chmod +x gen-validator-integration-cfg.sh && \
TMHOME=/remote_val_harness sh ./gen-validator-integration-cfg.sh
TMHOME=/harness sh ./gen-validator-integration-cfg.sh

###################################################
# Tendermint KMS Dockerfile
Expand Down Expand Up @@ -76,15 +76,16 @@ ENV RUST_BACKTRACE full
# Remote validator integration testing

# We need the generated harness and Tendermint configuration
COPY --from=harness /remote_val_harness /remote_val_harness
COPY --from=harness /harness /harness

# We need the test harness binary
COPY --from=harness /usr/bin/remote_val_harness /usr/bin/remote_val_harness
COPY --from=harness /usr/bin/tm-signer-harness /usr/bin/tm-signer-harness

# We need a secret connection key
COPY tests/support/secret_connection.key /remote_val_harness/
COPY tests/support/secret_connection.key /harness/

USER root
# Ensure the /remote_val_harness folder has the right owner
RUN chown -R developer /remote_val_harness
# Ensure the /harness folder has the right owner
RUN chown -R developer /harness
USER developer

6 changes: 4 additions & 2 deletions tests/support/gen-validator-integration-cfg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ GENESIS_FILE=${GENESIS_FILE:-${TMHOME}/config/genesis.json}
SIGNING_KEY=${SIGNING_KEY:-${OUTPUT_PATH}/signing.key}
SECRET_KEY=${SECRET_KEY:-${OUTPUT_PATH}/secret_connection.key}
OUTPUT_FILE=${OUTPUT_FILE:-${OUTPUT_PATH}/tmkms.toml}
VALIDATOR_ID=${VALIDATOR_ID:-"f88883b673fc69d7869cab098de3bafc2ff76eb8"}
VALIDATOR_ADDR=${VALIDATOR_ADDR:-"tcp://f88883b673fc69d7869cab098de3bafc2ff76eb8@127.0.0.1:61278"}
#TODO: Restore once https://github.com/tendermint/tendermint/issues/3105 is resolved
#VALIDATOR_ID=${VALIDATOR_ID:-"f88883b673fc69d7869cab098de3bafc2ff76eb8"}
#VALIDATOR_ADDR=${VALIDATOR_ADDR:-"tcp://${VALIDATOR_ID}@127.0.0.1:61278"}
VALIDATOR_ADDR=${VALIDATOR_ADDR:-"tcp://127.0.0.1:61278"}
CFG_TEMPLATE=$(cat <<-EOF
# Information about Tenderment blockchain networks this KMS services
[[chain]]
Expand Down
8 changes: 4 additions & 4 deletions tests/support/run-harness-tests.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/bin/bash
TMKMS_BIN=${TMKMS_BIN:-"./target/debug/tmkms"}
TMKMS_CONFIG=${TMKMS_CONFIG:-"/remote_val_harness/tmkms.toml"}
REMOTE_VAL_HARNESS_BIN=${REMOTE_VAL_HARNESS_BIN:-"remote_val_harness"}
TMHOME=${TMHOME:-"/remote_val_harness"}
TMKMS_CONFIG=${TMKMS_CONFIG:-"/harness/tmkms.toml"}
HARNESS_BIN=${HARNESS_BIN:-"tm-signer-harness"}
TMHOME=${TMHOME:-"/harness"}

# Run KMS in the background
${TMKMS_BIN} start -c ${TMKMS_CONFIG} &
TMKMS_PID=$!

# Run the test harness in the foreground
${REMOTE_VAL_HARNESS_BIN} run \
${HARNESS_BIN} run \
-addr tcp://127.0.0.1:61278 \
-tmhome ${TMHOME}
HARNESS_EXIT_CODE=$?
Expand Down

0 comments on commit 4c4eb06

Please sign in to comment.