From 114e91c5dbec1a1345fbb84a5625ab5c55abf8a5 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 24 Sep 2023 17:36:12 +0200 Subject: [PATCH] improve journey test to validate handling ambiguous of ssh-hosts --- tests/journey/gix.sh | 17 +++++++++++++++++ .../no-repo/pack/clone/fail-ambigous-host | 1 + .../no-repo/pack/receive/fail-ambigous-host | 1 + 3 files changed, 19 insertions(+) create mode 100644 tests/snapshots/plumbing/no-repo/pack/clone/fail-ambigous-host create mode 100644 tests/snapshots/plumbing/no-repo/pack/receive/fail-ambigous-host diff --git a/tests/journey/gix.sh b/tests/journey/gix.sh index 9a4165677f..ce359b134d 100644 --- a/tests/journey/gix.sh +++ b/tests/journey/gix.sh @@ -345,6 +345,12 @@ title "gix commit-graph" } ) ) + (with "an ambiguous ssh host which could be mistaken for an argument" + it "fails without trying to pass it to command-line programs" && { + WITH_SNAPSHOT="$snapshot/fail-ambigous-host" \ + expect_run $WITH_FAILURE "$exe_plumbing" free pack receive 'ssh://-oProxyCommand=open$IFS-aCalculator/foo' + } + ) fi ) elif [[ "$kind" = "small" ]]; then @@ -355,6 +361,17 @@ title "gix commit-graph" fi ) ) + if test "$kind" = "max" || test "$kind" = "max-pure"; then + (with "the 'clone' sub-command" + snapshot="$snapshot/clone" + (with "an ambiguous ssh host which could be mistaken for an argument" + it "fails without trying to pass it to command-line programs" && { + WITH_SNAPSHOT="$snapshot/fail-ambigous-host" \ + expect_run $WITH_FAILURE "$exe_plumbing" clone 'ssh://-oProxyCommand=open$IFS-aCalculator/foo' + } + ) + ) + fi (with "the 'index' sub-command" snapshot="$snapshot/index" title "gix free pack index create" diff --git a/tests/snapshots/plumbing/no-repo/pack/clone/fail-ambigous-host b/tests/snapshots/plumbing/no-repo/pack/clone/fail-ambigous-host new file mode 100644 index 0000000000..52e6b005a9 --- /dev/null +++ b/tests/snapshots/plumbing/no-repo/pack/clone/fail-ambigous-host @@ -0,0 +1 @@ + Error: Host name '-oProxyCommand=open$IFS-aCalculator' could be mistaken for a command-line argument \ No newline at end of file diff --git a/tests/snapshots/plumbing/no-repo/pack/receive/fail-ambigous-host b/tests/snapshots/plumbing/no-repo/pack/receive/fail-ambigous-host new file mode 100644 index 0000000000..473adbb4a2 --- /dev/null +++ b/tests/snapshots/plumbing/no-repo/pack/receive/fail-ambigous-host @@ -0,0 +1 @@ +Error: Host name '-oProxyCommand=open$IFS-aCalculator' could be mistaken for a command-line argument \ No newline at end of file