Skip to content

Replace test-port-forwarding.pl with BATS test#4677

Open
IrvingMg wants to merge 1 commit intolima-vm:masterfrom
IrvingMg:rewrite-port-forwarding-test
Open

Replace test-port-forwarding.pl with BATS test#4677
IrvingMg wants to merge 1 commit intolima-vm:masterfrom
IrvingMg:rewrite-port-forwarding-test

Conversation

@IrvingMg
Copy link
Copy Markdown
Contributor

@IrvingMg IrvingMg commented Mar 8, 2026

Replace hack/test-port-forwarding.pl with hack/bats/extras/port-forwarding.bats, using limactl watch --json events instead of parsing log files.

Logs from both the Perl and BATS runs are attached below for comparison.

Fixes #4389

@IrvingMg IrvingMg force-pushed the rewrite-port-forwarding-test branch 4 times, most recently from 21d51af to f6a7801 Compare March 8, 2026 12:33
Comment thread hack/bats/tests/port-forwarding.bats
Comment thread hack/bats/tests/port-forwarding.bats Outdated
Comment thread hack/bats/extras/port-forwarding.bats Outdated
Comment thread hack/bats/extras/port-forwarding.bats Outdated
Comment thread hack/bats/extras/port-forwarding.bats Outdated
Comment thread hack/test-templates.sh
Copy link
Copy Markdown
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, but the perl script is not expected to be line-for-line translated to BATS.

@IrvingMg IrvingMg force-pushed the rewrite-port-forwarding-test branch 10 times, most recently from 56b80d7 to 77a646c Compare March 14, 2026 11:43
Comment thread hack/bats/helpers/limactl.bash
Comment thread hack/bats/helpers/limactl.bash Outdated
line="${line//SSH_LOCAL_PORT/$ssh_local_port}"

local mode="" guest_ip="" guest_port="" host_ip="" host_port="" host_socket=""
if [[ $line =~ ^(forward|ignore):[[:space:]]+([0-9.:]+)[[:space:]]+([0-9]+)([[:space:]]+-\>[[:space:]]+(.+))? ]]; then
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use yq?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test specs are YAML comments (# forward:, # ignore:) which yq can't parse.

Comment thread hack/bats/tests/port-forwarding.bats Outdated
Comment thread hack/bats/tests/port-forwarding.bats Outdated
Comment thread hack/bats/tests/port-forwarding.bats Outdated
Comment thread hack/bats/tests/port-forwarding.bats
Comment thread hack/bats/tests/port-forwarding.bats
Comment thread hack/bats/tests/port-forwarding.bats Outdated
@IrvingMg IrvingMg force-pushed the rewrite-port-forwarding-test branch from 77a646c to f590b74 Compare March 20, 2026 10:36
Signed-off-by: Irving Mondragón <mirvingr@gmail.com>
@IrvingMg IrvingMg force-pushed the rewrite-port-forwarding-test branch from f590b74 to 41ac7d1 Compare March 20, 2026 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test-port-forwarding.pl should be rewritten in BATS

2 participants