test-schema-registry-mssl-basic.td 3.7 KB

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