aboutsummaryrefslogtreecommitdiff
path: root/tests/submit
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-08-28 17:34:24 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-08-28 23:32:13 +0300
commit05eeac08b63449925cc2e12d2fdaf937d5fa1bbc (patch)
treee448a5ac7f536f165a9b6a50833db7726ab980f5 /tests/submit
parent9ffc9c2c72c57c381a0af44a52f2fe6dff73171c (diff)
Fix submit-git to respond with 422 (client) error if fail to git-clone control URL
Diffstat (limited to 'tests/submit')
-rw-r--r--tests/submit/submit-dir.test6
-rw-r--r--tests/submit/submit-git.test97
2 files changed, 90 insertions, 13 deletions
diff --git a/tests/submit/submit-dir.test b/tests/submit/submit-dir.test
index 055449a..a6a7e3e 100644
--- a/tests/submit/submit-dir.test
+++ b/tests/submit/submit-dir.test
@@ -29,7 +29,7 @@
{
$clone_root_data;
- echo "simulate: success" >+$data_dir/request.manifest;
+ echo 'simulate: success' >+$data_dir/request.manifest;
$* >>"EOO";
: 1
@@ -65,7 +65,7 @@
{
$clone_root_data_clean;
- echo "junk" >=$data_dir/libhello-0.1.0.tar.gz;
+ echo 'junk' >=$data_dir/libhello-0.1.0.tar.gz;
$* >>"EOO"
: 1
@@ -80,7 +80,7 @@
{
$clone_root_data_clean;
- echo "simulate: fly" >+$data_dir/request.manifest;
+ echo 'simulate: fly' >+$data_dir/request.manifest;
$* >>"EOO"
: 1
diff --git a/tests/submit/submit-git.test b/tests/submit/submit-git.test
index 5bfa4d4..f96f79d 100644
--- a/tests/submit/submit-git.test
+++ b/tests/submit/submit-git.test
@@ -151,7 +151,7 @@ pkg_ctl="$prj_ctl/hello.git"
%.*
EOO
- git -C tgt log -1 "--pretty=format:%an %ae %cn %ce" >>:EOO
+ git -C tgt log -1 '--pretty=format:%an %ae %cn %ce' >>:EOO
User Name user@example.org Commiter commiter@example.com
EOO
}
@@ -257,7 +257,7 @@ pkg_ctl="$prj_ctl/hello.git"
:
{
$clone_root_data;
- sed -i -e "s%^author-.+\$%%" $data_dir/request.manifest;
+ sed -i -e 's%^author-.+$%%' $data_dir/request.manifest;
$clone_root_ref;
$g clone ref.git &ref/***;
@@ -304,7 +304,7 @@ pkg_ctl="$prj_ctl/hello.git"
#
$g -C tgt pull;
- git -C tgt log -1 "--pretty=format:%an %ae %cn %ce" >>:EOO
+ git -C tgt log -1 '--pretty=format:%an %ae %cn %ce' >>:EOO
Submission Handler noreply@example.com Submission Handler noreply@example.com
EOO
}
@@ -424,7 +424,7 @@ pkg_ctl="$prj_ctl/hello.git"
:
{
$clone_root_data;
- sed -i -e "s%^\(section:\) .+\$%\\1 delta%" $data_dir/request.manifest;
+ sed -i -e 's%^(section:) .+$%\1 delta%' $data_dir/request.manifest;
$clone_root_tgt;
$g clone tgt.git &tgt/***;
@@ -438,7 +438,7 @@ pkg_ctl="$prj_ctl/hello.git"
owners=owners
EOI
- $g -C tgt commit -am "Add section name fallback";
+ $g -C tgt commit -am 'Add section name fallback';
$g -C tgt push;
$* "file:///$~/tgt.git" $root_ref_dir $data_dir >>"EOO"
@@ -448,6 +448,24 @@ pkg_ctl="$prj_ctl/hello.git"
reference: $checksum
EOO
}
+
+ : simulate
+ :
+ : Test that the simulated submission still succeeds given no control URL.
+ :
+ {
+ $clone_root_data;
+ sed -i -e 's%^control: .+$%simulate: success%' $data_dir/request.manifest;
+
+ $clone_root_tgt;
+
+ $* "file:///$~/tgt.git" $data_dir >>"EOO"
+ : 1
+ status: 200
+ message: libhello/0.1.0 submission is queued
+ reference: $checksum
+ EOO
+ }
}
: failure
@@ -457,7 +475,7 @@ pkg_ctl="$prj_ctl/hello.git"
:
{
$clone_root_data_clean;
- sed -i -e "s%^author-.+\$%%" $data_dir/request.manifest;
+ sed -i -e 's%^author-.+$%%' $data_dir/request.manifest;
$clone_root_tgt;
tgt_url = "file:///$~/tgt.git";
@@ -474,7 +492,7 @@ pkg_ctl="$prj_ctl/hello.git"
:
{
$clone_root_data_clean;
- sed -i -e "s%^author-email.+\$%%" $data_dir/request.manifest;
+ sed -i -e 's%^author-email.+$%%' $data_dir/request.manifest;
$clone_root_tgt;
tgt_url = "file:///$~/tgt.git";
@@ -491,7 +509,7 @@ pkg_ctl="$prj_ctl/hello.git"
:
{
$clone_root_data_clean;
- sed -i -e "s%^author-name.+\$%%" $data_dir/request.manifest;
+ sed -i -e 's%^author-name.+$%%' $data_dir/request.manifest;
$clone_root_tgt;
tgt_url = "file:///$~/tgt.git";
@@ -838,7 +856,7 @@ pkg_ctl="$prj_ctl/hello.git"
{
$clone_root_data_clean;
- sed -i -e "s%^\(sha256sum:\) .+\$%\\1 59941e842667%" \
+ sed -i -e 's%^(sha256sum:) .+$%\1 59941e842667%' \
$data_dir/request.manifest;
$clone_root_tgt;
@@ -856,7 +874,7 @@ pkg_ctl="$prj_ctl/hello.git"
:
{
$clone_root_data_clean;
- sed -i -e "s%^\(section:\) .+\$%\\1 delta%" $data_dir/request.manifest;
+ sed -i -e 's%^(section:) .+$%\1 delta%' $data_dir/request.manifest;
$clone_root_tgt;
@@ -867,4 +885,63 @@ pkg_ctl="$prj_ctl/hello.git"
reference: $checksum
EOO
}
+
+ : control-unavailable
+ :
+ {
+ $clone_root_data_clean;
+ sed -i -e 's%^(control:) .+$%\1 http://non-existent-host/path/rep.git%' \
+ $data_dir/request.manifest;
+
+ $clone_root_tgt;
+
+ $* "file:///$~/tgt.git" $data_dir >>"EOO"
+ : 1
+ status: 422
+ message: repository http://non-existent-host/path/rep.git unavailable
+ reference: $checksum
+ EOO
+ }
+
+ : control-clone-failed
+ :
+ {
+ $clone_root_data_clean;
+ sed -i -e 's%^(control:) .+$%\1 http://example.com/path/rep.git%' \
+ $data_dir/request.manifest;
+
+ $clone_root_tgt;
+
+ $* "file:///$~/tgt.git" $data_dir >>"EOO"
+ : 1
+ status: 422
+ message: failed to git-clone http://example.com/path/rep.git
+ reference: $checksum
+ EOO
+ }
+
+ : target-unavailable
+ :
+ {
+ $clone_root_data_clean;
+
+ $* 'http://non-existent-host/path/rep.git' $data_dir >>"EOO" 2>>~%EOE%
+ : 1
+ status: 503
+ message: submission service temporarily unavailable
+ reference: $checksum
+ EOO
+ %curl: .+%
+ EOE
+ }
+
+ : target-clone-failed
+ :
+ {
+ $clone_root_data_clean;
+
+ $* 'http://example.com/path/rep.git' $data_dir 2>>~%EOE% != 0
+ %fatal: .+%
+ EOE
+ }
}