test-schema-registry-mssl.td 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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 schema-registry-crt=/share/secrets/materialized-schema-registry.crt
  14. $ set-from-file schema-registry-key=/share/secrets/materialized-schema-registry.key
  15. > CREATE SECRET kafka_key AS '${kafka-key}'
  16. > CREATE SECRET schema_registry_key AS '${schema-registry-key}'
  17. > CREATE CONNECTION kafka to KAFKA (
  18. BROKER 'kafka:9092',
  19. SECURITY PROTOCOL PLAINTEXT
  20. )
  21. $ set schema={
  22. "name": "row",
  23. "type": "record",
  24. "fields": [
  25. {"name": "a", "type": "long"}
  26. ]
  27. }
  28. $ kafka-create-topic topic=avro-data
  29. $ kafka-ingest topic=avro-data format=avro schema=${schema}
  30. {"a": 1}
  31. # ==> Test invalid configurations. <==
  32. # This is a bad error message to indicate "missing client certificate" but
  33. # it's not under our control.
  34. ! CREATE CONNECTION schema_registry_invalid TO CONFLUENT SCHEMA REGISTRY (
  35. URL 'https://mssl.schema-registry.local:8082',
  36. SSL CERTIFICATE AUTHORITY = '${ca-crt}'
  37. )
  38. contains:error sending request for url
  39. # This is a bad error message to indicate "disallowed client certificate" but
  40. # it's not under our control.
  41. ! CREATE CONNECTION schema_registry_invalid TO CONFLUENT SCHEMA REGISTRY (
  42. URL 'https://mssl.schema-registry.local:8082',
  43. SSL CERTIFICATE = '${kafka-crt}',
  44. SSL KEY = SECRET kafka_key,
  45. SSL CERTIFICATE AUTHORITY = '${ca-crt}'
  46. )
  47. contains:alert certificate unknown
  48. # This is a bad error message to indicate "invalid client certificate" but
  49. # it's not under our control.
  50. ! CREATE CONNECTION schema_registry_invalid TO CONFLUENT SCHEMA REGISTRY (
  51. URL 'https://mssl.schema-registry.local:8082',
  52. SSL CERTIFICATE = '${schema-registry-crt}',
  53. SSL KEY = SECRET kafka_key,
  54. SSL CERTIFICATE AUTHORITY = '${ca-crt}'
  55. )
  56. contains:key values mismatch
  57. # ==> Test without an SSH tunnel. <==
  58. > CREATE CONNECTION schema_registry TO CONFLUENT SCHEMA REGISTRY (
  59. URL 'https://mssl.schema-registry.local:8082',
  60. SSL CERTIFICATE = '${schema-registry-crt}',
  61. SSL KEY = SECRET schema_registry_key,
  62. SSL CERTIFICATE AUTHORITY = '${ca-crt}'
  63. )
  64. > CREATE SOURCE avro_data FROM KAFKA CONNECTION kafka (
  65. TOPIC 'testdrive-avro-data-${testdrive.seed}'
  66. )
  67. > CREATE TABLE avro_data_tbl FROM SOURCE avro_data (REFERENCE "testdrive-avro-data-${testdrive.seed}")
  68. FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION schema_registry
  69. > SELECT * FROM avro_data_tbl
  70. a
  71. ----
  72. 1
  73. # ==> Test with an SSH tunnel. <==
  74. > CREATE CONNECTION schema_registry_ssh TO CONFLUENT SCHEMA REGISTRY (
  75. URL 'https://mssl.schema-registry.local:8082',
  76. SSL CERTIFICATE = '${schema-registry-crt}',
  77. SSL KEY = SECRET schema_registry_key,
  78. SSL CERTIFICATE AUTHORITY = '${ca-crt}',
  79. SSH TUNNEL testdrive_no_reset_connections.public.ssh
  80. )
  81. > CREATE SOURCE avro_data_ssh FROM KAFKA CONNECTION kafka (
  82. TOPIC 'testdrive-avro-data-${testdrive.seed}'
  83. )
  84. > CREATE TABLE avro_data_ssh_tbl FROM SOURCE avro_data_ssh (REFERENCE "testdrive-avro-data-${testdrive.seed}")
  85. FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION schema_registry
  86. > SELECT * FROM avro_data_ssh_tbl
  87. a
  88. ----
  89. 1