diff options
Diffstat (limited to 'tests/submit/submit-git.testscript')
-rw-r--r-- | tests/submit/submit-git.testscript | 132 |
1 files changed, 123 insertions, 9 deletions
diff --git a/tests/submit/submit-git.testscript b/tests/submit/submit-git.testscript index c0a31fe..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 @@ -31,6 +35,8 @@ clone_root_ref = cp --no-cleanup -r $root_ref ./ &ref.git/*** owners=owners EOI ++$g -C $root_ref_dir config user.name 'Test Script' ++$g -C $root_ref_dir config user.email 'testscript@example.com' +$g -C $root_ref_dir add '*' +$g -C $root_ref_dir commit -m 'Add submit.config.bash' +$g -C $root_ref_dir push @@ -42,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. # @@ -94,10 +100,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 +179,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. : { @@ -190,6 +196,8 @@ pkg_ctl="$prj_ctl/hello.git" # owners=owners EOI + $g -C ref config user.name 'Test Script'; + $g -C ref config user.email 'testscript@example.com'; $g -C ref commit -am 'Disable ownership'; $g -C ref push; @@ -203,10 +211,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. : @@ -251,6 +259,8 @@ pkg_ctl="$prj_ctl/hello.git" control: $pkg_ctl EOI + $g -C tgt config user.name 'Test Script'; + $g -C tgt config user.email 'testscript@example.com'; $g -C tgt add owners; $g -C tgt commit -m 'Add ownership info'; $g -C tgt push; @@ -288,6 +298,8 @@ pkg_ctl="$prj_ctl/hello.git" control: $prj_ctl/ EOI + $g -C ref config user.name 'Test Script'; + $g -C ref config user.email 'testscript@example.com'; $g -C ref add owners; $g -C ref commit -m 'Add ownership info'; $g -C ref push; @@ -305,6 +317,8 @@ pkg_ctl="$prj_ctl/hello.git" control: $pkg_ctl EOI + $g -C tgt config user.name 'Test Script'; + $g -C tgt config user.email 'testscript@example.com'; $g -C tgt add owners; $g -C tgt commit -m 'Add ownership info'; $g -C tgt push; @@ -357,6 +371,8 @@ pkg_ctl="$prj_ctl/hello.git" control: $pkg_ctl EOI + $g -C ref config user.name 'Test Script'; + $g -C ref config user.email 'testscript@example.com'; $g -C ref add owners; $g -C ref commit -m 'Add ownership info'; $g -C ref push; @@ -392,6 +408,8 @@ pkg_ctl="$prj_ctl/hello.git" control: $prj_ctl/ EOI + $g -C ref config user.name 'Test Script'; + $g -C ref config user.email 'testscript@example.com'; $g -C ref add owners; $g -C ref commit -m 'Add ownership info'; $g -C ref push; @@ -425,6 +443,8 @@ pkg_ctl="$prj_ctl/hello.git" # owners=owners EOI + $g -C tgt config user.name 'Test Script'; + $g -C tgt config user.email 'testscript@example.com'; $g -C tgt commit -am 'Disable ownership'; $g -C tgt push; @@ -436,6 +456,78 @@ 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 + + $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; + + # Initial submission. + # + $* "file:///$~/tgt.git" $data_dir >>"EOO"; + : 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.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 : { @@ -454,6 +546,8 @@ pkg_ctl="$prj_ctl/hello.git" owners=owners EOI + $g -C tgt config user.name 'Test Script'; + $g -C tgt config user.email 'testscript@example.com'; $g -C tgt commit -am 'Add section name fallback'; $g -C tgt push; @@ -571,6 +665,8 @@ pkg_ctl="$prj_ctl/hello.git" mkdir -p ref/1/alpha/hello; cp $data_dir/libhello-0.1.0.tar.gz ref/1/alpha/hello/; + $g -C ref config user.name 'Test Script'; + $g -C ref config user.email 'testscript@example.com'; $g -C ref add 1/; $g -C ref commit -m 'Add libhello-0.1.0.tar.gz'; $g -C ref push; @@ -612,6 +708,8 @@ pkg_ctl="$prj_ctl/hello.git" control: $prj_ctl/foo EOI + $g -C ref config user.name 'Test Script'; + $g -C ref config user.email 'testscript@example.com'; $g -C ref add owners; $g -C ref commit -m 'Add ownership info'; $g -C ref push; @@ -644,6 +742,8 @@ pkg_ctl="$prj_ctl/hello.git" control: https://example.com/foo EOI + $g -C ref config user.name 'Test Script'; + $g -C ref config user.email 'testscript@example.com'; $g -C ref add owners/hello/project-owner.manifest; $g -C ref commit -m 'Add project ownership info'; $g -C ref push; @@ -685,6 +785,8 @@ pkg_ctl="$prj_ctl/hello.git" control: $prj_ctl/foo EOI + $g -C ref config user.name 'Test Script'; + $g -C ref config user.email 'testscript@example.com'; $g -C ref add owners; $g -C ref commit -m 'Add ownership info'; $g -C ref push; @@ -711,6 +813,8 @@ pkg_ctl="$prj_ctl/hello.git" mkdir -p tgt/1/alpha/hello; cp $data_dir/libhello-0.1.0.tar.gz tgt/1/alpha/hello/; + $g -C tgt config user.name 'Test Script'; + $g -C tgt config user.email 'testscript@example.com'; $g -C tgt add 1/; $g -C tgt commit -m 'Add libhello-0.1.0.tar.gz'; $g -C tgt push; @@ -751,6 +855,8 @@ pkg_ctl="$prj_ctl/hello.git" control: $prj_ctl/foo EOI + $g -C tgt config user.name 'Test Script'; + $g -C tgt config user.email 'testscript@example.com'; $g -C tgt add owners; $g -C tgt commit -m 'Add ownership info'; $g -C tgt push; @@ -783,6 +889,8 @@ pkg_ctl="$prj_ctl/hello.git" # owners=owners EOI + $g -C tgt config user.name 'Test Script'; + $g -C tgt config user.email 'testscript@example.com'; $g -C tgt commit -am 'Disable ownership'; $g -C tgt push; @@ -816,6 +924,8 @@ pkg_ctl="$prj_ctl/hello.git" control: $prj_ctl/ EOI + $g -C ref config user.name 'Test Script'; + $g -C ref config user.email 'testscript@example.com'; $g -C ref add owners; $g -C ref commit -m 'Add project ownership info'; $g -C ref push; @@ -831,6 +941,8 @@ pkg_ctl="$prj_ctl/hello.git" # owners=owners EOI + $g -C tgt config user.name 'Test Script'; + $g -C tgt config user.email 'testscript@example.com'; $g -C tgt commit -am 'Disable ownership'; $g -C tgt push; @@ -871,6 +983,8 @@ pkg_ctl="$prj_ctl/hello.git" control: $prj_ctl/foo EOI + $g -C tgt config user.name 'Test Script'; + $g -C tgt config user.email 'testscript@example.com'; $g -C tgt add owners; $g -C tgt commit -m 'Add ownership info'; $g -C tgt push; |