Sha256: 3c90dfe9c0a051d3df7ca4e4e458317c572c381c4a2ca247d17852fcc0bcf381
Contents?: true
Size: 850 Bytes
Versions: 10
Compression:
Stored size: 850 Bytes
Contents
# frozen_string_literal: true require 'toxiproxy' module ToxiproxyHelper class << self def included(base) Toxiproxy.reset # listen on localhost, but toxiproxy is in a container itself, thus the upstream uses the Docker-Compose DNS Toxiproxy.populate( [ { name: 'mysql_master', listen: '0.0.0.0:22220', upstream: 'mysql-1:3306' }, { name: 'mysql_proxysql', listen: '0.0.0.0:22222', upstream: 'proxysql:3306' } ]) end def with_kill_and_restart(target, restart_after) thread = Thread.new do sleep(restart_after) unless restart_after.nil? Toxiproxy[target].enable end Toxiproxy[target].disable yield ensure thread.join end end end
Version data entries
10 entries across 10 versions & 2 rubygems