Skip to content

Commit

Permalink
test(rust): fix bats test on kafka-inlet args parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianbenavides authored and davide-baldo committed Jan 9, 2025
1 parent bbcd779 commit d77b328
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ impl CreateCommand {
)?;
if self.name != kafka_inlet_default_addr() {
opts.terminal.write_line(
fmt_warn!("The <NAME> argument is being overridden by the --alias flag")
fmt_warn!("The <NAME> argument is being overridden by the --addr flag")
+ &fmt_log!("Consider removing the --addr flag"),
)?;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,21 @@ teardown() {
}

@test "kafka - create with deprecated alias --addr flag" {
# Ignore `name` if `addr` is also passed
port="$(random_port)"

# Fail if both addr and name are used
run_failure $OCKAM kafka-inlet create kinlet-name --addr kinlet --to /secure/api --from $port --jq '.'

run_success $OCKAM kafka-inlet create --addr kinlet --to /secure/api --from $port --jq '.'
run_success $OCKAM kafka-inlet create kinlet-name --addr kinlet --to /secure/api --from $port --jq '.'
assert_output --partial "\"from\": \"127.0.0.1:$port\""
assert_output --partial "\"to\": \"/secure/api\""

run_success $OCKAM kafka-inlet show kinlet --jq '.'
assert_output --partial "kinlet"

# Use `addr`
port="$(random_port)"
run_success $OCKAM kafka-inlet create --addr kinlet2 --to /secure/api --from $port --jq '.'
assert_output --partial "\"from\": \"127.0.0.1:$port\""
assert_output --partial "\"to\": \"/secure/api\""

run_success $OCKAM kafka-inlet show kinlet2 --jq '.'
assert_output --partial "kinlet2"
}

0 comments on commit d77b328

Please sign in to comment.