mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-23 09:26:30 +00:00
* Ruby integration tests * forgot a file * refactor * refactoring * more refactoring * remove config helper * try multiple databases * fix * more databases * Use pg stats * ports * speed * Fix tests * preload library * comment
22 lines
446 B
Ruby
22 lines
446 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'pg'
|
|
require_relative 'helpers/pgcat_helper'
|
|
|
|
QUERY_COUNT = 300
|
|
MARGIN_OF_ERROR = 0.30
|
|
|
|
def with_captured_stdout_stderr
|
|
sout = STDOUT.clone
|
|
serr = STDERR.clone
|
|
STDOUT.reopen("/tmp/out.txt", "w+")
|
|
STDERR.reopen("/tmp/err.txt", "w+")
|
|
STDOUT.sync = true
|
|
STDERR.sync = true
|
|
yield
|
|
return File.read('/tmp/out.txt'), File.read('/tmp/err.txt')
|
|
ensure
|
|
STDOUT.reopen(sout)
|
|
STDERR.reopen(serr)
|
|
end
|