canary-redpanda-sources.td 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. $ kafka-create-topic topic=bytes replication-factor=3
  10. $ kafka-ingest format=bytes key-terminator=: key-format=bytes topic=bytes repeat=100
  11. abc:abc
  12. > DROP SOURCE IF EXISTS redpanda_bytes CASCADE;
  13. > DROP CONNECTION IF EXISTS redpanda_conn CASCADE;
  14. > DROP SECRET IF EXISTS redpanda_password CASCADE;
  15. > CREATE SECRET redpanda_password AS '${arg.redpanda-password}';
  16. > CREATE CONNECTION redpanda_conn TO KAFKA (
  17. BROKER '${testdrive.kafka-addr}',
  18. SASL MECHANISMS = 'SCRAM-SHA-512',
  19. SASL USERNAME = '${arg.redpanda-username}',
  20. SASL PASSWORD = SECRET redpanda_password
  21. );
  22. > CREATE SOURCE redpanda_bytes
  23. IN CLUSTER canary_sources
  24. FROM KAFKA CONNECTION redpanda_conn (TOPIC 'testdrive-bytes-${testdrive.seed}');
  25. > CREATE TABLE redpanda_bytes_tbl FROM SOURCE redpanda_bytes (REFERENCE "testdrive-bytes-${testdrive.seed}")
  26. FORMAT BYTES
  27. ENVELOPE NONE;
  28. > CREATE MATERIALIZED VIEW redpanda_bytes_view AS SELECT COUNT(*) AS cnt FROM redpanda_bytes_tbl;
  29. > CREATE DEFAULT INDEX ON redpanda_bytes_view;
  30. > SELECT cnt from redpanda_bytes_view
  31. 100