-
Notifications
You must be signed in to change notification settings - Fork 228
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
feat: Run monitoring follower with acceptance testing #10816
Open
usmanmani1122
wants to merge
60
commits into
master
Choose a base branch
from
usman/acceptance-pre-test
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+191
−8
Open
Changes from all commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
5e0ac5f
pre test hook for acceptance proposal
usmanmani1122 d78e4c6
changes
usmanmani1122 400c64f
Merge branch "usman/a3p-prepare-test-script" into branch "usman/accep…
usmanmani1122 7455a3a
Merge branch 'master' into usman/acceptance-pre-test
usmanmani1122 abb8181
use custom cli
usmanmani1122 47ffb80
volume instead of mount
usmanmani1122 c04c8dd
Empty
usmanmani1122 9571d66
temporary log
usmanmani1122 c0156af
Merge branch 'master' into usman/acceptance-pre-test
usmanmani1122 4fcc7bd
Empty
usmanmani1122 3bf08ef
oopsie
usmanmani1122 797ec7b
script tracing
usmanmani1122 38b3e6a
oopsie
usmanmani1122 98eb90d
supress script sourcing logs
usmanmani1122 1df7749
omfg
usmanmani1122 45c7e3a
upload artifacts
usmanmani1122 ea008d0
timeout on step
usmanmani1122 a8106ca
oopsie daisy
usmanmani1122 fe055f0
should be it
usmanmani1122 106afdf
test
usmanmani1122 b211f2a
reduce timeout
usmanmani1122 88dd181
disable deployment-test
usmanmani1122 355ac46
remove temp changes
usmanmani1122 0054c0b
Merge branch 'master' into usman/acceptance-pre-test
usmanmani1122 b26112b
Merge branch 'master' into usman/acceptance-pre-test
usmanmani1122 250c420
Merge branch 'master' into usman/acceptance-pre-test
usmanmani1122 15a91b6
update scripts name
usmanmani1122 dba203f
Merge branch 'master' into usman/acceptance-pre-test
usmanmani1122 34b065d
lint
usmanmani1122 c5a3276
fix path
usmanmani1122 5a4ffce
enable tracing
usmanmani1122 789b32d
oopsie
usmanmani1122 8891531
Merge branch 'master' into usman/acceptance-pre-test
usmanmani1122 b84715e
update file name
usmanmani1122 b78a23e
fix path
usmanmani1122 204f59c
testing
usmanmani1122 cb6f8aa
Merge branch 'master' into usman/acceptance-pre-test
usmanmani1122 157fc53
Merge branch 'master' into usman/acceptance-pre-test
usmanmani1122 a962c3f
Merge branch 'master' into usman/acceptance-pre-test
usmanmani1122 f7416a9
try new approach
usmanmani1122 6c42b09
fix node version in integration CI
usmanmani1122 d54322b
fixes
usmanmani1122 c9b7594
Merge branch 'master' into usman/acceptance-pre-test
usmanmani1122 536145d
hack
usmanmani1122 2f3ea2f
remove agoric install and use SDK_SRC
8042215
Merge branch 'master' into usman/acceptance-pre-test
d252567
remove trusted block data extraction
61caaea
bump sunthetic chain version and remove temporary patch
79fccd3
testing
usmanmani1122 ff2bd3f
revert
usmanmani1122 bad7ffb
Merge branch 'master' into usman/acceptance-pre-test
usmanmani1122 fc0b868
fix output directory path
usmanmani1122 a0bca45
lint
usmanmani1122 021f258
fail tests on runner crash
usmanmani1122 0b4e4ca
lint
usmanmani1122 b8eeac8
Merge branch 'master' into usman/acceptance-pre-test
usmanmani1122 70512aa
run follower on host machine
usmanmani1122 855684d
testing
usmanmani1122 8972128
use home folder for extraction of tar file
usmanmani1122 4cc34b8
revert
usmanmani1122 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
a3p-integration/proposals/z:acceptance/host/before-test-run.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#! /bin/bash | ||
# shellcheck disable=SC2155 | ||
|
||
set -o errexit -o errtrace -o pipefail | ||
|
||
DIRECTORY_PATH="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" | ||
FOLLOWER_LOGS_FILE="/tmp/loadgen-follower-logs" | ||
GITHUB_HOST_NAME="https://github.com" | ||
GO_VERSION="1.22.12" | ||
LOADGEN_REPOSITORY_NAME="testnet-load-generator" | ||
LOGS_FILE="/tmp/before-test-run-hook-logs" | ||
ORGANIZATION_NAME="agoric" | ||
SDK_REPOSITORY_NAME="agoric-sdk" | ||
TIMESTAMP="$(date '+%s')" | ||
|
||
LOADGEN_REPOSITORY_LINK="$GITHUB_HOST_NAME/$ORGANIZATION_NAME/$LOADGEN_REPOSITORY_NAME.git" | ||
NETWORK_CONFIG="/tmp/network-config-$TIMESTAMP" | ||
OUTPUT_DIRECTORY="/tmp/loadgen-output" | ||
SDK_REPOSITORY_LINK="$GITHUB_HOST_NAME/$ORGANIZATION_NAME/$SDK_REPOSITORY_NAME.git" | ||
|
||
get_branch_name() { | ||
if ! test -n "$GITHUB_HEAD_REF"; then | ||
if test -n "$GITHUB_REF"; then | ||
GITHUB_HEAD_REF="${GITHUB_REF#refs/heads/}" | ||
else | ||
GITHUB_HEAD_REF="master" | ||
fi | ||
fi | ||
|
||
echo "$GITHUB_HEAD_REF" | ||
} | ||
|
||
install_go() { | ||
if ! which go > /dev/null; then | ||
local go_tar="/tmp/go.tar.gz" | ||
|
||
curl --location --output "$go_tar" --silent "https://go.dev/dl/go$GO_VERSION.linux-amd64.tar.gz" | ||
tar --directory "$HOME" --extract --file "$go_tar" --gzip | ||
rm --force "$go_tar" | ||
export PATH="$HOME/go/bin:$PATH" | ||
fi | ||
} | ||
|
||
main() { | ||
install_go | ||
setup_sdk | ||
setup_loadgen_runner | ||
mkdir --parents "$NETWORK_CONFIG" "$OUTPUT_DIRECTORY" | ||
wait_for_network_config | ||
start_follower > "$FOLLOWER_LOGS_FILE" 2>&1 | ||
} | ||
|
||
setup_loadgen_runner() { | ||
cd "$HOME" | ||
git clone "$LOADGEN_REPOSITORY_LINK" | ||
cd "$LOADGEN_REPOSITORY_NAME/runner" | ||
yarn install | ||
} | ||
|
||
setup_sdk() { | ||
local branch_name="$(get_branch_name)" | ||
echo "Checking out branch '$branch_name' of sdk" | ||
|
||
cd "$HOME" | ||
git clone "$SDK_REPOSITORY_LINK" --branch "$branch_name" | ||
cd "$SDK_REPOSITORY_NAME" | ||
yarn install | ||
make --directory "packages/cosmic-swingset" all | ||
} | ||
|
||
start_follower() { | ||
AG_CHAIN_COSMOS_HOME="$HOME/.agoric" \ | ||
SDK_SRC="$HOME/$SDK_REPOSITORY_NAME" \ | ||
"$HOME/$LOADGEN_REPOSITORY_NAME/runner/bin/loadgen-runner" \ | ||
--acceptance-integration-message-file "$MESSAGE_FILE_PATH" \ | ||
--chain-only \ | ||
--custom-bootstrap \ | ||
--no-stage.save-storage \ | ||
--output-dir "$OUTPUT_DIRECTORY" \ | ||
--profile "testnet" \ | ||
--stages "3" \ | ||
--testnet-origin "file://$NETWORK_CONFIG" \ | ||
--use-state-sync | ||
|
||
echo -n "exit code $?" > "$MESSAGE_FILE_PATH" | ||
} | ||
|
||
wait_for_network_config() { | ||
local network_config=$(node "$DIRECTORY_PATH/../wait-for-follower.mjs" "^{.*") | ||
echo "Got network config: $network_config" | ||
echo "$network_config" > "$NETWORK_CONFIG/network-config" | ||
} | ||
|
||
main > "$LOGS_FILE" 2>&1 & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit -o pipefail | ||
|
||
# shellcheck disable=SC1091 | ||
source /usr/src/upgrade-test-scripts/env_setup.sh | ||
|
||
set -o xtrace | ||
|
||
AGORIC_HOME="$HOME/.agoric" | ||
|
||
CHAIN_ID="$(jq --raw-output '.chain_id' < "$AGORIC_HOME/config/genesis.json")" | ||
IP_ADDRESS="$(hostname --ip-address)" | ||
NODE_ID="$(agd tendermint show-node-id)" | ||
|
||
echo -n "{\"chainName\": \"$CHAIN_ID\", \"rpcAddrs\": [\"$IP_ADDRESS:26657\"], \"gci\": \"$IP_ADDRESS:26657/genesis\", \"peers\":[\"$NODE_ID@$IP_ADDRESS:26656\"], \"seeds\":[]}" > "$MESSAGE_FILE_PATH" | ||
|
||
SNAPSHOT_INTERVAL="$(($(jq --raw-output '.SyncInfo.latest_block_height' < "$STATUS_FILE") + 2))" | ||
sed "s/^snapshot-interval\s*=.*/snapshot-interval = $SNAPSHOT_INTERVAL/" \ | ||
"$AGORIC_HOME/config/app.toml" \ | ||
--in-place |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
a3p-integration/proposals/z:acceptance/wait-for-follower.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* eslint-env node */ | ||
|
||
import { readFile, watch } from 'fs/promises'; | ||
|
||
const FILE_ENCODING = 'utf-8'; | ||
const FILE_PATH = process.env.MESSAGE_FILE_PATH; | ||
|
||
/** | ||
* @param {string} filePath | ||
* @param {string} message | ||
*/ | ||
const checkFileContent = async (filePath, message) => { | ||
const fileContent = (await readFile(filePath, FILE_ENCODING)).trim(); | ||
if (!new RegExp(message).test(fileContent)) return ''; | ||
return fileContent; | ||
}; | ||
|
||
/** | ||
* @param {string} filePath | ||
*/ | ||
const watchSharedFile = async filePath => { | ||
const [, , message] = process.argv; | ||
|
||
let possibleContent = await checkFileContent(filePath, message); | ||
if (possibleContent) return possibleContent; | ||
|
||
for await (const { eventType } of watch(filePath)) { | ||
if (eventType === 'change') { | ||
possibleContent = await checkFileContent(filePath, message); | ||
if (possibleContent) return possibleContent; | ||
} | ||
} | ||
|
||
return undefined; | ||
}; | ||
|
||
FILE_PATH && | ||
watchSharedFile(FILE_PATH).then( | ||
fileContent => fileContent && console.log(fileContent), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the exit code isn't 0, this should fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't aware that we want to fail the pipeline on this failure. Will do