Logstash Rspec Test Library, how does it fundamentally work when creating pipelines?

So, I've been using rspec for a while now while testing my "simple" pipeline configs.
However, as of recent, I'd like to use "complex" filters like "aggregate" and "memcached" but it is hard, if not impossible to find the runtime object of this filter or even mock out some part (for example, in memcached I don't want to use an actual server and in aggregate, I don't literally want to wait for a timeout to occur).

Is there anyone, somewhere that could shed some light on this aspect?

I've tried things like:

 expect_any_instance_of(LogStash::Filters::Aggregate).to receive(:last_flush_timestamp_map).and_return({
      '172.16.0.26': 0
      })

But this does not get called (the tests fails because it is not called)

I've also tried "pipeline.filters" inside the "sample" block as I thought my instances would be there but it does not seem to contain this as it only returns "LogstashDelegator". Even if I would be able to access my filters, the pipeline is closed; but perhaps there is an undocumented way of having a pipeline before the samples hit it?

Any help or insight is more than appreciated!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.