From a3d963033604b940574c514b504603a07356da78 Mon Sep 17 00:00:00 2001 From: Michal Niewrzal Date: Fri, 16 Sep 2022 11:12:06 +0200 Subject: [PATCH] scripts: move tests to separate folders Doing some cleanup in "scripts" folder. All integration like tests are moved under "test" directory (integration, bc, redis) and bash scripts are adjusted to reflect new location. As an addition "scripts/install-awscli.sh" was deleted as it was not used. Change-Id: I152905c4258f471a71f2d0e8731d91bb075e99c1 --- Makefile | 6 +++--- scripts/install-awscli.sh | 12 ------------ .../backwardcompatibility}/test-backwards.sh | 4 ++-- .../backwardcompatibility}/test-sim-backwards-dev.sh | 2 +- .../backwardcompatibility}/test-sim-backwards.sh | 0 scripts/{ => tests/integration}/test-billing.sh | 0 scripts/{ => tests/integration}/test-sim-dev.sh | 2 +- scripts/{ => tests/integration}/test-sim.sh | 2 +- .../integration}/test-uplink-rs-download.sh | 0 .../{ => tests/integration}/test-uplink-rs-upload.sh | 0 scripts/{ => tests/integration}/test-uplink-share.sh | 7 ++++--- scripts/{ => tests/integration}/test-uplink.sh | 2 +- scripts/{ => tests}/postgres-dev.sh | 0 scripts/{ => tests/redis}/redis-server.sh | 0 .../redis}/test-sim-redis-up-and-down-dev.sh | 2 +- .../{ => tests/redis}/test-sim-redis-up-and-down.sh | 4 ++-- .../redis}/test-uplink-redis-up-and-down.sh | 3 ++- 17 files changed, 18 insertions(+), 28 deletions(-) delete mode 100644 scripts/install-awscli.sh rename scripts/{ => tests/backwardcompatibility}/test-backwards.sh (96%) rename scripts/{ => tests/backwardcompatibility}/test-sim-backwards-dev.sh (85%) rename scripts/{ => tests/backwardcompatibility}/test-sim-backwards.sh (100%) rename scripts/{ => tests/integration}/test-billing.sh (100%) rename scripts/{ => tests/integration}/test-sim-dev.sh (76%) rename scripts/{ => tests/integration}/test-sim.sh (98%) rename scripts/{ => tests/integration}/test-uplink-rs-download.sh (100%) rename scripts/{ => tests/integration}/test-uplink-rs-upload.sh (100%) rename scripts/{ => tests/integration}/test-uplink-share.sh (98%) rename scripts/{ => tests/integration}/test-uplink.sh (99%) rename scripts/{ => tests}/postgres-dev.sh (100%) rename scripts/{ => tests/redis}/redis-server.sh (100%) rename scripts/{ => tests/redis}/test-sim-redis-up-and-down-dev.sh (83%) rename scripts/{ => tests/redis}/test-sim-redis-up-and-down.sh (93%) rename scripts/{ => tests/redis}/test-uplink-redis-up-and-down.sh (99%) diff --git a/Makefile b/Makefile index f7141953a..60d350054 100644 --- a/Makefile +++ b/Makefile @@ -218,12 +218,12 @@ test: test/setup ## Run tests against CockroachDB and Postgres (developer) .PHONY: test-sim test-sim: ## Test source with storj-sim (jenkins) @echo "Running ${@}" - @./scripts/test-sim.sh + @./scripts/tests/integration/test-sim.sh .PHONY: test-sim-redis-unavailability test-sim-redis-unavailability: ## Test source with Redis availability with storj-sim (jenkins) @echo "Running ${@}" - @./scripts/test-sim-redis-up-and-down.sh + @./scripts/tests/redis/test-sim-redis-up-and-down.sh .PHONY: test-certificates @@ -234,7 +234,7 @@ test-certificates: ## Test certificate signing service and storagenode setup (je .PHONY: test-sim-backwards-compatible test-sim-backwards-compatible: ## Test uploading a file with lastest release (jenkins) @echo "Running ${@}" - @./scripts/test-sim-backwards.sh + @./scripts/tests/backwardcompatibility/test-sim-backwards.sh .PHONY: check-monitoring check-monitoring: ## Check for locked monkit calls that have changed diff --git a/scripts/install-awscli.sh b/scripts/install-awscli.sh deleted file mode 100644 index 7d8f673d7..000000000 --- a/scripts/install-awscli.sh +++ /dev/null @@ -1,12 +0,0 @@ -set -x - -mkdir -p $HOME/awscli -pushd $HOME/awscli - -curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" -unzip awscli-bundle.zip -./awscli-bundle/install -b ~/bin/aws - -popd - -set +x diff --git a/scripts/test-backwards.sh b/scripts/tests/backwardcompatibility/test-backwards.sh similarity index 96% rename from scripts/test-backwards.sh rename to scripts/tests/backwardcompatibility/test-backwards.sh index 58ac3b01a..688d7c34d 100755 --- a/scripts/test-backwards.sh +++ b/scripts/tests/backwardcompatibility/test-backwards.sh @@ -2,7 +2,7 @@ set -ueo pipefail SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -source $SCRIPTDIR/utils.sh +source $SCRIPTDIR/../../utils.sh TMPDIR=$(mktemp -d -t tmp.XXXXXXXXXX) @@ -31,7 +31,7 @@ PRISTINE_FILES_DIR="$STORJ_NETWORK_DIR/pristine/$BUCKET" DOWNLOAD_FILES_DIR="$STORJ_NETWORK_DIR/download/$BUCKET" # override configured access with access where address is node ID + satellite addess -STORJ_ACCESS=$(go run "$SCRIPTDIR"/update-access.go "$SATELLITE_0_DIR" "$GATEWAY_0_ACCESS") +STORJ_ACCESS=$(go run "$SCRIPTDIR"/../../update-access.go "$SATELLITE_0_DIR" "$GATEWAY_0_ACCESS") UPLINK_ACCESS="$STORJ_ACCESS" export STORJ_ACCESS diff --git a/scripts/test-sim-backwards-dev.sh b/scripts/tests/backwardcompatibility/test-sim-backwards-dev.sh similarity index 85% rename from scripts/test-sim-backwards-dev.sh rename to scripts/tests/backwardcompatibility/test-sim-backwards-dev.sh index 5ea55acd8..ce6abb1ad 100755 --- a/scripts/test-sim-backwards-dev.sh +++ b/scripts/tests/backwardcompatibility/test-sim-backwards-dev.sh @@ -2,7 +2,7 @@ SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -source $SCRIPTDIR/postgres-dev.sh +source $SCRIPTDIR/../postgres-dev.sh export STORJ_MIGRATION_DB="${STORJ_SIM_POSTGRES}&options=--search_path=satellite/0/meta" diff --git a/scripts/test-sim-backwards.sh b/scripts/tests/backwardcompatibility/test-sim-backwards.sh similarity index 100% rename from scripts/test-sim-backwards.sh rename to scripts/tests/backwardcompatibility/test-sim-backwards.sh diff --git a/scripts/test-billing.sh b/scripts/tests/integration/test-billing.sh similarity index 100% rename from scripts/test-billing.sh rename to scripts/tests/integration/test-billing.sh diff --git a/scripts/test-sim-dev.sh b/scripts/tests/integration/test-sim-dev.sh similarity index 76% rename from scripts/test-sim-dev.sh rename to scripts/tests/integration/test-sim-dev.sh index 4de19cbbc..728d3b428 100755 --- a/scripts/test-sim-dev.sh +++ b/scripts/tests/integration/test-sim-dev.sh @@ -2,6 +2,6 @@ SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -source $SCRIPTDIR/postgres-dev.sh +source $SCRIPTDIR/../postgres-dev.sh $SCRIPTDIR/test-sim.sh \ No newline at end of file diff --git a/scripts/test-sim.sh b/scripts/tests/integration/test-sim.sh similarity index 98% rename from scripts/test-sim.sh rename to scripts/tests/integration/test-sim.sh index 7da5456e5..6d9286a22 100755 --- a/scripts/test-sim.sh +++ b/scripts/tests/integration/test-sim.sh @@ -12,7 +12,7 @@ cleanup(){ trap cleanup EXIT echo "Running test-sim" -make -C "$SCRIPTDIR"/.. install-sim +make -C "$SCRIPTDIR"/../../.. install-sim echo "Overriding default max segment size to 6MiB" GOBIN=$TMP go install -v -ldflags "-X 'storj.io/uplink.maxSegmentSize=6MiB'" storj.io/storj/cmd/uplink diff --git a/scripts/test-uplink-rs-download.sh b/scripts/tests/integration/test-uplink-rs-download.sh similarity index 100% rename from scripts/test-uplink-rs-download.sh rename to scripts/tests/integration/test-uplink-rs-download.sh diff --git a/scripts/test-uplink-rs-upload.sh b/scripts/tests/integration/test-uplink-rs-upload.sh similarity index 100% rename from scripts/test-uplink-rs-upload.sh rename to scripts/tests/integration/test-uplink-rs-upload.sh diff --git a/scripts/test-uplink-share.sh b/scripts/tests/integration/test-uplink-share.sh similarity index 98% rename from scripts/test-uplink-share.sh rename to scripts/tests/integration/test-uplink-share.sh index b0d05f366..abe3debe9 100644 --- a/scripts/test-uplink-share.sh +++ b/scripts/tests/integration/test-uplink-share.sh @@ -1,25 +1,26 @@ #!/usr/bin/env bash SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -source $SCRIPTDIR/utils.sh +source $SCRIPTDIR/../../utils.sh TMPDIR=$(mktemp -d -t tmp.XXXXXXXXXX) cleanup(){ - rm -rf "$TMPDIR" uplink rm "sj://$BUCKET_WITH_ACCESS/$FOLDER_TO_SHARE_FILE/testfile" uplink rm "sj://$BUCKET_WITH_ACCESS/another-testfile" uplink rm "sj://$BUCKET_WITHOUT_ACCESS/another-testfile" uplink rb "sj://$BUCKET_WITHOUT_ACCESS" uplink rb "sj://$BUCKET_WITH_ACCESS" + rm -rf "$TMPDIR" echo "cleaned up test successfully" } trap cleanup EXIT trap 'failure ${LINENO} "$BASH_COMMAND"' ERR +export UPLINK_CONFIG_DIR=$TMPDIR/uplink + # workaround for issues with automatic accepting monitoring question # with first run we need to accept question y/n about monitoring -export UPLINK_CONFIG_DIR=$TMPDIR/uplink mkdir -p "$UPLINK_CONFIG_DIR" touch "$UPLINK_CONFIG_DIR/config.ini" diff --git a/scripts/test-uplink.sh b/scripts/tests/integration/test-uplink.sh similarity index 99% rename from scripts/test-uplink.sh rename to scripts/tests/integration/test-uplink.sh index e599dfd38..7f322a5fe 100755 --- a/scripts/test-uplink.sh +++ b/scripts/tests/integration/test-uplink.sh @@ -2,7 +2,7 @@ set -ueo pipefail SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -source $SCRIPTDIR/utils.sh +source $SCRIPTDIR/../../utils.sh TMPDIR=$(mktemp -d -t tmp.XXXXXXXXXX) diff --git a/scripts/postgres-dev.sh b/scripts/tests/postgres-dev.sh similarity index 100% rename from scripts/postgres-dev.sh rename to scripts/tests/postgres-dev.sh diff --git a/scripts/redis-server.sh b/scripts/tests/redis/redis-server.sh similarity index 100% rename from scripts/redis-server.sh rename to scripts/tests/redis/redis-server.sh diff --git a/scripts/test-sim-redis-up-and-down-dev.sh b/scripts/tests/redis/test-sim-redis-up-and-down-dev.sh similarity index 83% rename from scripts/test-sim-redis-up-and-down-dev.sh rename to scripts/tests/redis/test-sim-redis-up-and-down-dev.sh index 4bc7a3d92..51cb8d1ef 100755 --- a/scripts/test-sim-redis-up-and-down-dev.sh +++ b/scripts/tests/redis/test-sim-redis-up-and-down-dev.sh @@ -4,6 +4,6 @@ SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" export STORJ_REDIS_PORT=7379 # shellcheck source=/postgres-dev.sh -source "${SCRIPTDIR}/postgres-dev.sh" +source "${SCRIPTDIR}/../postgres-dev.sh" "${SCRIPTDIR}/test-sim-redis-up-and-down.sh" diff --git a/scripts/test-sim-redis-up-and-down.sh b/scripts/tests/redis/test-sim-redis-up-and-down.sh similarity index 93% rename from scripts/test-sim-redis-up-and-down.sh rename to scripts/tests/redis/test-sim-redis-up-and-down.sh index aaf261c6f..8b3c7678e 100755 --- a/scripts/test-sim-redis-up-and-down.sh +++ b/scripts/tests/redis/test-sim-redis-up-and-down.sh @@ -32,7 +32,7 @@ cleanup() { trap cleanup ERR EXIT echo "install sim" -make -C "$SCRIPT_DIR"/.. install-sim +make -C "$SCRIPT_DIR"/../../.. install-sim echo "overriding default max segment size to 6MiB" GOBIN="${TMP_DIR}" go install -v -ldflags "-X 'storj.io/uplink.maxSegmentSize=6MiB'" storj.io/storj/cmd/uplink @@ -56,4 +56,4 @@ storj-sim --failfast -x --satellites 1 --host "${STORJ_NETWORK_HOST4}" network \ # run test that checks that the satellite runs despite of not being able to connect to Redis "${SCRIPT_DIR}/redis-server.sh" stop storj-sim --failfast -x --satellites 1 --host "${STORJ_NETWORK_HOST4}" network \ - --redis="127.0.0.1:6379" test bash "${SCRIPT_DIR}/test-uplink.sh" + --redis="127.0.0.1:6379" test bash "${SCRIPT_DIR}/../integration/test-uplink.sh" diff --git a/scripts/test-uplink-redis-up-and-down.sh b/scripts/tests/redis/test-uplink-redis-up-and-down.sh similarity index 99% rename from scripts/test-uplink-redis-up-and-down.sh rename to scripts/tests/redis/test-uplink-redis-up-and-down.sh index a2221cf7d..7d04487df 100755 --- a/scripts/test-uplink-redis-up-and-down.sh +++ b/scripts/tests/redis/test-uplink-redis-up-and-down.sh @@ -4,7 +4,8 @@ set +x # constants SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" -source $SCRIPT_DIR/utils.sh +source $SCRIPT_DIR/../../utils.sh + readonly SCRIPT_DIR BUCKET="bucket-123"