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.
create_result = create_lambda_function(
                func_name=lambda_name,
                zip_file=archive,
                runtime=LAMBDA_RUNTIME_JAVA11,
                handler="cloud.localstack.sample.LambdaHandlerWithLib",
            )
            snapshot.match(f"create-result-{archive_desc}", create_result)
            result = lambda_client.invoke(FunctionName=lambda_name, Payload=b'{"echo":"echo"}')
            result = read_streams(result)
            snapshot.match(f"invoke-result-{archive_desc}", result)
            result_data = result["Payload"]
            assert 200 == result["StatusCode"]
            assert "echo" in to_str(result_data)
    def test_sns_event(self, lambda_client, simple_java_lambda):
        result = lambda_client.invoke(
            FunctionName=simple_java_lambda,
            InvocationType="Event",
            Payload=b'{"Records": [{"Sns": {"Message": "{}"}}]}',
        )
        assert 202 == result["StatusCode"]
    def test_ddb_event(self, lambda_client, simple_java_lambda):
        result = lambda_client.invoke(
            FunctionName=simple_java_lambda,
            InvocationType="Event",
            Payload=b'{"Records": [{"dynamodb": {"Message": "{}"}}]}',
        )
        assert 202 == result["StatusCode"]
    @parametrize_java_runtimes
    def test_kinesis_invocation(
        self, lambda_client, create_lambda_function, test_java_zip, runtime