protobuf-required.td 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 single-replica-cluster=quickstart
  10. # Test that required Protobuf fields are unsupported.
  11. $ file-append path=required.proto
  12. syntax = "proto2";
  13. message Required {
  14. required int32 f = 1;
  15. }
  16. $ protobuf-compile-descriptors inputs=required.proto output=required.pb set-var=required-schema
  17. $ kafka-create-topic topic=required partitions=1
  18. $ kafka-ingest topic=required format=protobuf descriptor-file=required.pb message=Required
  19. {"f": 42}
  20. > CREATE CONNECTION kafka_conn
  21. TO KAFKA (BROKER '${testdrive.kafka-addr}', SECURITY PROTOCOL PLAINTEXT);
  22. > CREATE SOURCE required
  23. IN CLUSTER ${arg.single-replica-cluster}
  24. FROM KAFKA CONNECTION kafka_conn (TOPIC 'testdrive-required-${testdrive.seed}')
  25. FORMAT PROTOBUF MESSAGE '.Required' USING SCHEMA '${required-schema}'
  26. > SELECT * FROM required
  27. f
  28. ----
  29. 42
  30. $ kafka-ingest topic=required format=protobuf descriptor-file=required.pb message=Required
  31. {}
  32. ! SELECT * FROM required
  33. contains:protobuf message missing required field f