aboutsummaryrefslogtreecommitdiff
path: root/tests/submit
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-09-21 17:52:52 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-09-24 19:28:18 +0300
commit8c3da8abdb16ecad007dc60068deb90e151737ea (patch)
treedb69db08961a042dcac9e21d84b7f2c8fe4ba8bc /tests/submit
parent880f96e9325646dc792e1c4e37879f3810b9e8f1 (diff)
Fix submission handler issues arising due to package archive name ambiguity
Now we take into account the fact that the foo-bar-1.0.tar.gz archive may contain either foo-bar/1.0 or foo/bar-1.0 package.
Diffstat (limited to 'tests/submit')
-rw-r--r--tests/submit/submit-git.testscript49
-rw-r--r--tests/submit/submit-pub.testscript18
2 files changed, 58 insertions, 9 deletions
diff --git a/tests/submit/submit-git.testscript b/tests/submit/submit-git.testscript
index c0a31fe..d08a47c 100644
--- a/tests/submit/submit-git.testscript
+++ b/tests/submit/submit-git.testscript
@@ -94,10 +94,10 @@ pkg_ctl="$prj_ctl/hello.git"
: success
:
{
- : ref-unknown-tgt-aquire-prj-pkg
+ : ref-unknown-tgt-acquire-prj-pkg
:
: Test that on the first package submission the project and package names
- : ownership is successfully aquired. Authentication is enabled on both the
+ : ownership is successfully acquired. Authentication is enabled on both the
: reference and target repos.
:
: Note that here we also test that --commiter-* options are picked up
@@ -173,7 +173,7 @@ pkg_ctl="$prj_ctl/hello.git"
: ref-disabled-tgt-aquire-prj-pkg
:
: Test that on the first package submit the project and package names
- : ownership is successfully aquired. Authentication is disabled for the
+ : ownership is successfully acquired. Authentication is disabled for the
: reference repo.
:
{
@@ -203,10 +203,10 @@ pkg_ctl="$prj_ctl/hello.git"
EOO
}
- : ref-absent-tgt-aquire-prj-pkg
+ : ref-absent-tgt-acquire-prj-pkg
:
: Test that on the first package submit the project and package names
- : ownership is successfully aquired. Reference repo is absent.
+ : ownership is successfully acquired. Reference repo is absent.
:
: Note that here we also pass the --result-url option.
:
@@ -436,6 +436,45 @@ pkg_ctl="$prj_ctl/hello.git"
EOO
}
+ : ref-absent-tgt-pkg-rev
+ :
+ : Test that the package revision is removed.
+ :
+ {
+ $clone_root_data;
+
+ $clone_root_tgt;
+ $g clone tgt.git &tgt/***;
+
+ cat <<EOI >=tgt/submit.config.bash;
+ 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 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;
+ : 1
+ status: 200
+ message: package submission is queued: libhello/0.1.0
+ reference: $checksum
+ EOO
+
+ $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
+ }
+
: section-fallback
:
{
diff --git a/tests/submit/submit-pub.testscript b/tests/submit/submit-pub.testscript
index b73d108..78c42b6 100644
--- a/tests/submit/submit-pub.testscript
+++ b/tests/submit/submit-pub.testscript
@@ -76,7 +76,7 @@ clone_root_rep = cp --no-cleanup -r $root_rep ./ &pkg-1/*** &?pkg.lock
: for-real
:
- : Here we create the (fake) package revision which is expected to be removed
+ : Here we also create the package revision which is expected to be removed
: by the handler.
:
{
@@ -84,8 +84,13 @@ clone_root_rep = cp --no-cleanup -r $root_rep ./ &pkg-1/*** &?pkg.lock
$clone_root_rep;
ln -s pkg-1 pkg;
- mkdir --no-cleanup pkg-1/1/prj;
- touch --no-cleanup pkg-1/1/prj/libhello-0.1.0+1.tar.gz;
+ # Add the libhello/0.1.0+1 package revision to the repository.
+ #
+ 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
@@ -94,16 +99,21 @@ 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.
#
$clone_root_data_clean;
- $* $~/pkg $~/$data_dir >>"EOO"
+ $* $~/pkg $~/$data_dir >>"EOO";
: 1
status: 422
message: duplicate submission
reference: $checksum
EOO
+
+ test -f pkg/1/hello/libhello-0.1.0.tar.gz
}
: result-url