def test_ser2_should_be_used_if_we_stop_rest1_on_ser1(infra): stopHaOnLb1 = infra.server("ser1").ssh("service rest1 stop") time.sleep(5) conn = httplib.HTTPConnection("192.168.33.201:80") conn.request("GET", "/rest1") r = conn.getresponse() data = json.loads(r.read()) assert r.status == 200 assert data["hostname"] == "ser2" time.sleep(5) stopHaOnLb1 = infra.server("ser1").ssh("service rest1 start")
def test_we_must_get_hostname(infra): conn = httplib.HTTPConnection(infra.server('service1').ip+":8001") conn.request("GET", "/") r = conn.getresponse() data = json.loads(r.read()) assert r.status == 200 assert data['hostname'] == 'service1'
def getStatsHtml(infra, login, password): conn = httplib.HTTPConnection(infra.server("lb").ip + ":80") auth = base64.encodestring(login + ":" + password).replace("\n", "") headers = {"Authorization": "Basic %s" % auth} conn.request("GET", "/stats", headers=headers) r = conn.getresponse() return r
def test_if_haproxy_is_stopped_on_lb1_it_will_be_affected_on_lb2(infra): stopHaOnLb1 = infra.server('lb1').ssh('service haproxy stop') time.sleep(5) vipOnLb2 = infra.server('lb2').ssh('ip addr show').stdoutContains("192.168.33.201") assert vipOnLb2 == True
def test_vip_is_on_lb1(infra): vipOnLb1 = infra.server('lb1').ssh('ip addr show').stdoutContains("192.168.33.201") assert vipOnLb1 == True