aboutsummaryrefslogtreecommitdiff
path: root/tests/submit/submit-git.testscript
diff options
context:
space:
mode:
Diffstat (limited to 'tests/submit/submit-git.testscript')
-rw-r--r--tests/submit/submit-git.testscript67
1 files changed, 51 insertions, 16 deletions
diff --git a/tests/submit/submit-git.testscript b/tests/submit/submit-git.testscript
index 8cdb29a..5197afc 100644
--- a/tests/submit/submit-git.testscript
+++ b/tests/submit/submit-git.testscript
@@ -9,19 +9,23 @@
#
# test.redirects += 2>!
-g = git 2>! >&2
+g = [cmdline] git 2>! >&2
# Create and clone the reference repository.
#
root_ref = $~/ref.git
root_ref_dir = $~/ref
-clone_root_ref = cp --no-cleanup -r $root_ref ./ &ref.git/***
+clone_root_ref = [cmdline] cp --no-cleanup -r $root_ref ./ &ref.git/***
+mkdir --no-cleanup $root_ref
+$g -C $root_ref init --bare &ref.git/***
-+$g clone $root_ref $root_ref_dir &ref/***
+# Convert specific warnings to infos as we expect them to appear. This, in
+# particular, prevents bbot workers to set task result status to warning.
+#
++git clone $root_ref $root_ref_dir &ref/*** 2>&1 | \
+ sed -e 's/warning: (.*cloned an empty repository.*)/info: \1/' >&2 2>!
+cat <<EOI >=$root_ref_dir/submit.config.bash
sections[alpha]=1/alpha
@@ -44,7 +48,7 @@ root_tgt_url = "file:///$~/tgt.git"
+cp -r $root_ref $root_tgt
-clone_root_tgt = cp --no-cleanup -r $root_tgt ./ &tgt.git/***
+clone_root_tgt = [cmdline] cp --no-cleanup -r $root_tgt ./ &tgt.git/***
# Extract the package repository.
#
@@ -466,21 +470,14 @@ pkg_ctl="$prj_ctl/hello.git"
sections['*']=1/alpha
EOI
- # Add the libhello/0.1.0+1 package revision to the target repository.
- #
- tar -xf $data_dir/libhello-0.1.0.tar.gz &libhello-0.1.0/***;
- sed -i -e 's/(version: 0.1.0)/\1+1/' libhello-0.1.0/manifest;
- mv libhello-0.1.0 libhello-0.1.0+1;
- mkdir -p tgt/1/alpha/hello/;
- tar cfz tgt/1/alpha/hello/libhello-0.1.0+1.tar.gz libhello-0.1.0+1;
- $g -C tgt add 1/;
-
$g -C tgt config user.name 'Test Script';
$g -C tgt config user.email 'testscript@example.com';
$g -C tgt commit -am 'Add config and archive';
$g -C tgt push;
- $* "file:///$~/tgt.git" $data_dir >>"EOO" &tgt/1/alpha/hello/libhello-0.1.0.tar.gz;
+ # Initial submission.
+ #
+ $* "file:///$~/tgt.git" $data_dir >>"EOO";
: 1
status: 200
message: package submission is queued: libhello/0.1.0
@@ -489,8 +486,46 @@ pkg_ctl="$prj_ctl/hello.git"
$g -C tgt pull;
- test -f tgt/1/alpha/hello/libhello-0.1.0+1.tar.gz == 1;
- test -f tgt/1/alpha/hello/libhello-0.1.0.tar.gz
+ test -f tgt/1/alpha/hello/libhello-0.1.0.tar.gz;
+
+ # Revision submission.
+ #
+ # Here we test that the handler removes the previous revision.
+ #
+ $clone_root_data_clean;
+
+ tar -xf $~/$data_dir/libhello-0.1.0.tar.gz;
+ sed -i -e 's/(version: 0.1.0)/\1+1/' libhello-0.1.0/manifest;
+ mv libhello-0.1.0 libhello-0.1.0+1;
+ tar cfz $~/$data_dir/libhello-0.1.0+1.tar.gz libhello-0.1.0+1;
+ rm -r libhello-0.1.0+1;
+ rm $~/$data_dir/libhello-0.1.0.tar.gz;
+ sed -i -e 's/(archive: libhello-0.1.0)(.tar.gz)/\1+1\2/' $data_dir/request.manifest;
+
+ $* "file:///$~/tgt.git" $data_dir >>"EOO" &tgt/1/alpha/hello/libhello-0.1.0+1.tar.gz;
+ : 1
+ status: 200
+ message: package submission is queued: libhello/0.1.0+1
+ reference: $checksum
+ EOO
+
+ $g -C tgt pull;
+
+ test -f tgt/1/alpha/hello/libhello-0.1.0.tar.gz == 1;
+ test -f tgt/1/alpha/hello/libhello-0.1.0+1.tar.gz;
+
+ # While at it, test the older revision submission.
+ #
+ $clone_root_data_clean;
+
+ $* "file:///$~/tgt.git" $data_dir >>"EOO";
+ : 1
+ status: 422
+ message: newer revision libhello/0.1.0+1 is present
+ reference: $checksum
+ EOO
+
+ test -f tgt/1/alpha/hello/libhello-0.1.0+1.tar.gz
}
: section-fallback