connect_timeout.td 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. > DROP SOURCE IF EXISTS mz_source CASCADE;
  10. > DROP CONNECTION IF EXISTS mysql_conn CASCADE;
  11. > DROP SECRET IF EXISTS mysql_pass;
  12. # Override MySQL connect timeout to 3s
  13. $ postgres-connect name=mz_system url=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  14. $ postgres-execute connection=mz_system
  15. ALTER SYSTEM SET mysql_source_connect_timeout = '3s';
  16. # block connectivity to mysql
  17. $ http-request method=POST url=http://toxiproxy:8474/proxies content-type=application/json
  18. {
  19. "name": "mysql",
  20. "listen": "0.0.0.0:3306",
  21. "upstream": "mysql:3306",
  22. "enabled": true
  23. }
  24. $ http-request method=POST url=http://toxiproxy:8474/proxies/mysql/toxics content-type=application/json
  25. {
  26. "name": "mysql",
  27. "type": "timeout",
  28. "attributes": { "delay": 0 }
  29. }
  30. > CREATE SECRET mysql_pass AS '${arg.mysql-root-password}';
  31. ! CREATE CONNECTION mysql_conn TO MYSQL (
  32. HOST "toxiproxy",
  33. USER root,
  34. PASSWORD SECRET mysql_pass
  35. );
  36. contains:connection attempt timed out after 3s
  37. $ http-request method=DELETE url=http://toxiproxy:8474/proxies/mysql