test-kafka-mssl.td 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. # ==> Set up. <==
  10. $ set-from-file ca-crt=/share/secrets/ca.crt
  11. $ set-from-file kafka-crt=/share/secrets/materialized-kafka.crt
  12. $ set-from-file kafka-key=/share/secrets/materialized-kafka.key
  13. $ set-from-file kafka1-crt=/share/secrets/materialized-kafka1.crt
  14. $ set-from-file kafka1-key=/share/secrets/materialized-kafka1.key
  15. > CREATE SECRET kafka_key AS '${kafka-key}'
  16. > CREATE SECRET kafka1_key AS '${kafka1-key}'
  17. > CREATE SECRET garbage_key AS 'garbage'
  18. $ kafka-create-topic topic=text-data
  19. $ kafka-ingest topic=text-data format=bytes
  20. banana
  21. # Test invalid configurations.
  22. ! CREATE CONNECTION kafka_invalid TO KAFKA (
  23. BROKER 'kafka:9094',
  24. SSL CERTIFICATE AUTHORITY = '${ca-crt}'
  25. )
  26. contains:ssl/tls alert bad certificate
  27. ! CREATE CONNECTION kafka_invalid TO KAFKA (
  28. BROKER 'kafka:9094',
  29. SSL CERTIFICATE '${kafka1-crt}',
  30. SSL KEY SECRET kafka1_key,
  31. SSL CERTIFICATE AUTHORITY '${ca-crt}'
  32. )
  33. contains:ssl/tls alert certificate unknown
  34. ! CREATE CONNECTION kafka_invalid TO KAFKA (
  35. BROKER 'kafka:9094',
  36. SSL CERTIFICATE '${kafka-crt}',
  37. SSL KEY SECRET kafka1_key,
  38. SSL CERTIFICATE AUTHORITY '${ca-crt}'
  39. )
  40. contains:x509 certificate routines::key values mismatch
  41. ! CREATE CONNECTION kafka_invalid TO KAFKA (
  42. BROKER 'kafka:9094',
  43. SSL CERTIFICATE '${kafka-crt}',
  44. SSL KEY SECRET garbage_key,
  45. SSL CERTIFICATE AUTHORITY '${ca-crt}'
  46. )
  47. contains:ssl.key.pem failed: not in PEM format?
  48. # We don't test invalid CAs as they are well covered by test-kafka-ssl.td.
  49. # ==> Test without an SSH tunnel. <==
  50. > CREATE CONNECTION kafka TO KAFKA (
  51. BROKER 'kafka:9094',
  52. SSL CERTIFICATE '${kafka-crt}',
  53. SSL KEY SECRET kafka_key,
  54. SSL CERTIFICATE AUTHORITY '${ca-crt}'
  55. )
  56. > CREATE SOURCE text_data FROM KAFKA CONNECTION kafka (
  57. TOPIC 'testdrive-text-data-${testdrive.seed}'
  58. )
  59. > CREATE TABLE text_data_tbl FROM SOURCE text_data (REFERENCE "testdrive-text-data-${testdrive.seed}") FORMAT TEXT
  60. > SELECT * FROM text_data_tbl
  61. banana
  62. # ==> Test with an SSH tunnel. <==
  63. > CREATE CONNECTION kafka_ssh TO KAFKA (
  64. BROKER 'kafka:9094' USING SSH TUNNEL testdrive_no_reset_connections.public.ssh,
  65. SSL CERTIFICATE '${kafka-crt}',
  66. SSL KEY SECRET kafka_key,
  67. SSL CERTIFICATE AUTHORITY '${ca-crt}'
  68. )
  69. > CREATE SOURCE text_data_ssh FROM KAFKA CONNECTION kafka_ssh (
  70. TOPIC 'testdrive-text-data-${testdrive.seed}'
  71. )
  72. > CREATE TABLE text_data_ssh_tbl FROM SOURCE text_data_ssh (REFERENCE "testdrive-text-data-${testdrive.seed}") FORMAT TEXT
  73. > SELECT * FROM text_data_ssh_tbl
  74. banana