connect_timeout_latency.td 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 2s
  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 = '2s';
  16. # delay connectivity to mysql by 3s
  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": "latency",
  28. "attributes": { "latency": 3000 }
  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 2s
  37. # Override MySQL connect timeout to 30s
  38. $ postgres-connect name=mz_system url=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  39. $ postgres-execute connection=mz_system
  40. ALTER SYSTEM SET mysql_source_connect_timeout = '30s';
  41. > CREATE CONNECTION mysql_conn TO MYSQL (
  42. HOST "toxiproxy",
  43. USER root,
  44. PASSWORD SECRET mysql_pass
  45. );
  46. > DROP CONNECTION mysql_conn
  47. $ http-request method=DELETE url=http://toxiproxy:8474/proxies/mysql