This repository has been archived by the owner on Jan 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'cudos-dev' into CUDOS-505
- Loading branch information
Showing
22 changed files
with
615 additions
and
24 deletions.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const { SigningCosmWasmClient } = require('cudosjs') | ||
|
||
const { | ||
getEndpoint, | ||
getNetwork, | ||
getDefaultAccount | ||
} = require('./config-utils.js') | ||
|
||
const { getSigner } = require('./keypair.js') | ||
|
||
let client | ||
|
||
async function setClient(accountName, network) { | ||
if (!accountName) { | ||
accountName = await getDefaultAccount() | ||
} | ||
if (!network) { | ||
network = await getNetwork() | ||
} | ||
|
||
const endpoint = await getEndpoint() | ||
const wallet = await getSigner(accountName, network) | ||
client = await SigningCosmWasmClient.connectWithSigner(endpoint, wallet) | ||
client.name = accountName | ||
} | ||
|
||
function getClient() { | ||
return client | ||
} | ||
|
||
module.exports = { | ||
setClient: setClient, | ||
getClient: getClient | ||
} |
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
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,54 @@ | ||
#!/bin/bash | ||
source ./packages/cudos-tests/integration-tests/vars.sh | ||
compose='docker compose -f ./packages/cudos-config/docker-compose-start.yaml -f ./packages/cudos-config/docker-compose-init.yaml' | ||
start_node() { | ||
$compose up --build -d &> /dev/null | ||
timer=45 | ||
sleep $timer | ||
until [[ `$COMPOSE cudos-noded q block` =~ $VALID_BLOCK_STATUS ]]; do | ||
sleep $timer | ||
done; | ||
} | ||
|
||
if [[ ! `ls -a $TESTS_FOLDER` =~ $1 ]]; then | ||
echo 'Invalid test file!' | ||
exit 1 | ||
fi | ||
|
||
if [[ $1 == 'node-start-status.test.sh' ]]; then | ||
if [[ `docker ps` =~ $CONTAINER_NAME ]]; then | ||
echo 'Node is started. Your node will be stopped and started again after the test is executed...' | ||
$compose down &> /dev/null && sleep 5 | ||
node_stopped=true | ||
fi | ||
$TESTS_FOLDER/$1 | ||
exit_status=$? | ||
if [[ $node_stopped == true && $exit_status == 1 ]]; then | ||
echo 'Getting your node back up...' | ||
start_node | ||
fi | ||
exit $exit_status | ||
fi | ||
|
||
if [[ ! `docker ps` =~ $CONTAINER_NAME && ($1 =~ 'keys' || $1 =~ 'node-stop') ]]; then | ||
echo 'Node is not started. Your node will be started and stopped after the test is executed.' | ||
start_node | ||
node_started=true | ||
fi | ||
if [[ $1 =~ 'node-stop' && ! $node_started == true ]]; then | ||
echo 'Node is started. Your node will be stopped and started after the test is executed' | ||
node_stopped=true | ||
fi | ||
echo "Executing $1..." | ||
$TESTS_FOLDER/$1 | ||
exit_status=$? | ||
|
||
if [[ $node_started == true && `docker ps` =~ $CONTAINER_NAME ]]; then | ||
echo 'Stopping the node...' | ||
$compose down &> /dev/null && sleep 5 | ||
elif [[ $node_stopped == true && ! `docker ps` == $CONTAINER_NAME ]]; then | ||
echo 'Getting your node back up...' | ||
start_node | ||
fi | ||
|
||
exit $exit_status |
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,55 @@ | ||
#!/bin/bash | ||
source ./packages/cudos-tests/integration-tests/vars.sh | ||
compose='docker compose -f ./packages/cudos-config/docker-compose-start.yaml -f ./packages/cudos-config/docker-compose-init.yaml' | ||
start_node() { | ||
$compose up --build -d &> /dev/null | ||
timer=45 | ||
sleep $timer | ||
until [[ `$COMPOSE cudos-noded q block` =~ $VALID_BLOCK_STATUS ]]; do | ||
sleep $timer | ||
done; | ||
} | ||
|
||
if [[ $1 ]]; then | ||
./packages/cudos-tests/integration-tests/run-single-test.sh $1 | ||
exit $? | ||
fi | ||
|
||
if [[ `docker ps` =~ $CONTAINER_NAME ]]; then | ||
echo 'Node is started. Your node will be stopped and started again after the tests are executed...' | ||
$compose down &> /dev/null && sleep 5 | ||
node_stopped=true | ||
fi | ||
|
||
echo 'Executing node-start-status.test.sh...' | ||
$TESTS_FOLDER/node-start-status.test.sh | ||
if [[ $? == 1 ]]; then | ||
exit_status=1 | ||
start_node | ||
fi | ||
|
||
for test in $TESTS_FOLDER/*.test.sh; do | ||
if [[ ! $test =~ 'node' ]]; then | ||
split=(${test//// }) | ||
file_name=${split[5]} | ||
echo "Executing $file_name..." | ||
$test | ||
if [[ $? == 1 ]]; then | ||
exit_status=1 | ||
fi | ||
fi | ||
done | ||
|
||
echo 'Executing node-stop-status.test.sh...' | ||
$TESTS_FOLDER/node-stop-status.test.sh | ||
if [[ $? == 1 ]]; then | ||
exit_status=1 | ||
fi | ||
if [[ ! $node_stopped == true && `docker ps` =~ $CONTAINER_NAME ]]; then | ||
$compose down &> /dev/null && sleep 5 | ||
elif [[ $node_stopped == true && ! `docker ps` =~ $CONTAINER_NAME ]]; then | ||
echo 'Getting your node back up...' | ||
start_node | ||
fi | ||
|
||
exit $exit_status |
Oops, something went wrong.