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.
def check_item():
            result = run_safe(ddb_client.scan, TableName=db_table)
            self.assertEqual("non-existing-lambda", result["Items"][0]["function_name"]["S"])
        retry(check_item)
class TestDockerExecutors(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.lambda_client = aws_stack.create_external_boto_client("lambda")
        cls.s3_client = aws_stack.create_external_boto_client("s3")
    @pytest.mark.skipif(not use_docker(), reason="Only applicable with docker executor")
    def test_additional_docker_flags(self):
        flags_before = config.LAMBDA_DOCKER_FLAGS
        env_value = short_uid()
        config.LAMBDA_DOCKER_FLAGS = f"-e Hello={env_value}"
        function_name = "flags-{}".format(short_uid())
        try:
            testutil.create_lambda_function(
                handler_file=TEST_LAMBDA_ENV,
                libs=TEST_LAMBDA_LIBS,
                func_name=function_name,
            )
            lambda_client = aws_stack.create_external_boto_client("lambda")
            result = lambda_client.invoke(FunctionName=function_name, Payload="{}")
            self.assertEqual(200, result["ResponseMetadata"]["HTTPStatusCode"])
            result_data = result["Payload"].read()
            result_data = json.loads(to_str(result_data))
            self.assertEqual({"Hello": env_value}, result_data)
        finally:
            config.LAMBDA_DOCKER_FLAGS = flags_before