Skip to content

Commit

Permalink
testsuite: Use built dub, not system one in more tests
Browse files Browse the repository at this point in the history
Some places were missed during the last fixups.
  • Loading branch information
Geod24 committed Aug 27, 2020
1 parent ffb9609 commit a547115
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 33 deletions.
18 changes: 9 additions & 9 deletions test/fetchzip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ DIR=$(dirname "${BASH_SOURCE[0]}")

PORT=$(getRandomPort)

$DUB remove gitcompatibledubpackage --non-interactive 2>/dev/null || true
${DUB} remove gitcompatibledubpackage --non-interactive 2>/dev/null || true

"$DUB" build --single "$DIR"/test_registry.d
${DUB} build --single "$DIR"/test_registry.d
"$DIR"/test_registry --folder="$DIR/issue1336-registry" --port=$PORT &
PID=$!
sleep 1
trap 'kill $PID 2>/dev/null || true' exit

echo "Trying to download gitcompatibledubpackage (1.0.4)"
timeout 1s "$DUB" fetch gitcompatibledubpackage --version=1.0.4 --skip-registry=all --registry=http://localhost:$PORT
timeout 1s ${DUB} fetch gitcompatibledubpackage --version=1.0.4 --skip-registry=all --registry=http://localhost:$PORT
if [ $? -eq 124 ]; then
die $LINENO 'Fetching from responsive registry should not time-out.'
fi
$DUB remove gitcompatibledubpackage --non-interactive --version=1.0.4
${DUB} remove gitcompatibledubpackage --non-interactive --version=1.0.4

