You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/04/24 21:04:22 UTC
[GitHub] [kafka] vvcephei opened a new pull request #8546: MINOR: document how to escape json parameters to ducktape tests
vvcephei opened a new pull request #8546:
URL: https://github.com/apache/kafka/pull/8546
* update the readme with an example of correctly escaped JSON to be passed
as the parameters to a parameterized ducktape tests in docker
### Committer Checklist (excluded from commit message)
- [ ] Verify design and implementation
- [ ] Verify test coverage and CI build status
- [ ] Verify documentation (including upgrade notes)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] vvcephei commented on pull request #8546: MINOR: document how to escape json parameters to ducktape tests
Posted by GitBox <gi...@apache.org>.
vvcephei commented on pull request #8546:
URL: https://github.com/apache/kafka/pull/8546#issuecomment-619238965
Getting the escaping right is surprisingly tricky, since the string gets evaluated by Bash, then wrapped in double-quotes to be passed into the Docker command, where it gets evaluated and passed to ducktape.
Since it took me so long to figure it out, I thought it might be nice to add to the README
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] mjsax commented on a change in pull request #8546: MINOR: document how to escape json parameters to ducktape tests
Posted by GitBox <gi...@apache.org>.
mjsax commented on a change in pull request #8546:
URL: https://github.com/apache/kafka/pull/8546#discussion_r414878512
##########
File path: tests/README.md
##########
@@ -36,6 +36,10 @@ TC_PATHS="tests/kafkatest/tests/client/pluggable_test.py::PluggableConsumerTest"
```
TC_PATHS="tests/kafkatest/tests/client/pluggable_test.py::PluggableConsumerTest.test_start_stop" bash tests/docker/run_tests.sh
```
+* Run a specific test method with specific parameters
+```
+TC_PATHS="tests/kafkatest/tests/streams/streams_upgrade_test.py::StreamsUpgradeTest.test_metadata_upgrade" _DUCKTAPE_OPTIONS='--parameters '\''{"from_version":"0.10.1.1","to_version":"2.6.0-SNAPSHOT"}'\' bash tests/docker/run_tests.sh
Review comment:
Great example. Wondering if it is correct?
```
--parameters '\''
```
Should this be
```
--parameters '\'
```
because that the end there is `'\'`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] ableegoldman commented on a change in pull request #8546: MINOR: document how to escape json parameters to ducktape tests
Posted by GitBox <gi...@apache.org>.
ableegoldman commented on a change in pull request #8546:
URL: https://github.com/apache/kafka/pull/8546#discussion_r415994385
##########
File path: tests/README.md
##########
@@ -36,6 +36,10 @@ TC_PATHS="tests/kafkatest/tests/client/pluggable_test.py::PluggableConsumerTest"
```
TC_PATHS="tests/kafkatest/tests/client/pluggable_test.py::PluggableConsumerTest.test_start_stop" bash tests/docker/run_tests.sh
```
+* Run a specific test method with specific parameters
+```
+TC_PATHS="tests/kafkatest/tests/streams/streams_upgrade_test.py::StreamsUpgradeTest.test_metadata_upgrade" _DUCKTAPE_OPTIONS='--parameters '\''{"from_version":"0.10.1.1","to_version":"2.6.0-SNAPSHOT"}'\' bash tests/docker/run_tests.sh
Review comment:
I tried it out on Friday but left it running and forgot to report back. It passed for me 👍
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] vvcephei commented on a change in pull request #8546: MINOR: document how to escape json parameters to ducktape tests
Posted by GitBox <gi...@apache.org>.
vvcephei commented on a change in pull request #8546:
URL: https://github.com/apache/kafka/pull/8546#discussion_r414897161
##########
File path: tests/README.md
##########
@@ -36,6 +36,10 @@ TC_PATHS="tests/kafkatest/tests/client/pluggable_test.py::PluggableConsumerTest"
```
TC_PATHS="tests/kafkatest/tests/client/pluggable_test.py::PluggableConsumerTest.test_start_stop" bash tests/docker/run_tests.sh
```
+* Run a specific test method with specific parameters
+```
+TC_PATHS="tests/kafkatest/tests/streams/streams_upgrade_test.py::StreamsUpgradeTest.test_metadata_upgrade" _DUCKTAPE_OPTIONS='--parameters '\''{"from_version":"0.10.1.1","to_version":"2.6.0-SNAPSHOT"}'\' bash tests/docker/run_tests.sh
Review comment:
Haha, having just spent several hours settling on this exact sequence of characters, I can certify that it's correct ;)
Actually, I would like to get at least one other person to try it out. Do you mind?
To answer your question, here's how it works:
first string (wrapped in single quotes for consistency with the second string): `--parameters `
first escaped single quote: `\'`
second string (wrapped in single quotes to avoid evaluating the special characters): `{"from_version":"0.10.1.1","to_version":"2.6.0-SNAPSHOT"}`
second escaped single quote: `\'`
Following Bash rules, a sequence of strings and characters just get concatenated, so all of the above gets smashed together to form the desired final string:
`--parameters '{"from_version":"0.10.1.1","to_version":"2.6.0-SNAPSHOT"}'`
which will then be evaluated _again_ by Bash inside the docker container, so that the final argument to ducktape is the desired argument list: `--parameters`, followed by `{"from_version":"0.10.1.1","to_version":"2.6.0-SNAPSHOT"}`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org