Skip to content

Commit

Permalink
t: use -i flag with curl -X DELETE instead of -I to avoid curl bug
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-suse committed Jun 7, 2024
1 parent 29c7776 commit 9f42238
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
image: ubuntu-2204:2023.04.2
environment:
MIRRORCACHE_DB_PROVIDER: << parameters.db >>
T_EXPERIMENTAL: << parameters.db >>
T_EXPERIMENTAL: << parameters.experimental >>
working_directory: ~/project
steps:
- checkout:
Expand Down
2 changes: 1 addition & 1 deletion lib/MirrorCache/WebAPI/Controller/Admin/Folder.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sub delete_cascade {
sub {
my ($self, $err, @result) = @_;
return $c->render(text => $err, status => 500) if $err;
return $c->render(json => {text => 'ok'});
return $c->render(text => 'Ok');
my $txkeep = $tx;
}
);
Expand Down
8 changes: 4 additions & 4 deletions t/environ/08-folder-delete-remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ $mc/db/sql "select * from file"
test 2 == $($mc/db/sql "select count(*) from folder_diff")
test 1 == $($mc/db/sql "select count(*) from folder_diff_file")

$mc/curl --interface 127.0.0.2 -X DELETE -I /admin/folder_diff/1
$mc/curl --interface 127.0.0.2 -X DELETE -i /admin/folder_diff/1

# check nothing was actually deleted
test 2 == $($mc/db/sql "select count(*) from folder_diff")

$mc/curl --interface 127.0.0.2 -X DELETE -I -H 'x-forwarded-for: 127.0.0.1' /admin/folder_diff/1
$mc/curl --interface 127.0.0.2 -X DELETE -I -H 'x-forwarded-for: 127.0.0.1' /admin/folder_diff/1
$mc/curl --interface 127.0.0.2 -X DELETE -i -H 'x-forwarded-for: 127.0.0.1' /admin/folder_diff/1
$mc/curl --interface 127.0.0.2 -X DELETE -i -H 'x-forwarded-for: 127.0.0.1' /admin/folder_diff/1

test 2 == $($mc/db/sql "select count(*) from folder_diff")

# with 127.0.0.3 it actually works
$mc/curl --interface 127.0.0.3 -X DELETE -I /admin/folder_diff/1
$mc/curl --interface 127.0.0.3 -X DELETE -i /admin/folder_diff/1
test 0 == $($mc/db/sql "select count(*) from folder_diff")
4 changes: 2 additions & 2 deletions t/environ/08-folder-delete.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ $mc/db/sql "select * from file"
test 2 == $($mc/db/sql "select count(*) from folder_diff")
test 1 == $($mc/db/sql "select count(*) from folder_diff_file")

$mc/curl -X DELETE -I /admin/folder_diff/1
$mc/curl -X DELETE -i /admin/folder_diff/1

test 1 == $($mc/db/sql "select count(*) from folder")
test 0 == $($mc/db/sql "select count(*) from folder_diff")
test 0 == $($mc/db/sql "select count(*) from folder_diff_file")

$mc/curl -X DELETE -I /admin/folder/1
$mc/curl -X DELETE -i /admin/folder/1

test 0 == $($mc/db/sql "select count(*) from file")
test 0 == $($mc/db/sql "select count(*) from folder")
Expand Down
2 changes: 1 addition & 1 deletion t/lib/Dockerfile.environ.mariadb.experimental
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ENV LANG en_US.UTF-8

RUN zypper -n in curl # rpm --import needs curl atm
RUN zypper ar -f http://cdn.opensuse.org/repositories/openSUSE:infrastructure:MirrorCache/15.6 mc
RUN zypper ar -f https://mirror.mariadb.org/yum/11.3.1/sles/15/x86_64 mariadb
RUN zypper ar -f https://mirror.mariadb.org/yum/11.2/sles/15/x86_64 mariadb
RUN rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
RUN zypper --gpg-auto-import-keys ref

Expand Down
2 changes: 1 addition & 1 deletion t/lib/Dockerfile.systemd.mariadb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.opensuse.org/opensuse/leap:15.6
FROM opensuse/leap:15.6
ENV container podman

ENV LANG en_US.UTF-8
Expand Down
2 changes: 1 addition & 1 deletion t/lib/Dockerfile.systemd.postgresql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.opensuse.org/opensuse/leap:15.6
FROM opensuse/leap:15.6
ENV container podman

ENV LANG en_US.UTF-8
Expand Down

0 comments on commit 9f42238

Please sign in to comment.