echo "Downloads should be retried when the zip is corrupted - gitcompatibledubpackage (1.0.3)"
zipOut=$(! timeout 1s "$DUB" fetch gitcompatibledubpackage --version=1.0.3 --skip-registry=all --registry=http://localhost:$PORT 2>&1)
zipOut=$(! timeout 1s ${DUB} fetch gitcompatibledubpackage --version=1.0.3 --skip-registry=all --registry=http://localhost:$PORT 2>&1)
rc=$?

if ! zipCount=$(grep -Fc 'Failed to extract zip archive' <<<"$zipOut") || [ "$zipCount" -lt 3 ] ; then
Expand All @@ -32,12 +32,12 @@ if ! zipCount=$(grep -Fc 'Failed to extract zip archive' <<<"$zipOut") || [ "$zi
elif [ $rc -eq 124 ]; then
die $LINENO 'DUB timed out unexpectedly.'
fi
if dub remove gitcompatibledubpackage --non-interactive 2>/dev/null; then
if ${DUB} remove gitcompatibledubpackage --non-interactive 2>/dev/null; then
die $LINENO 'DUB should not have installed a broken package.'
fi

echo "HTTP status errors on downloads should be retried - gitcompatibledubpackage (1.0.2)"
retryOut=$(! timeout 1s "$DUB" fetch gitcompatibledubpackage --version=1.0.2 --skip-registry=all --registry=http://localhost:$PORT --vverbose 2>&1)
retryOut=$(! timeout 1s ${DUB} fetch gitcompatibledubpackage --version=1.0.2 --skip-registry=all --registry=http://localhost:$PORT --vverbose 2>&1)
rc=$?
if ! retryCount=$(echo "$retryOut" | grep -Fc 'Bad Gateway') || [ "$retryCount" -lt 3 ] ; then
echo '========== +Output was ==========' >&2
Expand All @@ -47,7 +47,7 @@ if ! retryCount=$(echo "$retryOut" | grep -Fc 'Bad Gateway') || [ "$retryCount"
elif [ $rc -eq 124 ]; then
die $LINENO 'DUB timed out unexpectedly.'
fi
if $DUB remove gitcompatibledubpackage --non-interactive 2>/dev/null; then
if ${DUB} remove gitcompatibledubpackage --non-interactive 2>/dev/null; then
die $LINENO 'DUB should not have installed a package.'
fi

Expand All @@ -56,4 +56,4 @@ timeout 1s "$DUB" fetch gitcompatibledubpackage --version=1.0.2 --skip-registry=
if [ $? -eq 124 ]; then
die $LINENO 'Fetching from responsive registry should not time-out.'
fi
$DUB remove gitcompatibledubpackage --non-interactive --version=1.0.2
${DUB} remove gitcompatibledubpackage --non-interactive --version=1.0.2
16 changes: 8 additions & 8 deletions test/issue1401-filesystem-supplier.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@ DIR=$(dirname "${BASH_SOURCE[0]}")

. "$DIR"/common.sh

dub remove fs-json-dubpackage --non-interactive 2>/dev/null || true
dub remove fs-sdl-dubpackage --non-interactive 2>/dev/null || true
${DUB} remove fs-json-dubpackage --non-interactive 2>/dev/null || true
${DUB} remove fs-sdl-dubpackage --non-interactive 2>/dev/null || true

echo "Trying to get fs-sdl-dubpackage (1.0.5)"
"$DUB" fetch fs-sdl-dubpackage --version=1.0.5 --skip-registry=all --registry=file://"$DIR"/issue1401-file-system-pkg-supplier
${DUB} fetch fs-sdl-dubpackage --version=1.0.5 --skip-registry=all --registry=file://"$DIR"/issue1401-file-system-pkg-supplier

if ! dub remove fs-sdl-dubpackage --non-interactive --version=1.0.5 2>/dev/null; then
if ! ${DUB} remove fs-sdl-dubpackage --non-interactive --version=1.0.5 2>/dev/null; then
die $LINENO 'DUB did not install package from file system.'
fi

echo "Trying to get fs-sdl-dubpackage (latest)"
"$DUB" fetch fs-sdl-dubpackage --skip-registry=all --registry=file://"$DIR"/issue1401-file-system-pkg-supplier
${DUB} fetch fs-sdl-dubpackage --skip-registry=all --registry=file://"$DIR"/issue1401-file-system-pkg-supplier

if ! dub remove fs-sdl-dubpackage --non-interactive --version=1.0.6 2>/dev/null; then
if ! ${DUB} remove fs-sdl-dubpackage --non-interactive --version=1.0.6 2>/dev/null; then
die $LINENO 'DUB did not install latest package from file system.'
fi

echo "Trying to get fs-json-dubpackage (1.0.7)"
"$DUB" fetch fs-json-dubpackage --version=1.0.7 --skip-registry=all --registry=file://"$DIR"/issue1401-file-system-pkg-supplier
${DUB} fetch fs-json-dubpackage --version=1.0.7 --skip-registry=all --registry=file://"$DIR"/issue1401-file-system-pkg-supplier

if ! dub remove fs-json-dubpackage --non-interactive --version=1.0.7 2>/dev/null; then
if ! ${DUB} remove fs-json-dubpackage --non-interactive --version=1.0.7 2>/dev/null; then
die $LINENO 'DUB did not install package from file system.'
fi
14 changes: 7 additions & 7 deletions test/issue1416-maven-repo-pkg-supplier.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@ DIR=$(dirname "${BASH_SOURCE[0]}")

PORT=$(getRandomPort)

$DUB remove maven-dubpackage --non-interactive 2>/dev/null || true
${DUB} remove maven-dubpackage --non-interactive 2>/dev/null || true

"$DUB" build --single "$DIR"/test_registry.d
${DUB} build --single "$DIR"/test_registry.d
"$DIR"/test_registry --folder="$DIR/issue1416-maven-repo-pkg-supplier" --port=$PORT &
PID=$!
sleep 1
trap 'kill $PID 2>/dev/null || true' exit

echo "Trying to download maven-dubpackage (1.0.5)"
"$DUB" fetch maven-dubpackage --version=1.0.5 --skip-registry=all --registry=mvn+http://localhost:$PORT/maven/release/dubpackages
${DUB} fetch maven-dubpackage --version=1.0.5 --skip-registry=all --registry=mvn+http://localhost:$PORT/maven/release/dubpackages

if ! dub remove maven-dubpackage --non-interactive --version=1.0.5 2>/dev/null; then
if ! ${DUB} remove maven-dubpackage --non-interactive --version=1.0.5 2>/dev/null; then
die $LINENO 'DUB did not install package from maven registry.'
fi

echo "Trying to download maven-dubpackage (latest)"
"$DUB" fetch maven-dubpackage --skip-registry=all --registry=mvn+http://localhost:$PORT/maven/release/dubpackages
${DUB} fetch maven-dubpackage --skip-registry=all --registry=mvn+http://localhost:$PORT/maven/release/dubpackages

if ! dub remove maven-dubpackage --non-interactive --version=1.0.6 2>/dev/null; then
if ! ${DUB} remove maven-dubpackage --non-interactive --version=1.0.6 2>/dev/null; then
die $LINENO 'DUB fetch did not install latest package from maven registry.'
fi

echo "Trying to search (exact) maven-dubpackage"
"$DUB" search maven-dubpackage --skip-registry=all --registry=mvn+http://localhost:$PORT/maven/release/dubpackages | grep -c "maven-dubpackage (1.0.6)"
${DUB} search maven-dubpackage --skip-registry=all --registry=mvn+http://localhost:$PORT/maven/release/dubpackages | grep -c "maven-dubpackage (1.0.6)"
12 changes: 6 additions & 6 deletions test/issue1524-maven-upgrade-dependency-tree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ DIR=$(dirname "${BASH_SOURCE[0]}")

PORT=$(getRandomPort)

dub remove maven-dubpackage-a --non-interactive 2>/dev/null || true
dub remove maven-dubpackage-b --non-interactive 2>/dev/null || true
${DUB} remove maven-dubpackage-a --non-interactive 2>/dev/null || true
${DUB} remove maven-dubpackage-b --non-interactive 2>/dev/null || true

"$DUB" build --single "$DIR"/test_registry.d
${DUB} build --single "$DIR"/test_registry.d
"$DIR"/test_registry --folder="$DIR/issue1524-maven-upgrade-dependency-tree" --port=$PORT &
PID=$!
sleep 1
trap 'kill $PID 2>/dev/null || true' exit

echo "Trying to download maven-dubpackage-a (1.0.5) with dependency to maven-dubpackage-b (1.0.6)"
"$DUB" upgrade --root "$DIR/issue1524-maven-upgrade-dependency-tree" --skip-registry=standard --registry=mvn+http://localhost:$PORT/maven/release/dubpackages
${DUB} upgrade --root "$DIR/issue1524-maven-upgrade-dependency-tree" --skip-registry=standard --registry=mvn+http://localhost:$PORT/maven/release/dubpackages

if ! dub remove maven-dubpackage-a --non-interactive --version=1.0.5 2>/dev/null; then
if ! ${DUB} remove maven-dubpackage-a --non-interactive --version=1.0.5 2>/dev/null; then
die $LINENO 'DUB did not install package "maven-dubpackage-a" from maven registry.'
fi

if ! dub remove maven-dubpackage-b --non-interactive --version=1.0.6 2>/dev/null; then
if ! ${DUB} remove maven-dubpackage-b --non-interactive --version=1.0.6 2>/dev/null; then
die $LINENO 'DUB did not install package "maven-dubpackage-b" from maven registry.'
fi

6 changes: 3 additions & 3 deletions test/issue1567-fetch-sub-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ DIR=$(dirname "${BASH_SOURCE[0]}")
packname="fetch-sub-package-dubpackage"
sub_packagename="my-sub-package"

$DUB remove $packname --non-interactive 2>/dev/null || true
$DUB fetch "$packname:$sub_packagename" --skip-registry=all --registry=file://"$DIR"/issue1567-fetch-sub-package
${DUB} remove $packname --non-interactive 2>/dev/null || true
${DUB} fetch "$packname:$sub_packagename" --skip-registry=all --registry=file://"$DIR"/issue1567-fetch-sub-package

if ! dub remove $packname --non-interactive --version=1.0.1 2>/dev/null; then
if ! ${DUB} remove $packname --non-interactive --version=1.0.1 2>/dev/null; then
die $LINENO 'DUB did not install package $packname:$sub_packagename.'
fi

0 comments on commit a547115

Please sign in to comment.