test-schema-registry-ssl.td 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. > CREATE CONNECTION kafka to KAFKA (
  12. BROKER 'kafka:9092',
  13. SECURITY PROTOCOL PLAINTEXT
  14. )
  15. $ set schema={
  16. "name": "row",
  17. "type": "record",
  18. "fields": [
  19. {"name": "a", "type": "long"}
  20. ]
  21. }
  22. $ kafka-create-topic topic=avro-data
  23. $ kafka-ingest topic=avro-data format=avro schema=${schema}
  24. {"a": 1}
  25. # ==> Test invalid configurations. <==
  26. ! CREATE CONNECTION schema_registry_invalid TO CONFLUENT SCHEMA REGISTRY (
  27. URL 'http://ssl.schema-registry.local:8082'
  28. )
  29. contains:invalid HTTP version parsed
  30. ! CREATE CONNECTION schema_registry_invalid TO CONFLUENT SCHEMA REGISTRY (
  31. URL 'https://ssl.schema-registry.local:8082'
  32. )
  33. contains:certificate verify failed
  34. # ==> Test without an SSH tunnel. <==
  35. > CREATE CONNECTION schema_registry TO CONFLUENT SCHEMA REGISTRY (
  36. URL 'https://ssl.schema-registry.local:8082',
  37. SSL CERTIFICATE AUTHORITY = '${ca-crt}'
  38. )
  39. > CREATE SOURCE avro_data FROM KAFKA CONNECTION kafka (
  40. TOPIC 'testdrive-avro-data-${testdrive.seed}'
  41. )
  42. > CREATE TABLE avro_data_tbl FROM SOURCE avro_data (REFERENCE "testdrive-avro-data-${testdrive.seed}")
  43. FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION schema_registry
  44. > SELECT * FROM avro_data_tbl
  45. a
  46. ----
  47. 1
  48. # ==> Test with an SSH tunnel. <==
  49. > CREATE CONNECTION schema_registry_ssh TO CONFLUENT SCHEMA REGISTRY (
  50. URL 'https://ssl.schema-registry.local:8082',
  51. SSL CERTIFICATE AUTHORITY = '${ca-crt}',
  52. SSH TUNNEL testdrive_no_reset_connections.public.ssh
  53. )
  54. > CREATE SOURCE avro_data_ssh FROM KAFKA CONNECTION kafka (
  55. TOPIC 'testdrive-avro-data-${testdrive.seed}'
  56. )
  57. > CREATE TABLE avro_data_ssh_tbl FROM SOURCE avro_data_ssh (REFERENCE "testdrive-avro-data-${testdrive.seed}")
  58. FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION schema_registry
  59. > SELECT * FROM avro_data_ssh_tbl
  60. a
  61. ----
  62. 1