Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI smoke test occasionaly generates invalid topic names #1864

Closed
tjtelan opened this issue Nov 7, 2021 · 2 comments
Closed

CLI smoke test occasionaly generates invalid topic names #1864

tjtelan opened this issue Nov 7, 2021 · 2 comments
Assignees
Labels
Test Infrastructure Testing infrastructure
Milestone

Comments

@tjtelan
Copy link
Contributor

tjtelan commented Nov 7, 2021

The problem is the format of the topic name. Neither the test nor the Fluvio error reports back what topic was being used.

not ok 16 Create a topic
# (from function `assert_success' in file tests/cli/smoke_tests/../test_helper/bats-assert/src/assert_success.bash, line 42,
#  in test file tests/cli/smoke_tests/topic-basic.bats, line 21)
#   `assert_success' failed
# 
# -- command failed --
# status : 1
# output (2 lines):
#   Error: 
#      0: Invalid argument: Topic name must only contain lowercase alphanumeric characters or '-'.

The topic name is randomly generated. The only consideration made to the topic name is that it doesn't start with -. It seems that possibly this isn't strict enough?

# Note: We only generate strings w/ *lowercase* alphanum or '-'
# for topic naming compatibility
function random_string() {
DEFAULT_LEN=7
STRING_LEN=${1:-$DEFAULT_LEN}
# Ensure we don't end up with a string that starts with '-'
STRING1=$(shuf -zer -n1 {a..z} {0..9})
STRING2=$(shuf -zer -n"$(($STRING_LEN-1))" {a..z} {0..9} "-")
RANDOM_STRING=$STRING1$STRING2
if [[ -n $DEBUG ]]; then
echo "# DEBUG: Random str (len: $STRING_LEN): $RANDOM_STRING" >&3
fi
export RANDOM_STRING
echo "$RANDOM_STRING"
}

The test needs to print out the topic name that is trying to be used when it fails in CI. We do have this output if we we the DEBUG env var to true while the tests run.

@tjtelan tjtelan added the Test Infrastructure Testing infrastructure label Nov 7, 2021
@tjtelan
Copy link
Contributor Author

tjtelan commented Nov 7, 2021

Seems that we also need to make sure topic names don't end in -. I think the error message can be improved, bc this was harder than necessary to figure out.

$ fluvio topic create topicname-
Error: 
   0: Invalid argument: Topic name must only contain lowercase alphanumeric characters or '-'.

@sehz
Copy link
Contributor

sehz commented Nov 7, 2021

ouch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Test Infrastructure Testing infrastructure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants