While a lambda is still processing (archive unpacking etc), the lambda state should be set to "Pending" (currently "Active") and invocations to that lambda should fail (currently, it can end up in a inconsistent state in this case, like lambdas being executed without layers).

Lambda state should reflect the current internal state, and invocations should fail if not active.
class TestLambdaFallbackUrl(unittest.TestCase):
    @staticmethod
    def _run_forward_to_fallback_url(url, fallback=True, lambda_name=None, num_requests=3):
        lambda_client = aws_stack.create_external_boto_client("lambda")
        if fallback:
            config.LAMBDA_FALLBACK_URL = url
        else:
            config.LAMBDA_FORWARD_URL = url
        try:
            result = []
            for i in range(num_requests):
                lambda_name = lambda_name or "non-existing-lambda-%s" % i
                ctx = {"env": "test"}
                tmp = lambda_client.invoke(
                    FunctionName=lambda_name,
                    Payload=b'{"foo":"bar"}',
                    InvocationType="RequestResponse",
                    ClientContext=to_str(base64.b64encode(to_bytes(json.dumps(ctx)))),
                )
            result.append(tmp)
            return result
        finally:
            if fallback:
                config.LAMBDA_FALLBACK_URL = ""
            else:
                config.LAMBDA_FORWARD_URL = ""
    def test_forward_to_fallback_url_dynamodb(self):
        db_table = "lambda-records"
        ddb_client = aws_stack.create_external_boto_client("dynamodb")
        def num_items():