feat(python): add TLS and auth args to getting-started examples#2754
feat(python): add TLS and auth args to getting-started examples#2754saie-ch wants to merge 6 commits intoapache:masterfrom
Conversation
a324506 to
861c7ef
Compare
|
Since we use the examples to validate the behaviour of the sdks, my concern is that currently only the "happy path" of the example working without tls is tested. If we are to merge the changes, I'd appreciate it if the example could be tested with the tls config in CI. |
|
I thought about it, and instead of testing tls using the examples, it would be better to test as an integration test. @saie-ch would you be amenable to writing an integration test that will test tls? |
|
@slbotbm Sure, I can write an integration test for TLS. |
There was a problem hiding this comment.
@saie-ch Thank you for the update! One comment: We would like to run these tests as part of the "test" task for python, not as part of the "examples" task. I'd appreciate if you could wire this code into the test task.
There was a problem hiding this comment.
@slbotbm could you recheck? The test_tls.py test already runs as part of the sdk-python / test task and the shell script TLS pass is a separate, lightweight check to ensure the example scripts (producer.py/consumer.py) work with the --tls flags.
Please correct me if I'm mistaken, thanks!
There was a problem hiding this comment.
@saie-ch you are right -- that was my oversight. I apologize.
I'd like to request you to please fix the CI. After that, I think we are good to go.
The Python getting-started examples connection settings has no way to configure TLS, authentication credentials.
What changed?
The producer and consumer examples only supported a basic --tcp-server-address argument.
Both examples now accept --tls, --tls-ca-file, --username, and --password arguments, and use IggyClient.from_connection_string() to build a connection string with optional TLS parameters.
Local Execution : Passed
Pre-commit hooks ran
Tested locally against iggy server on 127.0.0.1:8090 without TLS:
python examples/python/getting-started/producer.py --tcp-server-address 127.0.0.1:8090
python examples/python/getting-started/consumer.py --tcp-server-address 127.0.0.1:8090
Producer sent 5 batches of 10 messages (50 total), consumer consumed all 50 messages successfully.
Tested on manged server with --tls , --tls-ca-file, username, password.
examples/python/getting-started/producer.py
--tls
--tcp-server-address xxxxxxxx
--username xxxx
--password xxxxxx
--tls-ca-file xxxxx
Python SDK tests: 18/18 passed