@platformatic/rdkafka 4.0.1 → 4.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/bench/seed.sh +0 -0
- package/binding.gyp +8 -1
- package/ci/prepublish.js +4 -4
- package/config.d.ts +126 -10
- package/configure +0 -0
- package/deps/librdkafka/.semaphore/run-all-tests.yml +77 -0
- package/deps/librdkafka/.semaphore/semaphore-integration.yml +250 -0
- package/deps/librdkafka/.semaphore/semaphore.yml +67 -44
- package/deps/librdkafka/.semaphore/verify-linux-packages.yml +41 -0
- package/deps/librdkafka/CHANGELOG.md +471 -1
- package/deps/librdkafka/CONFIGURATION.md +29 -9
- package/deps/librdkafka/INTRODUCTION.md +909 -601
- package/deps/librdkafka/LICENSES.txt +592 -1
- package/deps/librdkafka/Makefile +2 -1
- package/deps/librdkafka/configure +0 -0
- package/deps/librdkafka/debian/rules +0 -0
- package/deps/librdkafka/dev-conf.sh +0 -0
- package/deps/librdkafka/examples/consumer.c +18 -8
- package/deps/librdkafka/examples/describe_consumer_groups.c +25 -6
- package/deps/librdkafka/examples/incremental_alter_configs.c +4 -5
- package/deps/librdkafka/examples/kafkatest_verifiable_client.cpp +26 -42
- package/deps/librdkafka/examples/openssl_engine_example.cpp +3 -4
- package/deps/librdkafka/examples/producer.cpp +2 -2
- package/deps/librdkafka/examples/user_scram.c +4 -5
- package/deps/librdkafka/examples/win_ssl_cert_store.cpp +4 -3
- package/deps/librdkafka/lds-gen.py +0 -0
- package/deps/librdkafka/mklove/Makefile.base +0 -0
- package/deps/librdkafka/packaging/RELEASE.md +8 -0
- package/deps/librdkafka/packaging/alpine/build-alpine.sh +0 -0
- package/deps/librdkafka/packaging/cp/README.md +4 -1
- package/deps/librdkafka/packaging/cp/check_features.c +12 -4
- package/deps/librdkafka/packaging/cp/verify-deb.sh +6 -6
- package/deps/librdkafka/packaging/cp/verify-packages.sh +52 -31
- package/deps/librdkafka/packaging/cp/verify-rpm.sh +6 -13
- package/deps/librdkafka/packaging/debian/rules +0 -0
- package/deps/librdkafka/packaging/get_version.py +0 -0
- package/deps/librdkafka/packaging/homebrew/brew-update-pr.sh +0 -0
- package/deps/librdkafka/packaging/mingw-w64/{travis-before-install.sh → export-variables.sh} +0 -7
- package/deps/librdkafka/packaging/mingw-w64/semaphoreci-build.sh +1 -1
- package/deps/librdkafka/packaging/nuget/artifact.py +0 -0
- package/deps/librdkafka/packaging/nuget/cleanup-s3.py +0 -0
- package/deps/librdkafka/packaging/nuget/nuget.sh +0 -0
- package/deps/librdkafka/packaging/nuget/packaging.py +0 -0
- package/deps/librdkafka/packaging/nuget/push-to-nuget.sh +0 -0
- package/deps/librdkafka/packaging/nuget/release.py +0 -0
- package/deps/librdkafka/packaging/nuget/requirements.txt +3 -3
- package/deps/librdkafka/packaging/rpm/mock-on-docker.sh +0 -0
- package/deps/librdkafka/packaging/rpm/tests/run-test.sh +0 -0
- package/deps/librdkafka/packaging/rpm/tests/test-on-docker.sh +0 -0
- package/deps/librdkafka/packaging/tools/build-configurations-checks.sh +3 -1
- package/deps/librdkafka/packaging/tools/build-deb-package.sh +0 -0
- package/deps/librdkafka/packaging/tools/build-debian.sh +0 -0
- package/deps/librdkafka/packaging/tools/build-manylinux.sh +0 -0
- package/deps/librdkafka/packaging/tools/build-release-artifacts.sh +0 -0
- package/deps/librdkafka/packaging/tools/distro-build.sh +0 -0
- package/deps/librdkafka/packaging/tools/gh-release-checksums.py +0 -0
- package/deps/librdkafka/packaging/tools/rdutcoverage.sh +0 -0
- package/deps/librdkafka/packaging/tools/run-in-docker.sh +28 -0
- package/deps/librdkafka/packaging/tools/run-integration-tests.sh +31 -0
- package/deps/librdkafka/packaging/tools/run-style-check.sh +4 -0
- package/deps/librdkafka/packaging/tools/style-format.sh +6 -5
- package/deps/librdkafka/packaging/tools/update_rpcs_max_versions.py +100 -0
- package/deps/librdkafka/service.yml +154 -0
- package/deps/librdkafka/src/generate_proto.sh +0 -0
- package/deps/librdkafka/src/rd.h +145 -2
- package/deps/librdkafka/src/rdaddr.h +6 -7
- package/deps/librdkafka/src/rdatomic.h +15 -11
- package/deps/librdkafka/src/rdavg.h +3 -2
- package/deps/librdkafka/src/rdbase64.c +33 -2
- package/deps/librdkafka/src/rdbase64.h +2 -0
- package/deps/librdkafka/src/rdendian.h +10 -9
- package/deps/librdkafka/src/rdhttp.c +418 -100
- package/deps/librdkafka/src/rdhttp.h +23 -5
- package/deps/librdkafka/src/rdkafka.c +299 -145
- package/deps/librdkafka/src/rdkafka.h +89 -6
- package/deps/librdkafka/src/rdkafka_admin.c +482 -105
- package/deps/librdkafka/src/rdkafka_admin.h +42 -0
- package/deps/librdkafka/src/rdkafka_broker.c +463 -312
- package/deps/librdkafka/src/rdkafka_broker.h +68 -10
- package/deps/librdkafka/src/rdkafka_buf.c +8 -5
- package/deps/librdkafka/src/rdkafka_buf.h +4 -3
- package/deps/librdkafka/src/rdkafka_cert.c +25 -1
- package/deps/librdkafka/src/rdkafka_cert.h +4 -3
- package/deps/librdkafka/src/rdkafka_cgrp.c +468 -143
- package/deps/librdkafka/src/rdkafka_cgrp.h +36 -2
- package/deps/librdkafka/src/rdkafka_conf.c +526 -102
- package/deps/librdkafka/src/rdkafka_conf.h +68 -4
- package/deps/librdkafka/src/rdkafka_feature.c +472 -35
- package/deps/librdkafka/src/rdkafka_feature.h +2 -0
- package/deps/librdkafka/src/rdkafka_fetcher.c +22 -2
- package/deps/librdkafka/src/rdkafka_fetcher.h +2 -2
- package/deps/librdkafka/src/rdkafka_int.h +84 -46
- package/deps/librdkafka/src/rdkafka_metadata.c +221 -136
- package/deps/librdkafka/src/rdkafka_metadata.h +15 -11
- package/deps/librdkafka/src/rdkafka_metadata_cache.c +279 -73
- package/deps/librdkafka/src/rdkafka_mock.c +795 -19
- package/deps/librdkafka/src/rdkafka_mock.h +119 -0
- package/deps/librdkafka/src/rdkafka_mock_cgrp.c +1298 -132
- package/deps/librdkafka/src/rdkafka_mock_handlers.c +345 -49
- package/deps/librdkafka/src/rdkafka_mock_int.h +180 -61
- package/deps/librdkafka/src/rdkafka_msg.c +35 -19
- package/deps/librdkafka/src/rdkafka_msg.h +3 -3
- package/deps/librdkafka/src/rdkafka_msgset_writer.c +14 -10
- package/deps/librdkafka/src/rdkafka_offset.c +33 -5
- package/deps/librdkafka/src/rdkafka_op.c +1 -1
- package/deps/librdkafka/src/rdkafka_op.h +45 -21
- package/deps/librdkafka/src/rdkafka_partition.c +118 -23
- package/deps/librdkafka/src/rdkafka_partition.h +16 -7
- package/deps/librdkafka/src/rdkafka_proto.h +4 -1
- package/deps/librdkafka/src/rdkafka_protocol.h +1 -0
- package/deps/librdkafka/src/rdkafka_queue.c +125 -48
- package/deps/librdkafka/src/rdkafka_queue.h +19 -0
- package/deps/librdkafka/src/rdkafka_range_assignor.c +1 -1
- package/deps/librdkafka/src/rdkafka_request.c +336 -64
- package/deps/librdkafka/src/rdkafka_request.h +24 -1
- package/deps/librdkafka/src/rdkafka_sasl.c +5 -3
- package/deps/librdkafka/src/rdkafka_sasl_oauthbearer.c +14 -10
- package/deps/librdkafka/src/rdkafka_sasl_oauthbearer_oidc.c +1166 -89
- package/deps/librdkafka/src/rdkafka_sasl_oauthbearer_oidc.h +13 -3
- package/deps/librdkafka/src/rdkafka_sasl_plain.c +3 -3
- package/deps/librdkafka/src/rdkafka_sasl_scram.c +4 -3
- package/deps/librdkafka/src/rdkafka_ssl.c +306 -81
- package/deps/librdkafka/src/rdkafka_ssl.h +22 -0
- package/deps/librdkafka/src/rdkafka_sticky_assignor.c +4 -0
- package/deps/librdkafka/src/rdkafka_telemetry.c +80 -23
- package/deps/librdkafka/src/rdkafka_telemetry_encode.c +5 -1
- package/deps/librdkafka/src/rdkafka_telemetry_encode.h +20 -20
- package/deps/librdkafka/src/rdkafka_topic.c +220 -137
- package/deps/librdkafka/src/rdkafka_topic.h +14 -8
- package/deps/librdkafka/src/rdkafka_transport.c +59 -47
- package/deps/librdkafka/src/rdkafka_transport.h +5 -0
- package/deps/librdkafka/src/rdkafka_txnmgr.c +6 -1
- package/deps/librdkafka/src/rdmap.c +6 -1
- package/deps/librdkafka/src/rdrand.c +11 -1
- package/deps/librdkafka/src/rdtime.h +48 -17
- package/deps/librdkafka/src/rdunittest.c +42 -25
- package/deps/librdkafka/src/rdunittest.h +2 -0
- package/deps/librdkafka/src/rdwin32.h +1 -1
- package/deps/librdkafka/src/regexp.c +47 -42
- package/deps/librdkafka/src/tinycthread_extra.c +45 -21
- package/deps/librdkafka/src/tinycthread_extra.h +7 -3
- package/deps/librdkafka/src-cpp/rdkafkacpp.h +28 -2
- package/deps/librdkafka/tests/0001-multiobj.c +4 -0
- package/deps/librdkafka/tests/0004-conf.c +103 -36
- package/deps/librdkafka/tests/0009-mock_cluster.c +1 -0
- package/deps/librdkafka/tests/0011-produce_batch.c +2 -1
- package/deps/librdkafka/tests/0016-client_swname.c +18 -3
- package/deps/librdkafka/tests/0017-compression.c +6 -8
- package/deps/librdkafka/tests/0018-cgrp_term.c +8 -3
- package/deps/librdkafka/tests/0021-rkt_destroy.c +1 -0
- package/deps/librdkafka/tests/0022-consume_batch.c +4 -1
- package/deps/librdkafka/tests/0026-consume_pause.c +12 -14
- package/deps/librdkafka/tests/0028-long_topicnames.c +1 -1
- package/deps/librdkafka/tests/0029-assign_offset.c +6 -8
- package/deps/librdkafka/tests/0030-offset_commit.c +2 -2
- package/deps/librdkafka/tests/0033-regex_subscribe.c +33 -17
- package/deps/librdkafka/tests/0034-offset_reset.c +25 -4
- package/deps/librdkafka/tests/0036-partial_fetch.c +1 -0
- package/deps/librdkafka/tests/0038-performance.c +1 -0
- package/deps/librdkafka/tests/0040-io_event.c +11 -5
- package/deps/librdkafka/tests/0041-fetch_max_bytes.c +1 -0
- package/deps/librdkafka/tests/0044-partition_cnt.c +3 -2
- package/deps/librdkafka/tests/0045-subscribe_update.c +284 -20
- package/deps/librdkafka/tests/0047-partial_buf_tmout.c +1 -0
- package/deps/librdkafka/tests/0048-partitioner.c +1 -1
- package/deps/librdkafka/tests/0050-subscribe_adds.c +1 -0
- package/deps/librdkafka/tests/0051-assign_adds.c +1 -0
- package/deps/librdkafka/tests/0052-msg_timestamps.c +22 -4
- package/deps/librdkafka/tests/0053-stats_cb.cpp +12 -20
- package/deps/librdkafka/tests/0055-producer_latency.c +176 -3
- package/deps/librdkafka/tests/0056-balanced_group_mt.c +6 -2
- package/deps/librdkafka/tests/0058-log.cpp +3 -3
- package/deps/librdkafka/tests/0059-bsearch.cpp +8 -4
- package/deps/librdkafka/tests/0061-consumer_lag.cpp +25 -5
- package/deps/librdkafka/tests/0067-empty_topic.cpp +3 -0
- package/deps/librdkafka/tests/0068-produce_timeout.c +21 -23
- package/deps/librdkafka/tests/0069-consumer_add_parts.c +3 -7
- package/deps/librdkafka/tests/0075-retry.c +38 -1
- package/deps/librdkafka/tests/0076-produce_retry.c +2 -0
- package/deps/librdkafka/tests/0077-compaction.c +8 -2
- package/deps/librdkafka/tests/0080-admin_ut.c +34 -4
- package/deps/librdkafka/tests/0081-admin.c +455 -155
- package/deps/librdkafka/tests/0082-fetch_max_bytes.cpp +4 -0
- package/deps/librdkafka/tests/0083-cb_event.c +8 -3
- package/deps/librdkafka/tests/0084-destroy_flags.c +14 -18
- package/deps/librdkafka/tests/0085-headers.cpp +4 -0
- package/deps/librdkafka/tests/0086-purge.c +40 -7
- package/deps/librdkafka/tests/0088-produce_metadata_timeout.c +1 -1
- package/deps/librdkafka/tests/0089-max_poll_interval.c +12 -7
- package/deps/librdkafka/tests/0090-idempotence.c +1 -2
- package/deps/librdkafka/tests/0091-max_poll_interval_timeout.c +5 -7
- package/deps/librdkafka/tests/0092-mixed_msgver.c +6 -0
- package/deps/librdkafka/tests/0093-holb.c +8 -5
- package/deps/librdkafka/tests/0094-idempotence_msg_timeout.c +1 -0
- package/deps/librdkafka/tests/0097-ssl_verify.cpp +262 -70
- package/deps/librdkafka/tests/0098-consumer-txn.cpp +16 -16
- package/deps/librdkafka/tests/0099-commit_metadata.c +1 -1
- package/deps/librdkafka/tests/0101-fetch-from-follower.cpp +1 -1
- package/deps/librdkafka/tests/0102-static_group_rebalance.c +317 -16
- package/deps/librdkafka/tests/0103-transactions.c +7 -7
- package/deps/librdkafka/tests/0104-fetch_from_follower_mock.c +1 -0
- package/deps/librdkafka/tests/0105-transactions_mock.c +18 -11
- package/deps/librdkafka/tests/0106-cgrp_sess_timeout.c +35 -14
- package/deps/librdkafka/tests/0107-topic_recreate.c +2 -2
- package/deps/librdkafka/tests/0109-auto_create_topics.cpp +86 -26
- package/deps/librdkafka/tests/0110-batch_size.cpp +1 -2
- package/deps/librdkafka/tests/0112-assign_unknown_part.c +3 -14
- package/deps/librdkafka/tests/0113-cooperative_rebalance.cpp +248 -104
- package/deps/librdkafka/tests/0114-sticky_partitioning.cpp +3 -3
- package/deps/librdkafka/tests/0115-producer_auth.cpp +4 -1
- package/deps/librdkafka/tests/0116-kafkaconsumer_close.cpp +7 -5
- package/deps/librdkafka/tests/0117-mock_errors.c +15 -5
- package/deps/librdkafka/tests/0118-commit_rebalance.c +41 -8
- package/deps/librdkafka/tests/0119-consumer_auth.cpp +20 -1
- package/deps/librdkafka/tests/0120-asymmetric_subscription.c +8 -3
- package/deps/librdkafka/tests/0125-immediate_flush.c +1 -1
- package/deps/librdkafka/tests/0126-oauthbearer_oidc.c +323 -8
- package/deps/librdkafka/tests/0129-fetch_aborted_msgs.c +1 -0
- package/deps/librdkafka/tests/0132-strategy_ordering.c +12 -4
- package/deps/librdkafka/tests/0133-ssl_keys.c +28 -6
- package/deps/librdkafka/tests/0137-barrier_batch_consume.c +24 -14
- package/deps/librdkafka/tests/0139-offset_validation_mock.c +510 -2
- package/deps/librdkafka/tests/0140-commit_metadata.cpp +1 -1
- package/deps/librdkafka/tests/0142-reauthentication.c +37 -17
- package/deps/librdkafka/tests/0143-exponential_backoff_mock.c +39 -40
- package/deps/librdkafka/tests/0146-metadata_mock.c +76 -15
- package/deps/librdkafka/tests/0147-consumer_group_consumer_mock.c +952 -0
- package/deps/librdkafka/tests/0148-offset_fetch_commit_error_mock.c +563 -0
- package/deps/librdkafka/tests/0149-broker-same-host-port.c +140 -0
- package/deps/librdkafka/tests/0150-telemetry_mock.c +9 -6
- package/deps/librdkafka/tests/0151-purge-brokers.c +566 -0
- package/deps/librdkafka/tests/0152-rebootstrap.c +59 -0
- package/deps/librdkafka/tests/0153-memberid.c +128 -0
- package/deps/librdkafka/tests/CMakeLists.txt +6 -0
- package/deps/librdkafka/tests/LibrdkafkaTestApp.py +34 -9
- package/deps/librdkafka/tests/autotest.sh +0 -0
- package/deps/librdkafka/tests/broker_version_tests.py +0 -0
- package/deps/librdkafka/tests/buildbox.sh +0 -0
- package/deps/librdkafka/tests/cleanup-checker-tests.sh +0 -0
- package/deps/librdkafka/tests/cluster_testing.py +0 -0
- package/deps/librdkafka/tests/delete-test-topics.sh +0 -0
- package/deps/librdkafka/tests/fixtures/oauthbearer/jwt_assertion_template.json +10 -0
- package/deps/librdkafka/tests/fixtures/ssl/client.keystore.intermediate.p12 +0 -0
- package/deps/librdkafka/tests/fixtures/ssl/client.keystore.p12 +0 -0
- package/deps/librdkafka/tests/fixtures/ssl/client2.certificate.intermediate.pem +72 -0
- package/deps/librdkafka/tests/fixtures/ssl/client2.certificate.pem +42 -101
- package/deps/librdkafka/tests/fixtures/ssl/client2.intermediate.key +46 -0
- package/deps/librdkafka/tests/fixtures/ssl/client2.key +41 -29
- package/deps/librdkafka/tests/fixtures/ssl/create_keys.sh +112 -37
- package/deps/librdkafka/tests/gen-ssl-certs.sh +0 -0
- package/deps/librdkafka/tests/interactive_broker_version.py +0 -0
- package/deps/librdkafka/tests/java/Makefile +2 -1
- package/deps/librdkafka/tests/java/run-class.sh +0 -0
- package/deps/librdkafka/tests/lz4_manual_test.sh +0 -0
- package/deps/librdkafka/tests/multi-broker-version-test.sh +0 -0
- package/deps/librdkafka/tests/parse-refcnt.sh +0 -0
- package/deps/librdkafka/tests/performance_plot.py +0 -0
- package/deps/librdkafka/tests/requirements.txt +1 -1
- package/deps/librdkafka/tests/run-all-tests.sh +79 -0
- package/deps/librdkafka/tests/run-consumer-tests.sh +0 -0
- package/deps/librdkafka/tests/run-producer-tests.sh +0 -0
- package/deps/librdkafka/tests/run-test-batches.py +157 -0
- package/deps/librdkafka/tests/run-test.sh +0 -0
- package/deps/librdkafka/tests/sasl_test.py +0 -0
- package/deps/librdkafka/tests/test.c +478 -18
- package/deps/librdkafka/tests/test.h +62 -13
- package/deps/librdkafka/tests/testcpp.cpp +6 -1
- package/deps/librdkafka/tests/testcpp.h +30 -2
- package/deps/librdkafka/tests/testshared.h +16 -2
- package/deps/librdkafka/tests/tools/stats/graph.py +0 -0
- package/deps/librdkafka/tests/tools/stats/to_csv.py +1 -1
- package/deps/librdkafka/tests/trivup/trivup-0.14.0.tar.gz +0 -0
- package/deps/librdkafka/tests/until-fail.sh +0 -0
- package/deps/librdkafka/tests/xxxx-metadata.cpp +1 -1
- package/deps/librdkafka/vcpkg.json +1 -1
- package/deps/librdkafka/win32/setup-msys2.ps1 +24 -8
- package/deps/librdkafka/win32/setup-vcpkg.ps1 +28 -6
- package/deps/librdkafka/win32/tests/tests.vcxproj +6 -0
- package/deps/librdkafka/win32/wingetopt.h +5 -4
- package/errors.d.ts +27 -1
- package/lib/error.js +29 -3
- package/make_docs.sh +0 -0
- package/package.json +10 -11
- package/run_docker.sh +0 -0
- package/src/callbacks.cc +6 -9
- package/src/callbacks.h +1 -5
- package/test/kafka-consumer-worker.js +10 -7
- package/test/kafka-consumer.spec.js +32 -21
- package/deps/librdkafka/.semaphore/project.yml +0 -43
- package/deps/librdkafka/.semaphore/project_public.yml +0 -20
- package/deps/librdkafka/win32/install-openssl.ps1 +0 -33
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* librdkafka - Apache Kafka C library
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2019-2022, Magnus Edenhill
|
|
5
|
+
* 2025, Confluent Inc.
|
|
5
6
|
* All rights reserved.
|
|
6
7
|
*
|
|
7
8
|
* Redistribution and use in source and binary forms, with or without
|
|
@@ -34,6 +35,8 @@
|
|
|
34
35
|
#include "testcpp.h"
|
|
35
36
|
#include "tinycthread.h"
|
|
36
37
|
|
|
38
|
+
namespace TestSSLVerify {
|
|
39
|
+
|
|
37
40
|
static const std::string envname[RdKafka::CERT__CNT][RdKafka::CERT_ENC__CNT] = {
|
|
38
41
|
/* [RdKafka::CERT_PUBLIC_KEY] = */
|
|
39
42
|
{
|
|
@@ -117,6 +120,51 @@ class TestVerifyCb : public RdKafka::SslCertificateVerifyCb {
|
|
|
117
120
|
}
|
|
118
121
|
};
|
|
119
122
|
|
|
123
|
+
/**
|
|
124
|
+
* @name Test event callback.
|
|
125
|
+
*/
|
|
126
|
+
class TestEventCb : public RdKafka::EventCb {
|
|
127
|
+
public:
|
|
128
|
+
bool should_succeed;
|
|
129
|
+
|
|
130
|
+
TestEventCb(bool should_succeed) : should_succeed(should_succeed) {
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
void event_cb(RdKafka::Event &event) {
|
|
134
|
+
switch (event.type()) {
|
|
135
|
+
case RdKafka::Event::EVENT_LOG:
|
|
136
|
+
Test::Say("Log: " + event.str() + "\n");
|
|
137
|
+
break;
|
|
138
|
+
case RdKafka::Event::EVENT_ERROR:
|
|
139
|
+
if (should_succeed)
|
|
140
|
+
Test::Fail("Unexpected error event, got: " + event.str());
|
|
141
|
+
else if (event.err() != RdKafka::ERR__SSL &&
|
|
142
|
+
event.err() != RdKafka::ERR__ALL_BROKERS_DOWN)
|
|
143
|
+
Test::Fail(
|
|
144
|
+
"Expected _SSL or _ALL_BROKERS_DOWN error codes"
|
|
145
|
+
", got: " +
|
|
146
|
+
RdKafka::err2str(event.err()));
|
|
147
|
+
else if (event.err() == RdKafka::ERR__SSL) {
|
|
148
|
+
bool expected = false;
|
|
149
|
+
Test::Say("SSL error: " + event.str() + "\n");
|
|
150
|
+
if (event.str().find("alert number 42") != std::string::npos)
|
|
151
|
+
/* Verify that certificate isn't sent if not trusted
|
|
152
|
+
* by the broker. We should receive 42 (bad_certificate)
|
|
153
|
+
* instead of 46 (certificate_unknown). */
|
|
154
|
+
expected = true;
|
|
155
|
+
else if (event.str().find("broker certificate could not be verified") !=
|
|
156
|
+
std::string::npos)
|
|
157
|
+
expected = true;
|
|
158
|
+
|
|
159
|
+
if (!expected)
|
|
160
|
+
Test::Fail("Unexpected SSL error message, got: " + event.str());
|
|
161
|
+
}
|
|
162
|
+
break;
|
|
163
|
+
default:
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
};
|
|
120
168
|
|
|
121
169
|
/**
|
|
122
170
|
* @brief Set SSL PEM cert/key using configuration property.
|
|
@@ -126,36 +174,41 @@ class TestVerifyCb : public RdKafka::SslCertificateVerifyCb {
|
|
|
126
174
|
* @param loc_prop ssl.X.location property that will be cleared.
|
|
127
175
|
* @param pem_prop ssl.X.pem property that will be set.
|
|
128
176
|
* @param cert_type Certificate type.
|
|
177
|
+
* @param use_conf_value_file Read the file from existing configuration value,
|
|
178
|
+
* instead of the one in the environment variable.
|
|
129
179
|
*/
|
|
130
180
|
static void conf_location_to_pem(RdKafka::Conf *conf,
|
|
131
181
|
std::string loc_prop,
|
|
132
182
|
std::string pem_prop,
|
|
133
|
-
RdKafka::CertificateType cert_type
|
|
183
|
+
RdKafka::CertificateType cert_type,
|
|
184
|
+
bool use_conf_value_file) {
|
|
134
185
|
std::string loc;
|
|
135
186
|
|
|
136
187
|
std::string errstr;
|
|
188
|
+
if (use_conf_value_file && conf->get(loc_prop, loc) != RdKafka::Conf::CONF_OK)
|
|
189
|
+
Test::Fail("Failed to get " + loc_prop);
|
|
137
190
|
if (conf->set(loc_prop, "", errstr) != RdKafka::Conf::CONF_OK)
|
|
138
191
|
Test::Fail("Failed to reset " + loc_prop + ": " + errstr);
|
|
139
192
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
193
|
+
if (!use_conf_value_file) {
|
|
194
|
+
const char *p;
|
|
195
|
+
p = test_getenv(envname[cert_type][RdKafka::CERT_ENC_PEM].c_str(), NULL);
|
|
196
|
+
if (!p)
|
|
197
|
+
Test::Fail(
|
|
198
|
+
"Invalid test environment: "
|
|
199
|
+
"Missing " +
|
|
200
|
+
envname[cert_type][RdKafka::CERT_ENC_PEM] +
|
|
201
|
+
" env variable: make sure trivup is up to date");
|
|
202
|
+
|
|
203
|
+
loc = p;
|
|
204
|
+
}
|
|
151
205
|
|
|
152
206
|
/* Read file */
|
|
153
207
|
std::ifstream ifs(loc.c_str());
|
|
154
208
|
std::string pem((std::istreambuf_iterator<char>(ifs)),
|
|
155
209
|
std::istreambuf_iterator<char>());
|
|
156
210
|
|
|
157
|
-
Test::Say("Read
|
|
158
|
-
loc + " from disk and changed to in-memory " + pem_prop +
|
|
211
|
+
Test::Say("Read " + loc + " from disk and changed to in-memory " + pem_prop +
|
|
159
212
|
" string\n");
|
|
160
213
|
|
|
161
214
|
if (conf->set(pem_prop, pem, errstr) != RdKafka::Conf::CONF_OK)
|
|
@@ -172,7 +225,8 @@ static void conf_location_to_pem(RdKafka::Conf *conf,
|
|
|
172
225
|
static void conf_location_to_setter(RdKafka::Conf *conf,
|
|
173
226
|
std::string loc_prop,
|
|
174
227
|
RdKafka::CertificateType cert_type,
|
|
175
|
-
RdKafka::CertificateEncoding encoding
|
|
228
|
+
RdKafka::CertificateEncoding encoding,
|
|
229
|
+
bool use_conf_value_file) {
|
|
176
230
|
std::string loc;
|
|
177
231
|
static const std::string encnames[] = {
|
|
178
232
|
"PKCS#12",
|
|
@@ -182,23 +236,26 @@ static void conf_location_to_setter(RdKafka::Conf *conf,
|
|
|
182
236
|
|
|
183
237
|
/* Clear the config property (e.g., ssl.key.location) */
|
|
184
238
|
std::string errstr;
|
|
239
|
+
if (use_conf_value_file && conf->get(loc_prop, loc) != RdKafka::Conf::CONF_OK)
|
|
240
|
+
Test::Fail("Failed to get " + loc_prop);
|
|
185
241
|
if (conf->set(loc_prop, "", errstr) != RdKafka::Conf::CONF_OK)
|
|
186
242
|
Test::Fail("Failed to reset " + loc_prop);
|
|
187
243
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
244
|
+
if (!use_conf_value_file) {
|
|
245
|
+
const char *p;
|
|
246
|
+
p = test_getenv(envname[cert_type][encoding].c_str(), NULL);
|
|
247
|
+
if (!p)
|
|
248
|
+
Test::Fail(
|
|
249
|
+
"Invalid test environment: "
|
|
250
|
+
"Missing " +
|
|
251
|
+
envname[cert_type][encoding] +
|
|
252
|
+
" env variable: make sure trivup is up to date");
|
|
253
|
+
|
|
254
|
+
loc = p;
|
|
255
|
+
}
|
|
198
256
|
|
|
199
|
-
Test::Say(tostr() << "Reading
|
|
200
|
-
<<
|
|
201
|
-
<< envname[cert_type][encoding] << "\n");
|
|
257
|
+
Test::Say(tostr() << "Reading file as " << encnames[encoding] << " from "
|
|
258
|
+
<< loc << "\n");
|
|
202
259
|
|
|
203
260
|
/* Read file */
|
|
204
261
|
std::ifstream ifs(loc.c_str(), std::ios::binary | std::ios::ate);
|
|
@@ -231,28 +288,111 @@ static const std::string load_names[] = {
|
|
|
231
288
|
"setter",
|
|
232
289
|
};
|
|
233
290
|
|
|
291
|
+
static bool is_client_auth_required() {
|
|
292
|
+
const char *C_client_auth = test_getenv("SSL_client_auth", "required");
|
|
293
|
+
std::string client_auth(C_client_auth);
|
|
294
|
+
return client_auth == "required";
|
|
295
|
+
}
|
|
234
296
|
|
|
297
|
+
/**
|
|
298
|
+
* @brief Test SSL certificate verification.
|
|
299
|
+
*
|
|
300
|
+
* @param line Test line number.
|
|
301
|
+
* @param verify_ok Expected verification result.
|
|
302
|
+
* @param untrusted_client_key Set up an untrusted client key.
|
|
303
|
+
* @param untrusted_client_key_intermediate_ca The untrusted client key is
|
|
304
|
+
* signed by an intermediate CA.
|
|
305
|
+
* @param load_key How to load the client key.
|
|
306
|
+
* @param key_enc Encoding of the client key.
|
|
307
|
+
* @param load_pub How to load the client public key.
|
|
308
|
+
* @param pub_enc Encoding of the client public key.
|
|
309
|
+
* @param load_ca How to load the CA.
|
|
310
|
+
* @param ca_enc Encoding of the CA.
|
|
311
|
+
*/
|
|
235
312
|
static void do_test_verify(const int line,
|
|
236
313
|
bool verify_ok,
|
|
314
|
+
bool untrusted_client_key,
|
|
315
|
+
bool untrusted_client_key_intermediate_ca,
|
|
237
316
|
cert_load_t load_key,
|
|
238
317
|
RdKafka::CertificateEncoding key_enc,
|
|
239
318
|
cert_load_t load_pub,
|
|
240
319
|
RdKafka::CertificateEncoding pub_enc,
|
|
241
320
|
cert_load_t load_ca,
|
|
242
321
|
RdKafka::CertificateEncoding ca_enc) {
|
|
322
|
+
#define TEST_FIXTURES_FOLDER "./fixtures"
|
|
323
|
+
#define TEST_FIXTURES_SSL_FOLDER TEST_FIXTURES_FOLDER "/ssl/"
|
|
324
|
+
#define TEST_FIXTURES_KEY_PASSWORD "use_strong_password_keystore_client2"
|
|
325
|
+
|
|
326
|
+
/* Certificate directly signed by the root CA (untrusted) */
|
|
327
|
+
#define TEST_CERTIFICATE_LOCATION \
|
|
328
|
+
TEST_FIXTURES_SSL_FOLDER "client2.certificate.pem"
|
|
329
|
+
#define TEST_KEY_LOCATION TEST_FIXTURES_SSL_FOLDER "client2.key"
|
|
330
|
+
|
|
331
|
+
/* Certificate signed by an intermediate CA (untrusted) */
|
|
332
|
+
#define TEST_CERTIFICATE_INTERMEDIATE_LOCATION \
|
|
333
|
+
TEST_FIXTURES_SSL_FOLDER "client2.certificate.intermediate.pem"
|
|
334
|
+
#define TEST_KEY_INTERMEDIATE_LOCATION \
|
|
335
|
+
TEST_FIXTURES_SSL_FOLDER "client2.intermediate.key"
|
|
336
|
+
|
|
337
|
+
std::string errstr, existing_key_password;
|
|
243
338
|
/*
|
|
244
339
|
* Create any type of client
|
|
245
340
|
*/
|
|
246
|
-
std::string teststr =
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
341
|
+
std::string teststr =
|
|
342
|
+
tostr() << line << ": " << "SSL cert verify: verify_ok=" << verify_ok
|
|
343
|
+
<< ", untrusted_client_key=" << untrusted_client_key
|
|
344
|
+
<< ", untrusted_client_key_intermediate_ca="
|
|
345
|
+
<< untrusted_client_key_intermediate_ca
|
|
346
|
+
<< ", load_key=" << load_names[load_key]
|
|
347
|
+
<< ", load_pub=" << load_names[load_pub]
|
|
348
|
+
<< ", load_ca=" << load_names[load_ca];
|
|
251
349
|
|
|
252
350
|
Test::Say(_C_BLU "[ " + teststr + " ]\n" _C_CLR);
|
|
253
351
|
|
|
254
352
|
RdKafka::Conf *conf;
|
|
353
|
+
std::string security_protocol;
|
|
255
354
|
Test::conf_init(&conf, NULL, 10);
|
|
355
|
+
if (conf->get("security.protocol", security_protocol) !=
|
|
356
|
+
RdKafka::Conf::CONF_OK)
|
|
357
|
+
Test::Fail("Failed to get security.protocol");
|
|
358
|
+
/* sasl_ssl endpoints don't require
|
|
359
|
+
* SSL authentication even when
|
|
360
|
+
* ssl.client.auth=required */
|
|
361
|
+
bool should_succeed =
|
|
362
|
+
verify_ok && (!untrusted_client_key || !is_client_auth_required() ||
|
|
363
|
+
security_protocol != "ssl");
|
|
364
|
+
TestEventCb eventCb(should_succeed);
|
|
365
|
+
|
|
366
|
+
if (conf->set("event_cb", &eventCb, errstr) != RdKafka::Conf::CONF_OK)
|
|
367
|
+
Test::Fail("Failed to set event_cb: " + errstr);
|
|
368
|
+
|
|
369
|
+
if (untrusted_client_key) {
|
|
370
|
+
/* Set an untrusted certificate, signed by a root CA or by an
|
|
371
|
+
* intermediate CA, and verify client authentication fails. */
|
|
372
|
+
|
|
373
|
+
const char *untrusted_key_location = untrusted_client_key_intermediate_ca
|
|
374
|
+
? TEST_KEY_INTERMEDIATE_LOCATION
|
|
375
|
+
: TEST_KEY_LOCATION;
|
|
376
|
+
const char *untrusted_certificate_location =
|
|
377
|
+
untrusted_client_key_intermediate_ca
|
|
378
|
+
? TEST_CERTIFICATE_INTERMEDIATE_LOCATION
|
|
379
|
+
: TEST_CERTIFICATE_LOCATION;
|
|
380
|
+
|
|
381
|
+
if (conf->set("ssl.key.location", untrusted_key_location, errstr) !=
|
|
382
|
+
RdKafka::Conf::CONF_OK)
|
|
383
|
+
Test::Fail("Failed to set untrusted ssl.key.location: " + errstr);
|
|
384
|
+
|
|
385
|
+
if (conf->get("ssl.key.password", existing_key_password) !=
|
|
386
|
+
RdKafka::Conf::CONF_OK)
|
|
387
|
+
Test::Fail("Failed to get existing ssl.key.password: " + errstr);
|
|
388
|
+
if (conf->set("ssl.key.password", TEST_FIXTURES_KEY_PASSWORD, errstr) !=
|
|
389
|
+
RdKafka::Conf::CONF_OK)
|
|
390
|
+
Test::Fail("Failed to set untrusted ssl.key.password: " + errstr);
|
|
391
|
+
|
|
392
|
+
if (conf->set("ssl.certificate.location", untrusted_certificate_location,
|
|
393
|
+
errstr) != RdKafka::Conf::CONF_OK)
|
|
394
|
+
Test::Fail("Failed to set untrusted ssl.certificate.location: " + errstr);
|
|
395
|
+
}
|
|
256
396
|
|
|
257
397
|
std::string val;
|
|
258
398
|
if (conf->get("ssl.key.location", val) != RdKafka::Conf::CONF_OK ||
|
|
@@ -266,28 +406,35 @@ static void do_test_verify(const int line,
|
|
|
266
406
|
* ssl.key.pem. Same with ssl.certificate.location -> ssl.certificate.pem. */
|
|
267
407
|
if (load_key == USE_CONF)
|
|
268
408
|
conf_location_to_pem(conf, "ssl.key.location", "ssl.key.pem",
|
|
269
|
-
RdKafka::CERT_PRIVATE_KEY);
|
|
409
|
+
RdKafka::CERT_PRIVATE_KEY, true);
|
|
270
410
|
else if (load_key == USE_SETTER)
|
|
271
411
|
conf_location_to_setter(conf, "ssl.key.location", RdKafka::CERT_PRIVATE_KEY,
|
|
272
|
-
key_enc);
|
|
412
|
+
key_enc, key_enc == RdKafka::CERT_ENC_PEM);
|
|
273
413
|
|
|
274
414
|
if (load_pub == USE_CONF)
|
|
275
415
|
conf_location_to_pem(conf, "ssl.certificate.location",
|
|
276
|
-
"ssl.certificate.pem", RdKafka::CERT_PUBLIC_KEY);
|
|
416
|
+
"ssl.certificate.pem", RdKafka::CERT_PUBLIC_KEY, true);
|
|
277
417
|
else if (load_pub == USE_SETTER)
|
|
278
418
|
conf_location_to_setter(conf, "ssl.certificate.location",
|
|
279
|
-
RdKafka::CERT_PUBLIC_KEY, pub_enc
|
|
419
|
+
RdKafka::CERT_PUBLIC_KEY, pub_enc,
|
|
420
|
+
pub_enc == RdKafka::CERT_ENC_PEM);
|
|
421
|
+
|
|
422
|
+
if (untrusted_client_key && ca_enc != RdKafka::CERT_ENC_PEM) {
|
|
423
|
+
/* Original password is needed for reading the
|
|
424
|
+
* CA certificate in the PKCS12 keystore. */
|
|
425
|
+
if (conf->set("ssl.key.password", existing_key_password, errstr) !=
|
|
426
|
+
RdKafka::Conf::CONF_OK)
|
|
427
|
+
Test::Fail("Failed to revert to existing ssl.key.password: " + errstr);
|
|
428
|
+
}
|
|
280
429
|
|
|
281
430
|
if (load_ca == USE_CONF)
|
|
282
431
|
conf_location_to_pem(conf, "ssl.ca.location", "ssl.ca.pem",
|
|
283
|
-
RdKafka::CERT_CA);
|
|
432
|
+
RdKafka::CERT_CA, true);
|
|
284
433
|
else if (load_ca == USE_SETTER)
|
|
285
|
-
conf_location_to_setter(conf, "ssl.ca.location", RdKafka::CERT_CA, ca_enc
|
|
434
|
+
conf_location_to_setter(conf, "ssl.ca.location", RdKafka::CERT_CA, ca_enc,
|
|
435
|
+
ca_enc == RdKafka::CERT_ENC_PEM);
|
|
286
436
|
|
|
287
|
-
|
|
288
|
-
std::string errstr;
|
|
289
437
|
conf->set("debug", "security", errstr);
|
|
290
|
-
|
|
291
438
|
TestVerifyCb verifyCb(verify_ok);
|
|
292
439
|
if (conf->set("ssl_cert_verify_cb", &verifyCb, errstr) !=
|
|
293
440
|
RdKafka::Conf::CONF_OK)
|
|
@@ -318,9 +465,9 @@ static void do_test_verify(const int line,
|
|
|
318
465
|
* this test. */
|
|
319
466
|
std::string cluster = p->clusterid(1000);
|
|
320
467
|
|
|
321
|
-
if (
|
|
468
|
+
if (should_succeed == cluster.empty())
|
|
322
469
|
Test::Fail("Expected connection to " +
|
|
323
|
-
(std::string)(
|
|
470
|
+
(std::string)(should_succeed ? "succeed" : "fail") +
|
|
324
471
|
", but got clusterid '" + cluster + "'");
|
|
325
472
|
|
|
326
473
|
delete p;
|
|
@@ -381,8 +528,27 @@ static void do_test_bad_calls() {
|
|
|
381
528
|
Test::Say("Producer creation failed expectedly: " + errstr + "\n");
|
|
382
529
|
}
|
|
383
530
|
|
|
531
|
+
} // namespace TestSSLVerify
|
|
532
|
+
|
|
533
|
+
using namespace TestSSLVerify;
|
|
534
|
+
|
|
384
535
|
extern "C" {
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* @brief Test SSL certificate verification with various
|
|
539
|
+
* key types and trusted or untrusted client certificates.
|
|
540
|
+
*
|
|
541
|
+
* @remark This tests can be run with a root CA signed certificate
|
|
542
|
+
* when trivup is started with "--ssl" only,
|
|
543
|
+
* or with an intermediate CA signed certificate,
|
|
544
|
+
* when trivup is started with:
|
|
545
|
+
* --conf='{"ssl_intermediate_ca": true}'
|
|
546
|
+
* or with "ssl.client.auth=requested" when started with:
|
|
547
|
+
* --conf='{"ssl_client_auth": "requested"}'
|
|
548
|
+
* or a combination of both.
|
|
549
|
+
*/
|
|
385
550
|
int main_0097_ssl_verify(int argc, char **argv) {
|
|
551
|
+
int untrusted_client_key, untrusted_client_key_intermediate_ca;
|
|
386
552
|
if (!test_check_builtin("ssl")) {
|
|
387
553
|
Test::Skip("Test requires SSL support\n");
|
|
388
554
|
return 0;
|
|
@@ -396,32 +562,58 @@ int main_0097_ssl_verify(int argc, char **argv) {
|
|
|
396
562
|
|
|
397
563
|
do_test_bad_calls();
|
|
398
564
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
565
|
+
for (untrusted_client_key = 0; untrusted_client_key <= 1;
|
|
566
|
+
untrusted_client_key++) {
|
|
567
|
+
for (untrusted_client_key_intermediate_ca = 0;
|
|
568
|
+
untrusted_client_key_intermediate_ca <= untrusted_client_key;
|
|
569
|
+
untrusted_client_key_intermediate_ca++) {
|
|
570
|
+
do_test_verify(__LINE__, true /*verify ok*/, untrusted_client_key,
|
|
571
|
+
untrusted_client_key_intermediate_ca, USE_LOCATION,
|
|
572
|
+
RdKafka::CERT_ENC_PEM, USE_LOCATION, RdKafka::CERT_ENC_PEM,
|
|
573
|
+
USE_LOCATION, RdKafka::CERT_ENC_PEM);
|
|
574
|
+
do_test_verify(__LINE__, false /*verify not ok*/, untrusted_client_key,
|
|
575
|
+
untrusted_client_key_intermediate_ca, USE_LOCATION,
|
|
576
|
+
RdKafka::CERT_ENC_PEM, USE_LOCATION, RdKafka::CERT_ENC_PEM,
|
|
577
|
+
USE_LOCATION, RdKafka::CERT_ENC_PEM);
|
|
578
|
+
|
|
579
|
+
/* Verify various priv and pub key and CA input formats */
|
|
580
|
+
do_test_verify(__LINE__, true /*verify ok*/, untrusted_client_key,
|
|
581
|
+
untrusted_client_key_intermediate_ca, USE_CONF,
|
|
582
|
+
RdKafka::CERT_ENC_PEM, USE_CONF, RdKafka::CERT_ENC_PEM,
|
|
583
|
+
USE_LOCATION, RdKafka::CERT_ENC_PEM);
|
|
584
|
+
do_test_verify(__LINE__, true /*verify ok*/, untrusted_client_key,
|
|
585
|
+
untrusted_client_key_intermediate_ca, USE_CONF,
|
|
586
|
+
RdKafka::CERT_ENC_PEM, USE_CONF, RdKafka::CERT_ENC_PEM,
|
|
587
|
+
USE_CONF, RdKafka::CERT_ENC_PEM);
|
|
588
|
+
do_test_verify(__LINE__, true /*verify ok*/, untrusted_client_key,
|
|
589
|
+
untrusted_client_key_intermediate_ca, USE_SETTER,
|
|
590
|
+
RdKafka::CERT_ENC_PEM, USE_SETTER, RdKafka::CERT_ENC_PEM,
|
|
591
|
+
USE_SETTER, RdKafka::CERT_ENC_PKCS12);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
if (test_getenv("SSL_intermediate_pub_pem", NULL) == NULL) {
|
|
596
|
+
Test::Say("Running root CA only tests\n");
|
|
597
|
+
/* DER format can contain only a single certificate so it's
|
|
598
|
+
* not suited for sending the complete chain of trust
|
|
599
|
+
* corresponding to the private key,
|
|
600
|
+
* that is necessary when using an intermediate CA. */
|
|
601
|
+
do_test_verify(__LINE__, true /*verify ok*/, false, false, USE_LOCATION,
|
|
602
|
+
RdKafka::CERT_ENC_PEM, USE_SETTER, RdKafka::CERT_ENC_DER,
|
|
603
|
+
USE_SETTER, RdKafka::CERT_ENC_DER);
|
|
604
|
+
do_test_verify(__LINE__, true /*verify ok*/, false, false, USE_LOCATION,
|
|
605
|
+
RdKafka::CERT_ENC_PEM, USE_SETTER, RdKafka::CERT_ENC_DER,
|
|
606
|
+
USE_SETTER,
|
|
607
|
+
RdKafka::CERT_ENC_PEM); /* env: SSL_all_cas_pem */
|
|
608
|
+
do_test_verify(__LINE__, true /*verify ok*/, false, false, USE_LOCATION,
|
|
609
|
+
RdKafka::CERT_ENC_PEM, USE_SETTER, RdKafka::CERT_ENC_DER,
|
|
610
|
+
USE_CONF, RdKafka::CERT_ENC_PEM); /* env: SSL_all_cas_pem */
|
|
611
|
+
Test::Say("Finished running root CA only tests\n");
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
do_test_verify(__LINE__, true /*verify ok*/, false, false, USE_SETTER,
|
|
615
|
+
RdKafka::CERT_ENC_PKCS12, USE_SETTER, RdKafka::CERT_ENC_PKCS12,
|
|
616
|
+
USE_SETTER, RdKafka::CERT_ENC_PKCS12);
|
|
425
617
|
|
|
426
618
|
return 0;
|
|
427
619
|
}
|
|
@@ -500,7 +500,7 @@ static void do_test_consumer_txn_test(bool use_java_producer) {
|
|
|
500
500
|
|
|
501
501
|
topic_name = Test::mk_topic_name("0098-consumer_txn-0", 1);
|
|
502
502
|
c = create_consumer(topic_name, "READ_COMMITTED");
|
|
503
|
-
Test::
|
|
503
|
+
Test::create_topic_wait_exists(c, topic_name.c_str(), 1, 3, 5000);
|
|
504
504
|
|
|
505
505
|
run_producer("producer1, -1, 0x0, 5, BeginCommit, DoFlush",
|
|
506
506
|
"producer1, -1, 0x10, 5, BeginAbort, DoFlush");
|
|
@@ -554,7 +554,7 @@ static void do_test_consumer_txn_test(bool use_java_producer) {
|
|
|
554
554
|
|
|
555
555
|
topic_name = Test::mk_topic_name("0098-consumer_txn-0.1", 1);
|
|
556
556
|
c = create_consumer(topic_name, "READ_COMMITTED");
|
|
557
|
-
Test::
|
|
557
|
+
Test::create_topic_wait_exists(c, topic_name.c_str(), 1, 3, 5000);
|
|
558
558
|
|
|
559
559
|
run_producer("producer1, -1, 0x0, 5, BeginCommit, DontFlush",
|
|
560
560
|
"producer1, -1, 0x10, 5, BeginAbort, DoFlush");
|
|
@@ -598,7 +598,7 @@ static void do_test_consumer_txn_test(bool use_java_producer) {
|
|
|
598
598
|
|
|
599
599
|
topic_name = Test::mk_topic_name("0098-consumer_txn-0.2", 1);
|
|
600
600
|
c = create_consumer(topic_name, "READ_COMMITTED");
|
|
601
|
-
Test::
|
|
601
|
+
Test::create_topic_wait_exists(c, topic_name.c_str(), 1, 3, 5000);
|
|
602
602
|
|
|
603
603
|
run_producer("producer1, -1, 0x10, 5, BeginAbort, DoFlush",
|
|
604
604
|
"producer1, -1, 0x30, 5, BeginCommit, DoFlush");
|
|
@@ -642,7 +642,7 @@ static void do_test_consumer_txn_test(bool use_java_producer) {
|
|
|
642
642
|
|
|
643
643
|
topic_name = Test::mk_topic_name("0098-consumer_txn-1", 1);
|
|
644
644
|
c = create_consumer(topic_name, "READ_COMMITTED");
|
|
645
|
-
Test::
|
|
645
|
+
Test::create_topic_wait_exists(c, topic_name.c_str(), 1, 3, 5000);
|
|
646
646
|
TestEventCb::topic = topic_name;
|
|
647
647
|
|
|
648
648
|
run_producer("producer3, -1, 0x10, 5, None, DoFlush",
|
|
@@ -682,7 +682,7 @@ static void do_test_consumer_txn_test(bool use_java_producer) {
|
|
|
682
682
|
|
|
683
683
|
topic_name = Test::mk_topic_name("0098-consumer_txn-1.1", 1);
|
|
684
684
|
c = create_consumer(topic_name, "READ_COMMITTED");
|
|
685
|
-
Test::
|
|
685
|
+
Test::create_topic_wait_exists(c, topic_name.c_str(), 1, 3, 5000);
|
|
686
686
|
|
|
687
687
|
run_producer("producer1, -1, 0x30, 5, BeginAbort, DoFlush",
|
|
688
688
|
"producer3, -1, 0x40, 5, None, DoFlush",
|
|
@@ -714,7 +714,7 @@ static void do_test_consumer_txn_test(bool use_java_producer) {
|
|
|
714
714
|
|
|
715
715
|
topic_name = Test::mk_topic_name("0098-consumer_txn-1.2", 1);
|
|
716
716
|
c = create_consumer(topic_name, "READ_COMMITTED");
|
|
717
|
-
Test::
|
|
717
|
+
Test::create_topic_wait_exists(c, topic_name.c_str(), 1, 3, 5000);
|
|
718
718
|
|
|
719
719
|
run_producer("producer1, -1, 0x10, 5, BeginCommit, DoFlush",
|
|
720
720
|
"producer1, -1, 0x20, 5, BeginAbort, DoFlush",
|
|
@@ -746,7 +746,7 @@ static void do_test_consumer_txn_test(bool use_java_producer) {
|
|
|
746
746
|
|
|
747
747
|
topic_name = Test::mk_topic_name("0098-consumer_txn-2", 1);
|
|
748
748
|
c = create_consumer(topic_name, "READ_COMMITTED");
|
|
749
|
-
Test::
|
|
749
|
+
Test::create_topic_wait_exists(c, topic_name.c_str(), 1, 3, 5000);
|
|
750
750
|
|
|
751
751
|
run_producer("producer1, -1, 0x10, 1, BeginAbort, DontFlush",
|
|
752
752
|
"producer1, -1, 0x20, 1, BeginCommit, DontFlush",
|
|
@@ -799,7 +799,7 @@ static void do_test_consumer_txn_test(bool use_java_producer) {
|
|
|
799
799
|
|
|
800
800
|
topic_name = Test::mk_topic_name("0098-consumer_txn-2.1", 1);
|
|
801
801
|
c = create_consumer(topic_name, "READ_COMMITTED");
|
|
802
|
-
Test::
|
|
802
|
+
Test::create_topic_wait_exists(c, topic_name.c_str(), 1, 3, 5000);
|
|
803
803
|
|
|
804
804
|
run_producer("producer1, -1, 0x10, 1, BeginAbort, DoFlush",
|
|
805
805
|
"producer1, -1, 0x20, 1, BeginCommit, DoFlush",
|
|
@@ -883,7 +883,7 @@ static void do_test_consumer_txn_test(bool use_java_producer) {
|
|
|
883
883
|
|
|
884
884
|
topic_name = Test::mk_topic_name("0098-consumer_txn-3", 1);
|
|
885
885
|
c = create_consumer(topic_name, "READ_COMMITTED");
|
|
886
|
-
Test::
|
|
886
|
+
Test::create_topic_wait_exists(c, topic_name.c_str(), 2, 3, 5000);
|
|
887
887
|
|
|
888
888
|
run_producer("producer1, 0, 0x10, 3, BeginOpen, DoFlush",
|
|
889
889
|
"producer1, 1, 0x20, 3, ContinueOpen, DoFlush",
|
|
@@ -928,7 +928,7 @@ static void do_test_consumer_txn_test(bool use_java_producer) {
|
|
|
928
928
|
|
|
929
929
|
topic_name = Test::mk_topic_name("0098-consumer_txn-3.1", 1);
|
|
930
930
|
c = create_consumer(topic_name, "READ_COMMITTED");
|
|
931
|
-
Test::
|
|
931
|
+
Test::create_topic_wait_exists(c, topic_name.c_str(), 2, 3, 5000);
|
|
932
932
|
|
|
933
933
|
run_producer("producer1, 0, 0x55, 1, BeginCommit, DoFlush",
|
|
934
934
|
"producer1, 0, 0x10, 3, BeginOpen, DoFlush",
|
|
@@ -969,7 +969,7 @@ static void do_test_consumer_txn_test(bool use_java_producer) {
|
|
|
969
969
|
|
|
970
970
|
topic_name = Test::mk_topic_name("0098-consumer_txn-4", 1);
|
|
971
971
|
c = create_consumer(topic_name, "READ_COMMITTED");
|
|
972
|
-
Test::
|
|
972
|
+
Test::create_topic_wait_exists(c, topic_name.c_str(), 1, 3, 5000);
|
|
973
973
|
|
|
974
974
|
run_producer("producer3, 0, 0x10, 1, None, DoFlush",
|
|
975
975
|
"producer1, 0, 0x20, 3, BeginOpen, DoFlush",
|
|
@@ -1004,7 +1004,7 @@ static void do_test_consumer_txn_test(bool use_java_producer) {
|
|
|
1004
1004
|
|
|
1005
1005
|
topic_name = Test::mk_topic_name("0098-consumer_txn-4.1", 1);
|
|
1006
1006
|
c = create_consumer(topic_name, "READ_COMMITTED");
|
|
1007
|
-
Test::
|
|
1007
|
+
Test::create_topic_wait_exists(c, topic_name.c_str(), 1, 3, 5000);
|
|
1008
1008
|
|
|
1009
1009
|
run_producer("producer3, 0, 0x10, 1, None, DoFlush",
|
|
1010
1010
|
"producer1, 0, 0x20, 3, BeginOpen, DoFlush",
|
|
@@ -1039,7 +1039,7 @@ static void do_test_consumer_txn_test(bool use_java_producer) {
|
|
|
1039
1039
|
|
|
1040
1040
|
topic_name = Test::mk_topic_name("0098-consumer_txn-4.2", 1);
|
|
1041
1041
|
c = create_consumer(topic_name, "READ_COMMITTED");
|
|
1042
|
-
Test::
|
|
1042
|
+
Test::create_topic_wait_exists(c, topic_name.c_str(), 1, 3, 5000);
|
|
1043
1043
|
|
|
1044
1044
|
run_producer("producer3, 0, 0x10, 1, None, DoFlush",
|
|
1045
1045
|
"producer1, 0, 0x20, 3, BeginOpen, DoFlush",
|
|
@@ -1074,7 +1074,7 @@ static void do_test_consumer_txn_test(bool use_java_producer) {
|
|
|
1074
1074
|
|
|
1075
1075
|
topic_name = Test::mk_topic_name("0098-consumer_txn-4.3", 1);
|
|
1076
1076
|
c = create_consumer(topic_name, "READ_COMMITTED");
|
|
1077
|
-
Test::
|
|
1077
|
+
Test::create_topic_wait_exists(c, topic_name.c_str(), 1, 3, 5000);
|
|
1078
1078
|
|
|
1079
1079
|
run_producer("producer3, 0, 0x10, 1, None, DoFlush",
|
|
1080
1080
|
"producer1, 0, 0x20, 3, BeginOpen, DoFlush",
|
|
@@ -1111,7 +1111,7 @@ static void do_test_consumer_txn_test(bool use_java_producer) {
|
|
|
1111
1111
|
test5:
|
|
1112
1112
|
topic_name = Test::mk_topic_name("0098-consumer_txn-5", 1);
|
|
1113
1113
|
c = create_consumer(topic_name, "READ_COMMITTED");
|
|
1114
|
-
Test::
|
|
1114
|
+
Test::create_topic_wait_exists(c, topic_name.c_str(), 1, 3, 5000);
|
|
1115
1115
|
|
|
1116
1116
|
run_producer("producer1, 0, 0x10, 2, BeginOpen, DontFlush", "sleep,200",
|
|
1117
1117
|
"producer1, 0, 0x20, 2, ContinueAbort, DontFlush",
|
|
@@ -1167,7 +1167,7 @@ test5:
|
|
|
1167
1167
|
|
|
1168
1168
|
topic_name = Test::mk_topic_name("0098-consumer_txn-0", 1);
|
|
1169
1169
|
c = create_consumer(topic_name, "READ_COMMITTED");
|
|
1170
|
-
Test::
|
|
1170
|
+
Test::create_topic_wait_exists(c, topic_name.c_str(), 1, 3, 5000);
|
|
1171
1171
|
TestEventCb::topic = topic_name;
|
|
1172
1172
|
|
|
1173
1173
|
run_producer("producer3, 0, 0x10, 1, None, DoFlush",
|
|
@@ -164,7 +164,7 @@ int main_0099_commit_metadata(int argc, char **argv) {
|
|
|
164
164
|
|
|
165
165
|
test_str_id_generate(group_id, sizeof(group_id));
|
|
166
166
|
|
|
167
|
-
|
|
167
|
+
test_create_topic_wait_exists(NULL, topic, 1, 1, 5000);
|
|
168
168
|
|
|
169
169
|
origin_toppar = rd_kafka_topic_partition_list_new(1);
|
|
170
170
|
|
|
@@ -290,7 +290,7 @@ static void do_fff_test(void) {
|
|
|
290
290
|
int msgcnt = 1000;
|
|
291
291
|
const int msgsize = 100;
|
|
292
292
|
std::string topic_str = Test::mk_topic_name("0101-fetch-from-follower", 1);
|
|
293
|
-
|
|
293
|
+
test_create_topic_wait_exists(NULL, topic_str.c_str(), 1, 3, 5000);
|
|
294
294
|
test_produce_msgs_easy_size(topic_str.c_str(), 0, 0, msgcnt, msgsize);
|
|
295
295
|
|
|
296
296
|
int leader_id;
|