From 6ed06f74ec4f8c351b2f22559fa666f788972d30 Mon Sep 17 00:00:00 2001 From: John Gee Date: Wed, 14 Dec 2022 19:54:59 +1300 Subject: [PATCH] Remove tests support for running over proxy and remove ArchLinux from tests (#750) --- bin/{ => dev}/release | 0 test/bin/proxy-build | 49 ---------------------- test/bin/proxy-run | 12 ------ test/bin/run-all-tests | 2 +- test/config/.curlrc | 2 - test/config/.wgetrc | 2 - test/docker-base.yml | 7 ---- test/docker-compose.yml | 7 ---- test/dockerfiles/Dockerfile-archlinux-curl | 3 -- test/tests.md | 16 ------- test/tests/install-reference-versions.bash | 16 ------- 11 files changed, 1 insertion(+), 115 deletions(-) rename bin/{ => dev}/release (100%) delete mode 100755 test/bin/proxy-build delete mode 100755 test/bin/proxy-run delete mode 100644 test/config/.curlrc delete mode 100644 test/config/.wgetrc delete mode 100644 test/dockerfiles/Dockerfile-archlinux-curl delete mode 100755 test/tests/install-reference-versions.bash diff --git a/bin/release b/bin/dev/release similarity index 100% rename from bin/release rename to bin/dev/release diff --git a/test/bin/proxy-build b/test/bin/proxy-build deleted file mode 100755 index 47198b9..0000000 --- a/test/bin/proxy-build +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env bash -# Unoffical bash safe mode -set -euo pipefail -BIN_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - -waitproxy() { - while ! nc -z localhost 8080 ; do sleep 1 ; done -} - -if nc -z localhost 8080; then - echo "Error: port 8080 already in use. Is mitmdump already running?" - pgrep -f -l mitmdump - exit 2 -fi - -echo "Launching proxy..." -mitmdump -w proxy~~.dump &> /dev/null & -mitm_process="$!" -echo "Waiting for proxy..." -waitproxy - -echo "Recording downloads..." - -source tests/shared-functions.bash -unset_n_env -setup_tmp_prefix - -# Hack curl to avoid certificate issues with proxy -readonly CURL_HOME="$(dirname "${BIN_DIRECTORY}")/config" -export CURL_HOME - -# Go through proxy so it can record traffic, http for taobao redirects -http_proxy="$(hostname):8080" -export http_proxy -https_proxy="$(hostname):8080" -export https_proxy - -# Need to do wget first, as curl gets compressed index.tab which will break wget. -# linux, archlinux-curl gets gz archives -docker-compose run archlinux-curl /mnt/test/tests/install-reference-versions.bash -# linux, ubuntu-curl would get compressed index and gz archives -docker-compose run ubuntu-wget /mnt/test/tests/install-reference-versions.bash -# native -tests/install-reference-versions.bash - -rm -rf "${TMP_PREFIX_DIR}" -echo "Stopping proxy" -kill "${mitm_process}" - diff --git a/test/bin/proxy-run b/test/bin/proxy-run deleted file mode 100755 index 1cd303b..0000000 --- a/test/bin/proxy-run +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -BIN_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - -echo "" -echo "To make use of proxy server:" -echo " export https_proxy=\"$(hostname):8080\"" -echo " export http_proxy=\"$(hostname):8080\"" -echo " export CURL_HOME=$(dirname "${BIN_DIRECTORY}")/config" -echo "" - -echo "Launching proxy server..." -mitmdump --server-replay-nopop --server-replay proxy~~.dump diff --git a/test/bin/run-all-tests b/test/bin/run-all-tests index 3b79117..0f55471 100755 --- a/test/bin/run-all-tests +++ b/test/bin/run-all-tests @@ -2,7 +2,7 @@ BIN_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # We want to cover curl and wget especially, gz and xz and variety of OS a bonus. -services=( archlinux-curl ubuntu-wget ) +services=( ubuntu-curl ubuntu-wget ) cd "$(dirname "${BIN_DIRECTORY}")" || exit 2 for service in "${services[@]}" ; do diff --git a/test/config/.curlrc b/test/config/.curlrc deleted file mode 100644 index 9036dc9..0000000 --- a/test/config/.curlrc +++ /dev/null @@ -1,2 +0,0 @@ -# Allow use of mitm proxy ---insecure diff --git a/test/config/.wgetrc b/test/config/.wgetrc deleted file mode 100644 index 4a24e3f..0000000 --- a/test/config/.wgetrc +++ /dev/null @@ -1,2 +0,0 @@ -# Allow use of mitm proxy -check_certificate = off diff --git a/test/docker-base.yml b/test/docker-base.yml index 1aeadb1..6d1a26b 100644 --- a/test/docker-base.yml +++ b/test/docker-base.yml @@ -16,10 +16,3 @@ services: - ../node_modules/bats-assert:/mnt/node_modules/bats-assert # the n script - ../bin/n:/usr/local/bin/n - # override settings to allow insecure connection in case using mitm proxy - - ./config/.curlrc:/root/.curlrc - - ./config/.wgetrc:/root/.wgetrc - environment: - # pass through proxy settings to allow caching proxy - - http_proxy - - https_proxy diff --git a/test/docker-compose.yml b/test/docker-compose.yml index 9cf77e7..dc5b658 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -14,10 +14,3 @@ services: build: context: dockerfiles dockerfile: Dockerfile-ubuntu-wget - archlinux-curl: - extends: - file: ./docker-base.yml - service: testbed - build: - context: dockerfiles - dockerfile: Dockerfile-archlinux-curl diff --git a/test/dockerfiles/Dockerfile-archlinux-curl b/test/dockerfiles/Dockerfile-archlinux-curl deleted file mode 100644 index f5f2f0a..0000000 --- a/test/dockerfiles/Dockerfile-archlinux-curl +++ /dev/null @@ -1,3 +0,0 @@ -FROM archlinux:latest - -CMD ["/bin/bash"] diff --git a/test/tests.md b/test/tests.md index 53e6e88..8b9f2b8 100644 --- a/test/tests.md +++ b/test/tests.md @@ -28,22 +28,6 @@ Run single test on a single system:: npx bats tests/install-contents.bats docker-compose run ubuntu-curl bats /mnt/test/tests/install-contents.bats -## Proxy - -To speed up running tests multiple times, you can optionally run a caching proxy for the node downloads. The curl settings are modified -to allow an insecure connection through the mitm proxy. - - cd test - bin/proxy-build - bin/proxy-run - # follow the instructions for configuring environment variables for using proxy, then run tests - -`node` versions added to proxy cache (and used in tests): - -* v4.9.1 -* lts -* latest - ## Docker Tips Using `docker-compose` in addition to `docker` for convenient mounting of `n` script and the tests into the container. Changes to the tests or to `n` itself are reflected immediately without needing to rebuild the containers. diff --git a/test/tests/install-reference-versions.bash b/test/tests/install-reference-versions.bash deleted file mode 100755 index 72ccd4e..0000000 --- a/test/tests/install-reference-versions.bash +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -# These are the versions installed and hence cached by proxy-build. - -# Run commands we want to cache downloads for. - -# Get index into cache for lookups of expected versions. Uncompressed. -curl --location --fail https://nodejs.org/dist/index.tab &> /dev/null -curl --location --fail https://nodejs.org/download/nightly/index.tab &> /dev/null - -# Using 4.9.1 as a well known old version (which is no longer getting updated so does not change) -n --download 4 -n --download lts -n --download latest -n --download nightly/latest -N_NODE_MIRROR=https://npmmirror.com/mirrors/node n --download 6.11