connection-create-external.td 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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-arg-default default-storage-size=1
  10. $ set-arg-default single-replica-cluster=quickstart
  11. #
  12. # Test enforcement that connections are made to global non-private IPs
  13. $ postgres-execute connection=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  14. ALTER SYSTEM SET enable_connection_validation_syntax = true
  15. ALTER SYSTEM SET storage_enforce_external_addresses = true
  16. # Setup kafka topic with schema
  17. # must be a subset of the keys in the rows
  18. $ set keyschema={
  19. "type": "record",
  20. "name": "Key",
  21. "fields": [
  22. {"name": "id", "type": "long"}
  23. ]
  24. }
  25. $ set schema={
  26. "type" : "record",
  27. "name" : "envelope",
  28. "fields" : [
  29. {
  30. "name": "before",
  31. "type": [
  32. {
  33. "name": "row",
  34. "type": "record",
  35. "fields": [
  36. {
  37. "name": "id",
  38. "type": "long"
  39. },
  40. {
  41. "name": "creature",
  42. "type": "string"
  43. }]
  44. },
  45. "null"
  46. ]
  47. },
  48. {
  49. "name": "after",
  50. "type": ["row", "null"]
  51. }
  52. ]
  53. }
  54. $ kafka-create-topic topic=csr_test partitions=1
  55. $ kafka-ingest format=avro topic=csr_test key-format=avro key-schema=${keyschema} schema=${schema} timestamp=1
  56. {"id": 1} {"before": {"row": {"id": 1, "creature": "fish"}}, "after": {"row": {"id": 1, "creature": "mudskipper"}}}
  57. {"id": 1} {"before": {"row": {"id": 1, "creature": "mudskipper"}}, "after": {"row": {"id": 1, "creature": "salamander"}}}
  58. {"id": 1} {"before": {"row": {"id": 1, "creature": "salamander"}}, "after": {"row": {"id": 1, "creature": "lizard"}}}
  59. ! CREATE CONNECTION csr_conn TO CONFLUENT SCHEMA REGISTRY (
  60. URL '${testdrive.schema-registry-url}'
  61. ) WITH (VALIDATE = true);
  62. contains:Address resolved to a private IP
  63. $ postgres-execute connection=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  64. ALTER SYSTEM SET storage_enforce_external_addresses = false