-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add tests for the bintray commands
Only one test is added for now as a proof of concept.
- Loading branch information
1 parent
2969c58
commit bef9697
Showing
10 changed files
with
95 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
bintray commands tests | ||
====================== | ||
|
||
Tests for the `upload` subcommand should live in the `upload` directory, and | ||
each file in that directory is a separate test and should have the following | ||
format: | ||
``` | ||
CMD | ||
RET | ||
OUT | ||
... | ||
``` | ||
|
||
Where: | ||
|
||
- `CMD` is the full command to run (one line). | ||
- `RET` is the expected return code for the command (one line). | ||
- `OUT` is the expected output of the command. If `RET` is `0`, then this is | ||
expected to be the *stdout* output. Otherwise is expected to be the *stderr* | ||
output (multiple lines, all until the end of the file is considered the | ||
output). |
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,42 @@ | ||
#!/bin/sh | ||
set -u | ||
|
||
stdout=$(mktemp beaver.test.stdout.XXXXXXXX) | ||
stderr=$(mktemp beaver.test.stderr.XXXXXXXX) | ||
expout=$(mktemp beaver.test.expout.XXXXXXXX) | ||
|
||
trap 'r=$?; rm -f "$stdout" "$stderr" "$expout"; exit $r' EXIT | ||
|
||
# Default DIST | ||
export DIST=xenial | ||
|
||
ret=0 | ||
|
||
for f in upload/* | ||
do | ||
echo "running $(basename "$f"): $(sed -n 1p < "$f")" | ||
eval $(sed -n 1p < "$f") > "$stdout" 2> "$stderr" | ||
r=$? | ||
|
||
expected_r=$(sed -n 2p < "$f") | ||
if test "$r" -ne "$expected_r" | ||
then | ||
echo "Error: Return is $r, expected $expected_r" >&2 | ||
ret=1 | ||
fi | ||
|
||
if test $r -eq 0 | ||
then | ||
out="$stdout" | ||
else | ||
out="$stderr" | ||
fi | ||
|
||
sed '1,2d' < "$f" > "$expout" | ||
diff -u "$expout" "$out" || ret=1 | ||
|
||
test "$ret" -ne 0 && | ||
exit $ret | ||
done | ||
|
||
exit $ret |
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,4 @@ | ||
BINTRAY_USER=user TRAVIS_TAG=not-a-tag TRAVIS_REPO_SLUG=sociomantic/test beaver bintray upload -N -k test -n pkg.deb | ||
0 | ||
jfrog bt version-create --desc= --vcs-tag=not-a-tag --released= sociomantic/test/test/not-a-tag | ||
jfrog bt upload --publish=true --override=false --deb=xenial/prerelease/pkg.deb pkg.deb sociomantic/test/test/not-a-tag |
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,4 @@ | ||
BINTRAY_USER=user TRAVIS_TAG=not-a-tag TRAVIS_REPO_SLUG=sociomantic/test beaver bintray upload -D bionic -N -k test -n pkg.deb | ||
0 | ||
jfrog bt version-create --desc= --vcs-tag=not-a-tag --released= sociomantic/test/test/not-a-tag | ||
jfrog bt upload --publish=true --override=false --deb=bionic/prerelease/pkg.deb pkg.deb sociomantic/test/test/not-a-tag |
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,4 @@ | ||
BINTRAY_USER=user TRAVIS_TAG=v0.0.1-pre.1 TRAVIS_REPO_SLUG=sociomantic/test beaver bintray upload -N -k test -n pkg.deb | ||
0 | ||
jfrog bt version-create --desc= --vcs-tag=v0.0.1-pre.1 --released= sociomantic/test/test/v0.0.1-pre.1 | ||
jfrog bt upload --publish=true --override=false --deb=xenial/prerelease/pkg.deb pkg.deb sociomantic/test/test/v0.0.1-pre.1 |
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,4 @@ | ||
BINTRAY_USER=user TRAVIS_TAG=v0.0.1-alpha TRAVIS_REPO_SLUG=sociomantic/test beaver bintray upload -N -k test -n pkg.deb | ||
0 | ||
jfrog bt version-create --desc= --vcs-tag=v0.0.1-alpha --released= sociomantic/test/test/v0.0.1-alpha | ||
jfrog bt upload --publish=true --override=false --deb=xenial/prerelease/pkg.deb pkg.deb sociomantic/test/test/v0.0.1-alpha |
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,4 @@ | ||
BINTRAY_USER=user TRAVIS_TAG=v0.0.1-beta.10 TRAVIS_REPO_SLUG=sociomantic/test beaver bintray upload -N -k test -n pkg.deb | ||
0 | ||
jfrog bt version-create --desc= --vcs-tag=v0.0.1-beta.10 --released= sociomantic/test/test/v0.0.1-beta.10 | ||
jfrog bt upload --publish=true --override=false --deb=xenial/prerelease/pkg.deb pkg.deb sociomantic/test/test/v0.0.1-beta.10 |
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,4 @@ | ||
BINTRAY_USER=user TRAVIS_TAG=v0.0.1-rc.1 TRAVIS_REPO_SLUG=sociomantic/test beaver bintray upload -N -k test -n pkg.deb | ||
0 | ||
jfrog bt version-create --desc= --vcs-tag=v0.0.1-rc.1 --released= sociomantic/test/test/v0.0.1-rc.1 | ||
jfrog bt upload --publish=true --override=false --deb=xenial/prerelease/pkg.deb pkg.deb sociomantic/test/test/v0.0.1-rc.1 |
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,4 @@ | ||
BINTRAY_USER=user TRAVIS_TAG=v0.0.1 TRAVIS_REPO_SLUG=sociomantic/test beaver bintray upload -N -k test -n pkg.deb | ||
0 | ||
jfrog bt version-create --desc= --vcs-tag=v0.0.1 --released= sociomantic/test/test/v0.0.1 | ||
jfrog bt upload --publish=true --override=false --deb=xenial/release/pkg.deb pkg.deb sociomantic/test/test/v0.0.1 |
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,4 @@ | ||
BINTRAY_USER=user TRAVIS_TAG=not-a-tag TRAVIS_REPO_SLUG=sociomantic/test beaver bintray upload -N -C comp -k api-key -n lala.deb | ||
0 | ||
jfrog bt version-create --desc= --vcs-tag=not-a-tag --released= sociomantic/test/test/not-a-tag | ||
jfrog bt upload --publish=true --override=false --deb=xenial/comp/lala.deb lala.deb sociomantic/test/test/not-a-tag |