Exemplo n.º 1
0
def test_heartbeat_returns_200(
    client, db, phabdouble, request_mocker, redis_cache, s3, jwks
):
    request_mocker.get(
        trans_url(''), status_code=200, text='Welcome to Autoland'
    )
    assert client.get('/__heartbeat__').status_code == 200
Exemplo n.º 2
0
 def mock_http_error_response(self):
     """Add response to autoland endpoint."""
     self.mock.post(
         trans_url("autoland"),
         status_code=500,
         request_headers={"Authorization": self.expected_auth_header},
     )
Exemplo n.º 3
0
 def mock_malformed_data_response(self):
     """Add response to autoland endpoint."""
     self.mock.post(
         trans_url('autoland'),
         text='no json for you',
         status_code=200,
         request_headers={'Authorization': self.expected_auth_header})
Exemplo n.º 4
0
 def mock_successful_response(self, request_id=1):
     """Add response to autoland endpoint."""
     self.mock.post(
         trans_url('autoland'),
         json={'request_id': request_id},
         status_code=200,
         request_headers={'Authorization': self.expected_auth_header})
Exemplo n.º 5
0
def test_heartbeat_returns_http_502_if_phabricator_ping_returns_error(
        client, request_mocker, redis_cache, s3, jwks, treestatusdouble):
    error_json = {
        "result": None,
        "error_code": "ERR-CONDUIT-CORE",
        "error_info": "BOOM",
    }

    request_mocker.get(trans_url(""),
                       status_code=200,
                       text="Welcome to Autoland")
    request_mocker.get(phab_url("conduit.ping"),
                       status_code=500,
                       json=error_json)
    response = client.get("/__heartbeat__")

    assert request_mocker.called
    assert response.status_code == 502
Exemplo n.º 6
0
 def mock_connection_error_response(self):
     """Add response to autoland endpoint."""
     self.mock.post(
         trans_url('autoland'),
         exc=requests.exceptions.ConnectTimeout,
     )
Exemplo n.º 7
0
def test_heartbeat_returns_200(client, db, phabdouble, request_mocker,
                               redis_cache, s3, jwks, treestatusdouble):
    request_mocker.get(trans_url(""),
                       status_code=200,
                       text="Welcome to Autoland")
    assert client.get("/__heartbeat__").status_code == 200
Exemplo n.º 8
0
def test_transplant_unhealthy(app, request_mocker):
    request_mocker.get(trans_url(""), exc=requests.ConnectTimeout)
    assert transplant_subsystem.healthy() is not True
Exemplo n.º 9
0
def test_transplant_healthy(app, request_mocker):
    request_mocker.get(trans_url(""),
                       status_code=200,
                       text="Welcome to Autoland")
    assert transplant_subsystem.healthy() is True
Exemplo n.º 10
0
def test_transplant_unhealthy(app, request_mocker):
    request_mocker.get(trans_url(''), exc=requests.ConnectTimeout)
    assert health.check_transplant()
Exemplo n.º 11
0
def test_transplant_healthy(app, request_mocker):
    request_mocker.get(trans_url(''),
                       status_code=200,
                       text='Welcome to Autoland')
    assert not health.check_transplant()
Exemplo n.º 12
0
 def create_autoland_response(self, request_id=1):
     """Add response to autoland endpoint."""
     self.mock.post(trans_url('autoland'),
                    json={'request_id': request_id},
                    status_code=200)