diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index f178628..6617931 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -4,11 +4,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: true - uses: ruby/setup-ruby@v1 with: - ruby-version: 3.2 + ruby-version: '3.2' - run: gem install jls-grok minitest - run: ruby test/test.rb diff --git a/README.md b/README.md index 0f9dfa1..717ec43 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Tests In the `test/` directory, there is a test suite that tries to make sure that no previously supported log line will break because of changing common patterns and such. It also returns results a lot faster than doing `sudo service logstash restart` :-). -The test suite needs the patterns provided by Logstash, you can easily pull these from github by running `git submodule update --init`. To run the test suite, you also need `ruby 2.2` or higher, and the `jls-grok` and `minitest` gems. Then simply execute `ruby test/test.rb`. +The test suite needs the patterns provided by Logstash, you can easily pull these from github by running `git submodule update --init`. To run the test suite, you need a recent version of `ruby` (`2.6` or newer should work), and the `jls-grok` and `minitest` gems. Then simply execute `ruby test/test.rb`. NOTE: The whole test process can now be executed inside a docker container, simply by running the `runtests.sh` script. Adding new test cases can easily be done by creating new yaml files in the test directory. Each file specifies a grok pattern to validate, a sample log line, and a list of expected results. diff --git a/runtests.sh b/runtests.sh new file mode 100755 index 0000000..e08eba8 --- /dev/null +++ b/runtests.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +set -eux + +git submodule update --init + +docker build -t postfix-grok-patterns-runtests - <