Skip to content

Commit

Permalink
Testsuite: Replace --version=x.y.z with [email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
Geod24 committed Aug 27, 2020
1 parent a547115 commit 3288bbb
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
12 changes: 6 additions & 6 deletions test/fetchzip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ 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@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@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@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 @@ -37,7 +37,7 @@ if ${DUB} remove gitcompatibledubpackage --non-interactive 2>/dev/null; then
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@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 @@ -52,8 +52,8 @@ if ${DUB} remove gitcompatibledubpackage --non-interactive 2>/dev/null; then
fi

echo "HTTP status errors on downloads should retry with fallback mirror - gitcompatibledubpackage (1.0.2)"
timeout 1s "$DUB" fetch gitcompatibledubpackage --version=1.0.2 --skip-registry=all --registry="http://localhost:$PORT http://localhost:$PORT/fallback"
timeout 1s "$DUB" fetch gitcompatibledubpackage@1.0.2 --skip-registry=all --registry="http://localhost:$PORT http://localhost:$PORT/fallback"
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@1.0.2
8 changes: 4 additions & 4 deletions test/interactive-remove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
# we need to nuke every `dub` version in the user cache...
$DUB remove dub -n || true

$DUB fetch dub --version=1.9.0 && [ -d $HOME/.dub/packages/dub-1.9.0/dub ]
$DUB fetch dub --version=1.10.0 && [ -d $HOME/.dub/packages/dub-1.10.0/dub ]
$DUB fetch dub@1.9.0 && [ -d $HOME/.dub/packages/dub-1.9.0/dub ]
$DUB fetch dub@1.10.0 && [ -d $HOME/.dub/packages/dub-1.10.0/dub ]

echo 1 | $DUB remove dub | tr -d '\n' | grep --ignore-case 'select.*1\.9\.0.*1\.10\.0.*'
if [ -d $HOME/.dub/packages/dub-1.9.0/dub ]; then
die $LINENO 'Failed to remove dub-1.9.0'
fi

$DUB fetch dub --version=1.9.0 && [ -d $HOME/.dub/packages/dub-1.9.0/dub ]
$DUB fetch dub@1.9.0 && [ -d $HOME/.dub/packages/dub-1.9.0/dub ]
# EOF aborts remove
echo -xn '' | $DUB remove dub
if [ ! -d $HOME/.dub/packages/dub-1.9.0/dub ] || [ ! -d $HOME/.dub/packages/dub-1.10.0/dub ]; then
Expand All @@ -30,7 +30,7 @@ if [ -d $HOME/.dub/packages/dub-1.9.0/dub ] || [ -d $HOME/.dub/packages/dub-1.10
die $LINENO 'Failed to remove all version of dub'
fi

$DUB fetch dub --version=1.9.0 && [ -d $HOME/.dub/packages/dub-1.9.0/dub ]
$DUB fetch dub@1.9.0 && [ -d $HOME/.dub/packages/dub-1.9.0/dub ]
$DUB fetch [email protected] && [ -d $HOME/.dub/packages/dub-1.10.0/dub ]
# is non-interactive with `--version=<version-spec>`
$DUB remove [email protected]
Expand Down
2 changes: 1 addition & 1 deletion test/issue1180-local-cache-broken.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ trap 'kill $PID 2>/dev/null || true' exit
echo "Trying to download maven-dubpackage (1.0.5)"
"$DUB" upgrade --root="$DIR/issue1180-local-cache-broken" --cache=local --skip-registry=all --registry=mvn+http://localhost:$PORT/maven/release/dubpackages

if ! "$DUB" remove maven-dubpackage --root="$DIR/issue1180-local-cache-broken" --non-interactive --version=1.0.5 2>/dev/null; then
if ! "$DUB" remove maven-dubpackage@1.0.5 --root="$DIR/issue1180-local-cache-broken" --non-interactive 2>/dev/null; then
die $LINENO 'DUB did not install package from maven registry.'
fi
8 changes: 4 additions & 4 deletions test/issue1401-filesystem-supplier.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ ${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

if ! ${DUB} remove fs-sdl-dubpackage --non-interactive --version=1.0.5 2>/dev/null; then
if ! ${DUB} remove fs-sdl-dubpackage@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

if ! ${DUB} remove fs-sdl-dubpackage --non-interactive --version=1.0.6 2>/dev/null; then
if ! ${DUB} remove fs-sdl-dubpackage@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@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@1.0.7 2>/dev/null; then
die $LINENO 'DUB did not install package from file system.'
fi
6 changes: 3 additions & 3 deletions test/issue1416-maven-repo-pkg-supplier.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ 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@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@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

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

Expand Down
4 changes: 2 additions & 2 deletions test/issue1524-maven-upgrade-dependency-tree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ 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

if ! ${DUB} remove maven-dubpackage-a --non-interactive --version=1.0.5 2>/dev/null; then
if ! ${DUB} remove maven-dubpackage-a@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@1.0.6 2>/dev/null; then
die $LINENO 'DUB did not install package "maven-dubpackage-b" from maven registry.'
fi

2 changes: 1 addition & 1 deletion test/issue1567-fetch-sub-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ 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

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

0 comments on commit 3288bbb

Please sign in to comment.