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.
):
        payload = (
            b'{"Records": [{'
            b'"kinesis": {"data": "dGVzdA==", "partitionKey": "partition"},'
            b'"eventID": "shardId-000000000001:12345678901234567890123456789012345678901234567890",'
            b'"eventSourceARN": "arn:aws:kinesis:us-east-1:123456789012:stream/test"}]}'
        )
        
        function_name = f"test-lambda-{short_uid()}"
        create_lambda_function(
            func_name=function_name,
            zip_file=test_java_zip,
            runtime=runtime,
            handler="cloud.localstack.awssdkv1.sample.KinesisLambdaHandler",
        )
        result = lambda_client.invoke(FunctionName=function_name, Payload=payload)
        result_data = result["Payload"].read()
        assert 200 == result["StatusCode"]
        assert '"test "' == to_str(result_data).strip()
    def test_kinesis_event(self, lambda_client, simple_java_lambda):
        payload = (
            b'{"Records": [{'
            b'"kinesis": {"data": "dGVzdA==", "partitionKey": "partition"},'
            b'"eventID": "shardId-000000000001:12345678901234567890123456789012345678901234567890",'
            b'"eventSourceARN": "arn:aws:kinesis:us-east-1:123456789012:stream/test"}]}'
        )
        result = lambda_client.invoke(
            FunctionName=simple_java_lambda,
            InvocationType="Event",
            Payload=payload,