elastic / elastic/logstash

Collection of helpers to improve the testing experience

Open
#3,907 0 comments 0 reactions 0 assignees View on GitHub
discuss tests-infra
Dominant language
Java
Stars
14.9k
Forks
3.5k
Avg merge
19h 14m
Merged PRs (30d)
63

Description

From discussions we started having at #1890 and some of the work already done and discussed in the https://github.com/elastic/logstash-devutils project I created a place holder for the logstash helpers and matchers we can use for testing.

You can see the initial commit of the gem at: https://github.com/elastic/logstash-test-helpers, this aims to be something like shoulda or the rspec-collection_matchers projects where you can just import it and start using it helpers/machers. This gem would also provide us with an option to test out our helpers them self, and nonetheless also support other test runners whenever requested.

Start using it would be as simple as:

```
require "logstash-helpers"

LogstashHelpers.configure do |config|
config.test_framework = :rspec
config.logstash_home = File.expand_path("../", __FILE__)
end
```

You can also see two initial trials of using this gem at:
- https://github.com/purbon/logstash-patterns-core/tree/feature/use-logstash-helpers
- https://github.com/purbon/logstash-input-syslog/blob/feature/use-logstash-helpers/spec/inputs/syslog_spec.rb

To the question should this be included in devutils, I see this as an independent gem, being probably required throw devutils, but I would keep both responsibilities separated to facilitate it's manageability and separations of concerns.

This relatets to: #1890 as the initial issue that reported the need of this, but also to https://github.com/elastic/logstash-devutils/issues/33 with dicussions how to improve the configuration test experience. And https://github.com/elastic/logstash-devutils/issues/36 for integration.

What do you think?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.