-
Notifications
You must be signed in to change notification settings - Fork 497
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
[Merged by Bors] - fix: Enabled --file
and --key-separator
to be used together, fix --key
handling when producing lines
#3092
Closed
+130
−39
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b6e2adb
save
ozgrakkurt 5e72588
fix compilation
ozgrakkurt cb8adb9
fix --key handling when producing from file, enable separator with file
ozgrakkurt 67897fe
Merge branch 'infinyon:master' into master
ozgrakkurt 9b50bc1
add test
ozgrakkurt 418bb5b
change separator in test
ozgrakkurt ee37233
rename test file
ozgrakkurt 35bef9f
skip new test on stable
ozgrakkurt 7405572
Merge branch 'infinyon:master' into master
ozgrakkurt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#!/usr/bin/env bats | ||
|
||
TEST_HELPER_DIR="$BATS_TEST_DIRNAME/../test_helper" | ||
export TEST_HELPER_DIR | ||
|
||
load "$TEST_HELPER_DIR"/tools_check.bash | ||
load "$TEST_HELPER_DIR"/fluvio_dev.bash | ||
load "$TEST_HELPER_DIR"/bats-support/load.bash | ||
load "$TEST_HELPER_DIR"/bats-assert/load.bash | ||
|
||
setup_file() { | ||
TOPIC_NAME=$(random_string) | ||
export TOPIC_NAME | ||
debug_msg "Topic name: $TOPIC_NAME" | ||
|
||
KEY1=$(random_string) | ||
export KEY1 | ||
KEY2=$(random_string) | ||
export KEY2 | ||
KEY3=$(random_string) | ||
export KEY3 | ||
VAL1=$(random_string) | ||
export VAL1 | ||
VAL2=$(random_string) | ||
export VAL2 | ||
VAL3=$(random_string) | ||
export VAL3 | ||
|
||
SEPARATOR='||' | ||
export SEPARATOR | ||
|
||
MULTI_LINE_FILE_CONTENTS=$KEY1$SEPARATOR$VAL1$'\n'$KEY2$SEPARATOR$VAL2$'\n'$KEY3$SEPARATOR$VAL3 | ||
export MULTI_LINE_FILE_CONTENTS | ||
|
||
MULTI_LINE_FILE_NAME=$(random_string) | ||
export MULTI_LINE_FILE_NAME | ||
|
||
run bash -c 'echo "$MULTI_LINE_FILE_CONTENTS" > "$MULTI_LINE_FILE_NAME"' | ||
} | ||
|
||
teardown_file() { | ||
run timeout 15s "$FLUVIO_BIN" topic delete "$TOPIC_NAME" | ||
run rm $MULTI_LINE_FILE_NAME | ||
} | ||
|
||
# Create topic | ||
@test "Create a topic for file message with separator" { | ||
if [ "$FLUVIO_CLI_RELEASE_CHANNEL" == "stable" ]; then | ||
skip "don't run on stable version" | ||
fi | ||
|
||
debug_msg "topic: $TOPIC_NAME" | ||
run timeout 15s "$FLUVIO_BIN" topic create "$TOPIC_NAME" | ||
assert_success | ||
} | ||
|
||
# Produce message | ||
@test "Produce file message with separator" { | ||
if [ "$FLUVIO_CLI_RELEASE_CHANNEL" == "stable" ]; then | ||
skip "don't run on stable version" | ||
fi | ||
|
||
run bash -c 'timeout 15s "$FLUVIO_BIN" produce --file "$MULTI_LINE_FILE_NAME" --key-separator "$SEPARATOR" "$TOPIC_NAME"' | ||
assert_success | ||
} | ||
|
||
# Consume message and compare message | ||
# Warning: Adding anything extra to the `debug_msg` skews the message comparison | ||
@test "Consume file message with separator" { | ||
if [ "$FLUVIO_CLI_RELEASE_CHANNEL" == "stable" ]; then | ||
skip "don't run on stable version" | ||
fi | ||
|
||
run timeout 15s "$FLUVIO_BIN" consume "$TOPIC_NAME" -B -d -F '{{key}}={{value}}' | ||
|
||
assert_output $KEY1=$VAL1$'\n'$KEY2=$VAL2$'\n'$KEY3=$VAL3 | ||
assert_success | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice trick!
We should create an issue to update this once we release a new stable version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!