Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add admin address to integration test framework #1276

Merged
merged 3 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions integration-tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ PYTHON := $(VENV_BIN)/python

HELM_CHART=network
PLATFORM=linux/amd64
GCR_REPO = gcr.io/stride-nodes/integration-tests
GCR_REPO=gcr.io/stride-nodes/integration-tests

ADMINS_FILE=../utils/admins.go
KEYS_FILE=network/configs/keys.json

# Builds and pushes a docker image
# args: [image-file-suffix] [context] [image-name]
Expand Down Expand Up @@ -56,8 +59,7 @@ build-api:
$(call build_and_push_docker,api,api,api:latest)

build-stride:
@$(DOCKER) buildx build --platform linux/amd64 --tag core:stride ..
$(call build_and_push_docker,stride,.,chains/stride:latest)
@bash network/scripts/build.sh stride

build-cosmos:
$(call build_and_push_docker,cosmos,.,chains/cosmoshub:v18.1.0)
Expand Down
1 change: 1 addition & 0 deletions integration-tests/network/configs/keys.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

"admin": {
"name": "admin",
"address": "stride1u20df3trc2c2zdhm8qvh2hdjx9ewh00sv6eyy8",
"mnemonic": "tone cause tribe this switch near host damage idle fragile antique tail soda alien depth write wool they rapid unfold body scan pledge soft"
},
"faucet": {
Expand Down
54 changes: 54 additions & 0 deletions integration-tests/network/scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
set -eu

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
STRIDE_HOME=$SCRIPT_DIR/../../..

CHAIN=$1

PLATFORM=linux/amd64
GCR_REPO=gcr.io/stride-nodes/integration-tests
ADMINS_FILE=${STRIDE_HOME}/utils/admins.go
KEYS_FILE=${STRIDE_HOME}/integration-tests/network/configs/keys.json
DOCKERFILES=${STRIDE_HOME}/integration-tests/dockerfiles

# Builds and pushes a docker image to GCR
build_and_push_docker() {
dockerfile_suffix=$1
context=$2
image_name=$3

local_tag=stride-tests:$dockerfile_suffix
global_tag=$GCR_REPO/${image_name}

echo "Building docker image: $dockerfile_suffix"
docker buildx build --platform $PLATFORM --tag $local_tag -f ${DOCKERFILES}/Dockerfile.$dockerfile_suffix $context
docker tag $local_tag $global_tag

echo "Pushing image to GCR: $global_tag"
docker push $global_tag
}

main() {
# For stride, we have to update the admin address
if [[ "$CHAIN" == "stride" ]]; then
# Trap SIGINT (Control + C) to cleanup admins file
trap 'echo "Interrupt received, cleaning up..."; git checkout -- $ADMINS_FILE && rm -f ${ADMINS_FILE}-E; exit' INT

# Update the admin address
admin_address=$(jq -r '.admin.address' $KEYS_FILE)
sed -i -E "s|stride1k8c2m5cn322akk5wy8lpt87dd2f4yh9azg7jlh|$admin_address|g" $ADMINS_FILE

# First build the main dockerfile in the repo root, then build the integration test specific file
docker buildx build --platform linux/amd64 --tag core:stride ..
build_and_push_docker stride . chains/stride:latest

# Cleanup the admins file
git checkout -- $ADMINS_FILE && rm -f ${ADMINS_FILE}-E
else
echo "ERROR: Chain not supported"
exit 1
fi
}

main
1 change: 1 addition & 0 deletions integration-tests/network/scripts/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ DEPOSIT_PERIOD="30s"
VOTING_PERIOD="30s"
EXPEDITED_VOTING_PERIOD="29s"
UNBONDING_TIME="240s"
AIRDROP_PERIOD_SECONDS=86400

STRIDE_DAY_EPOCH_DURATION="140s"
STRIDE_EPOCH_EPOCH_DURATION="35s"
2 changes: 2 additions & 0 deletions integration-tests/network/scripts/init-chain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ update_stride_genesis() {

$BINARY add-consumer-section --validator-public-keys $validator_public_keys
jq_inplace '.app_state.ccvconsumer.params.unbonding_period |= "'$UNBONDING_TIME'"' $genesis_json

jq_inplace '.app_state.airdrop.params.period_length_seconds |= "'${AIRDROP_PERIOD_LENGTH}'"' $genesis_json
}

# Genesis updates specific to non-stride chains
Expand Down
Loading