コード例 #1
0
    def test_health_check_ok(self, engine_action):
        obj1_key = "obj1"
        engine_action._save_obj(obj1_key, "check")
        request = HealthCheckRequest(artifacts=obj1_key)
        expected_response = HealthCheckResponse(status=HealthCheckResponse.OK)
        response = engine_action._health_check(request=request, context=None)

        assert expected_response.status == response.status
コード例 #2
0
    def test_health_check_exception(self):
        class BadEngineAction(EngineBaseAction):
            def execute(self, **kwargs):
                return 1

            def __getattribute__(self, name):
                if name == 'obj1':
                    raise Exception('I am Bad!')
                else:
                    return EngineBaseAction.__getattribute__(self, name)

        engine_action = BadEngineAction()

        obj1_key = "obj1"
        request = HealthCheckRequest(artifacts=obj1_key)
        expected_response = HealthCheckResponse(status=HealthCheckResponse.NOK)
        response = engine_action._health_check(request=request, context=None)

        assert expected_response.status == response.status