aboutsummaryrefslogtreecommitdiff
path: root/tests/submit
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2022-04-04 20:34:20 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2022-04-04 22:48:11 +0300
commitb8f351516e4c8cabe808c13e3e47e35ccddc4571 (patch)
tree3246ba5cca9b8fba20e74ec810658d00b172f14f /tests/submit
parent92ce9a3681fa939f1b39326abad62bb264bcd6ac (diff)
Fix submit-pub handler to deny submission of older package version revision
Diffstat (limited to 'tests/submit')
-rw-r--r--tests/submit/submit-pub.testscript46
1 files changed, 37 insertions, 9 deletions
diff --git a/tests/submit/submit-pub.testscript b/tests/submit/submit-pub.testscript
index 07517be..c5d435f 100644
--- a/tests/submit/submit-pub.testscript
+++ b/tests/submit/submit-pub.testscript
@@ -84,14 +84,8 @@ clone_root_rep = cp --no-cleanup -r $root_rep ./ &pkg-1/*** &?pkg.lock
$clone_root_rep;
ln -s pkg-1 pkg;
- # Add the libhello/0.1.0+1 package revision to the repository.
+ # Initial submission.
#
- mkdir --no-cleanup pkg-1/1/hello;
- 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;
- tar cfz pkg-1/1/hello/libhello-0.1.0+1.tar.gz libhello-0.1.0+1;
-
$* $~/pkg $~/$data_dir &!pkg-1/*** &pkg-*/*** >>"EOO";
: 1
status: 200
@@ -99,7 +93,6 @@ clone_root_rep = cp --no-cleanup -r $root_rep ./ &pkg-1/*** &?pkg.lock
reference: $checksum
EOO
- test -f pkg/1/hello/libhello-0.1.0+1.tar.gz == 1;
test -f pkg/1/hello/libhello-0.1.0.tar.gz;
# While at it, test the duplicate submission.
@@ -113,7 +106,42 @@ clone_root_rep = cp --no-cleanup -r $root_rep ./ &pkg-1/*** &?pkg.lock
reference: $checksum
EOO
- test -f pkg/1/hello/libhello-0.1.0.tar.gz
+ test -f pkg/1/hello/libhello-0.1.0.tar.gz;
+
+ # Revision submission.
+ #
+ # Here we test that the handler removes the previous revision.
+ #
+ 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;
+
+ $* $~/pkg $~/$data_dir >>"EOO";
+ : 1
+ status: 200
+ message: package is published: libhello/0.1.0+1
+ reference: $checksum
+ EOO
+
+ test -f pkg/1/hello/libhello-0.1.0.tar.gz == 1;
+ test -f pkg/1/hello/libhello-0.1.0+1.tar.gz;
+
+ # While at it, test the older revision submission.
+ #
+ $clone_root_data_clean;
+
+ $* $~/pkg $~/$data_dir >>"EOO";
+ : 1
+ status: 422
+ message: newer revision libhello/0.1.0+1 is present
+ reference: $checksum
+ EOO
+
+ test -f pkg/1/hello/libhello-0.1.0+1.tar.gz
}
: result-url