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 Apr 15, 2024
1 parent 27b6adb commit 1e6027c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
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.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 1e6027c

Please sign in to comment.