test: add e2e ping test that does not use the default local network
This would have detected the error fixed in
@@ -49,3 +49,18 @@ teardown() {
assert_match "\"ic_api_version\""
}
+
+@test "dfx ping succeeds by arbitrary network name to a nonstandard port" {
+ [ "$USE_IC_REF" ] && skip "skipped for ic-ref"
+
+ dfx_start --host 127.0.0.1:12345
+ cat <<<$(jq .networks.arbitrary.providers=[\"http://127.0.0.1:12345\"] dfx.json) >dfx.json
+
+ assert_command dfx ping arbitrary
+ assert_match "\"ic_api_version\""
+
+ assert_command_fail dfx ping
+ # this port won't match the ephemeral port that the ic ref picked
+ cat <<<$(jq .networks.arbitrary.providers=[\"127.0.0.1:22113\"] dfx.json) >dfx.json
+ assert_command_fail dfx ping arbitrary
+}
