-
Notifications
You must be signed in to change notification settings - Fork 11
chore: multichain-testing enhancements #108
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
Open
mujahidkay
wants to merge
4
commits into
main
Choose a base branch
from
mk/mult-update-starship-config
base: main
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.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Binary file not shown.
This file contains hidden or 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 hidden or 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 hidden or 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,65 @@ | ||
| #!/bin/bash | ||
|
|
||
| ## see https://github.com/cosmology-tech/starship/blob/b7dc499ee0114a0d5035708d7a92ca37fbdaf257/examples/getting-started/scripts/dev-setup.sh | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| function color() { | ||
| local color=$1 | ||
| shift | ||
| local black=30 red=31 green=32 yellow=33 blue=34 magenta=35 cyan=36 white=37 | ||
| local color_code=${!color:-$green} | ||
| printf "\033[%sm%s\033[0m\n" "$color_code" "$*" | ||
| } | ||
|
|
||
| # Define a function to install a binary on macOS | ||
| install_macos() { | ||
| case $1 in | ||
| kubectl) brew install kubectl ;; | ||
| helm) brew install helm ;; | ||
| yq) brew install yq ;; | ||
| kind) brew install kind ;; | ||
| esac | ||
| } | ||
|
|
||
| # Define a function to install a binary on Linux | ||
| install_linux() { | ||
| color green "Installing $1 at ~/.local/bin, please add it to PATH" | ||
| mkdir -p ~/.local/bin | ||
| case $1 in | ||
| kubectl) curl -Lks "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" > ~/.local/bin/kubectl && chmod +x ~/.local/bin/kubectl ;; | ||
| helm) curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash ;; | ||
| yq) curl -Lks "https://github.com/mikefarah/yq/releases/download/v4.33.3/yq_linux_amd64" > ~/.local/bin/yq && chmod +x ~/.local/bin/yq ;; | ||
| kind) curl -Lks https://kind.sigs.k8s.io/dl/v0.18.1/kind-linux-amd64 > ~/.local/bin/kind && chmod +x ~/.local/bin/kind ;; | ||
| esac | ||
| } | ||
|
|
||
| # Define a function to install a binary | ||
| install_binary() { | ||
| if [[ $(uname -s) == "Darwin" ]]; then | ||
| install_macos $1 | ||
| else | ||
| install_linux $1 | ||
| fi | ||
| } | ||
|
|
||
| # Define a function to check for the presence of a binary | ||
| check_binary() { | ||
| if ! command -v $1 &> /dev/null; then | ||
| echo "$1 is not installed" | ||
| install_binary $1 | ||
| if ! command -v $1 &> /dev/null; then | ||
| color red "Installation of $1 failed, exiting..." | ||
| color red "Please install $1 manually, then run me again to verify the installation" | ||
| exit 1 | ||
| fi | ||
| fi | ||
| } | ||
|
|
||
| # Check the binaries | ||
| check_binary kubectl | ||
| check_binary helm | ||
| check_binary yq | ||
| check_binary kind | ||
|
|
||
| color green "All binaries are installed" |
This file contains hidden or 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,127 @@ | ||
| #!/bin/bash | ||
|
|
||
| ## see https://github.com/cosmology-tech/starship/blob/7d63c4678a345789d8331dde7654f67953c5cc2b/examples/getting-started/scripts/install.sh | ||
|
|
||
| ## Script used to install the helm chart for the devnet from a config file | ||
| ## Usage: | ||
| ## ./scripts/install.sh --coinfig <config_file> | ||
| ## Options: | ||
| ## -c|--config: config file to use (default: config.yaml) | ||
| ## -v|--version: helm chart version (default: 0.1.43) | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| # read config file from args into variable | ||
| CONFIGFILE="config.yaml" | ||
|
|
||
| SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd) | ||
| echo "Script dir: ${SCRIPT_DIR}" | ||
|
|
||
| # default values | ||
| DRY_RUN="" | ||
| TIMEOUT="" | ||
| NAMESPACE="" | ||
| HELM_REPO="starship" | ||
| HELM_CHART="starship/devnet" | ||
| HELM_REPO_URL="https://hyperweb-io.github.io/starship/" | ||
| HELM_CHART_VERSION="0.2.8" | ||
| HELM_NAME="agoric-multichain-testing" | ||
|
|
||
| # check_helm function verifies the helm binary is installed | ||
| function check_helm() { | ||
| if ! command -v helm &> /dev/null; then | ||
| echo "helm could not be found; please install it first!!!" | ||
| exit | ||
| fi | ||
| } | ||
|
|
||
| # setup_helm function adds the helm repo and updates it | ||
| function setup_helm() { | ||
| if [ -d "$HELM_CHART" ]; then | ||
| echo "using local helm chart" | ||
| return | ||
| fi | ||
| helm repo add ${HELM_REPO} ${HELM_REPO_URL} | ||
| helm repo update | ||
| helm search repo ${HELM_CHART} --version ${HELM_CHART_VERSION} | ||
| } | ||
|
|
||
| function set_helm_args() { | ||
| if [[ $TIMEOUT ]]; then | ||
| args="$args --timeout $TIMEOUT --wait --debug" | ||
| fi | ||
| if [[ $NAMESPACE ]]; then | ||
| args="$args --namespace $NAMESPACE --create-namespace" | ||
| fi | ||
| if [[ $DRY_RUN ]]; then | ||
| args="$args --dry-run --debug" | ||
| fi | ||
| num_chains=$(yq -r ".chains | length - 1" ${CONFIGFILE}) | ||
| if [[ $num_chains -lt 0 ]]; then | ||
| echo "No chains to parse: num: $num_chains" | ||
| return 0 | ||
| fi | ||
| for i in $(seq 0 $num_chains); do | ||
| scripts=$(yq -r ".chains[$i].scripts" ${CONFIGFILE}) | ||
| if [[ "$scripts" == "null" ]]; then | ||
| return 0 | ||
| fi | ||
| datadir="$( | ||
| cd "$(dirname -- "${CONFIGFILE}")" > /dev/null | ||
| pwd -P | ||
| )" | ||
| for script in $(yq -r ".chains[$i].scripts | keys | .[]" ${CONFIGFILE}); do | ||
| args="$args --set-file chains[$i].scripts.$script.data=$datadir/$(yq -r ".chains[$i].scripts.$script.file" ${CONFIGFILE})" | ||
| done | ||
| done | ||
| } | ||
|
|
||
| function install_chart() { | ||
| args="" | ||
| set_helm_args | ||
| echo "name: ${HELM_NAME}, args: $args, chart: ${HELM_CHART}, version: ${HELM_CHART_VERSION}" | ||
| helm install ${HELM_NAME} ${HELM_CHART} --version ${HELM_CHART_VERSION} -f ${CONFIGFILE} $args | ||
| } | ||
|
|
||
| while [ $# -gt 0 ]; do | ||
| case "$1" in | ||
| -c | --config) | ||
| CONFIGFILE="$2" | ||
| shift 2 # past argument=value | ||
| ;; | ||
| -v | --version) | ||
| HELM_CHART_VERSION="$2" | ||
| shift 2 # past argument | ||
| ;; | ||
| -t | --timeout) | ||
| TIMEOUT="$2" | ||
| shift 2 # past argument | ||
| ;; | ||
| -n | --name) | ||
| HELM_NAME="$2" | ||
| shift 2 # past argument | ||
| ;; | ||
| --namespace) | ||
| NAMESPACE="$2" | ||
| shift 2 # past argument | ||
| ;; | ||
| --chart) | ||
| HELM_CHART="$2" | ||
| shift 2 # past argument | ||
| ;; | ||
| --dry-run) | ||
| DRY_RUN=1 | ||
| shift # past argument | ||
| ;; | ||
| -) | ||
| echo "Unknown option $1" | ||
| exit 1 | ||
| ;; | ||
| *) ;; | ||
|
|
||
| esac | ||
| done | ||
|
|
||
| check_helm | ||
| setup_helm | ||
| install_chart |
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.
Why we are removing cosmoshub?
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.
The OG setup had 3 chains: agoric, cosmoshub(aka gaia) and osmosis. This meant running at least three relayers - agoric<>osmosis, agoric<>cosmoshub, osmosis<>cosmoshub. By reducing the multichain testing setup to only two chains, we have also reduced the number of relayers to 1. As a result, I have also removed cosmoshub related changes from code (especially multichain tests which fail because cosmoshub isn't present anymore).
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.
But aren't we then compromising testing with cosmoshub if we are just removing it to save our resources/time?
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.
How so? Whatever we test between two chains is just extrapolated to a set of three chains.
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.
I didn't get it. Provided the test is same but if it's happening on different chains then we should treat it something different. Outcome of test can be different on different chains, or no?
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.
What is the goal of our test? Is it to generally test multi-chain stuff with any chain?
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.
So let's say the tests work for a<>b chains and a<>c chains. We are removing c chain because the a<>b is enough as it does the same testing, right?
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.
We have parametrized tests like
This used to include cosmoshub as well.
This test basically creates new wallets, provisions them, makes an offer using orch contract, and verifies the wallet has that offer. Basically testing if our orchestration contract offer is received on other chains (from what I am inferring from code). It already does it for osmosis, so IMO an agoric testcase and a non-agoric test cases suffices. We can add as many non-agoric chains (supported) as we like but we don't have to. If it works for osmosis, it should work for others
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.
Hmmmm fair enough