awslabs / amazon-kinesis-client-ruby

A Ruby interface for the Amazon Kinesis Client Library. Allows developers to easily create robust application to process Amazon Kinesis streams in Ruby.
Apache License 2.0
146 stars 55 forks source link

Library broken? RSpec tests some are failing. #58

Closed tenshiAMD closed 8 months ago

tenshiAMD commented 1 year ago

Need to know if this library still works. I just tried to run the RSpec tests and I noticed that some are failing (see logs below).

Does anyone know any sample app that works using this library? Let me know. Thank you.

.......FF

Failures:

  1) Aws::KCLrb::KCLProcess#run should respond to each action by invoking the corresponding processor's method and write a status message to the output IO
     Failure/Error: if processor.version == 1
       #<Double Aws::KCLrb::RecordProcessorBase> received unexpected message :version with (no args)
     # ./lib/aws/kclrb/kcl_process.rb:28:in `initialize'
     # ./spec/kcl_process_spec.rb:50:in `new'
     # ./spec/kcl_process_spec.rb:50:in `block (3 levels) in <module:KCLrb>'

  2) Aws::KCLrb::KCLProcess#run should process a normal stream of actions and produce expected output
     Failure/Error: raise MalformedAction.new("Action '#{action}': #{ke.message}")

     Aws::KCLrb::MalformedAction:
       Action '{"action"=>"initialize", "shardId"=>"shardId-123"}': key not found: "sequenceNumber"
     # ./lib/aws/kclrb/kcl_process.rb:82:in `rescue in process_action'
     # ./lib/aws/kclrb/kcl_process.rb:59:in `process_action'
     # ./lib/aws/kclrb/kcl_process.rb:41:in `run'
     # ./spec/kcl_process_spec.rb:84:in `block (3 levels) in <module:KCLrb>'
     # ------------------
     # --- Caused by: ---
     # KeyError:
     #   key not found: "sequenceNumber"
     #   ./lib/aws/kclrb/kcl_process.rb:65:in `fetch'

Finished in 0.01498 seconds (files took 0.13833 seconds to load)
9 examples, 2 failures

Failed examples:

rspec ./spec/kcl_process_spec.rb:37 # Aws::KCLrb::KCLProcess#run should respond to each action by invoking the corresponding processor's method and write a status message to the output IO
rspec ./spec/kcl_process_spec.rb:58 # Aws::KCLrb::KCLProcess#run should process a normal stream of actions and produce expected output
tenshiAMD commented 1 year ago

Apparently, it somehow works when carefully following the steps in README.md (just make sure the region, streamName, applicationName matches) however I noticed these errors after running the command rake run properties_file=sample.properties

ERROR s.a.k.multilang.DrainChildSTDERRTask[NONE]-Received error line from subprocess [ShardId: shardId-0000000003,
Partition Kev: snsr-0508,
Sequence Number
:49634546017365506900327805313213632183410787121369186354, Length of data: 69] for shard shardId-000000000003

Can anyone explain it? I think the issue is related to the failing RSpec tests or the KCL itself. Let me know. Thank you.

erikbelusic commented 1 year ago

I am having these same issues while trying to run the specs. I think the tests might just be wrong. The first issue looks like the class is doubled and internally the version is checked, but thats not stubbed. The second might be that sequence number is not optional for initialize or that it shouldn't be there at all. It isn't clear to me yet.

here it looks like it shouldnt be there: https://github.com/awslabs/amazon-kinesis-client/blob/master/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/package-info.java#L26-L28

but this class makes it seem like you have sequenceNumber and subSequenceNumber - https://github.com/awslabs/amazon-kinesis-client/blob/master/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/messages/InitializeMessage.java

lucienlu-aws commented 8 months ago

Should be fixed in recent PR