55 lines
1.1 KiB
Python
55 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
from pgbouncer.manager import DEFAULT_CONFIG, DEFAULT_LOG_FACILITY
|
|
|
|
|
|
class ArgsStub():
|
|
config = DEFAULT_CONFIG
|
|
log_facility = DEFAULT_LOG_FACILITY
|
|
verbose = False
|
|
debug = False
|
|
|
|
|
|
class LoggerStub():
|
|
def __init(self, ident, facility, debug, verbose):
|
|
pass
|
|
|
|
def debug(self, msg):
|
|
pass
|
|
|
|
def info(self, msg):
|
|
pass
|
|
|
|
def warning(self, msg):
|
|
pass
|
|
|
|
def error(self, msg):
|
|
pass
|
|
|
|
def format_ex(self, exception):
|
|
return "FMTEX"
|
|
|
|
|
|
class StateStoreStub():
|
|
old_state = None
|
|
test_with_nr_of_errors = 0
|
|
test_with_state = None
|
|
|
|
def load(self)
|
|
state = State()
|
|
|
|
def store(self, state):
|
|
new_state = json.dumps(state_to_store, sort_keys=True, indent=2)
|
|
if self.old_state and self.old_state == new_state:
|
|
return STORE_NOCHANGE
|
|
sel.old_state = new_state
|
|
|
|
if test_with_nr_of_errors:
|
|
test_with_nr_of_errors -= 1
|
|
self.err = "Storing state failed: just testing"
|
|
return STORE_ERROR
|
|
|
|
return STORE_UPDATED
|
|
|
|
|