Skip to content

Commit

Permalink
Add test for parse_errors_total being reset across namespaces (#218)
Browse files Browse the repository at this point in the history
* Add test for parse_errors_total being reset across namespaces

* Add more test cases
  • Loading branch information
martin-helmich committed Dec 22, 2021
1 parent f09c9dc commit 1664ce8
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 1 deletion.
59 changes: 58 additions & 1 deletion features/issues.feature
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,62 @@ Feature: Various issues reported in the bug tracker remain solved
"""
Then the exporter should report value 12 for metric test_http_upstream_time_seconds_sum{method="GET",status="200"}

Scenario: Issue 212: Parse errors from multiple namespaces
Given a running exporter listening with configuration file "test-config-issue212.yaml"
When the following HTTP request is logged to "access.log"
"""
wrong
foo
wrong
wrong
foo
"""
And the following HTTP request is logged to "access2.log"
"""
bar
wrong
bar
wrong
"""
Then the exporter should report value 3 for metric test_parse_errors_total
And the exporter should report value 2 for metric test2_parse_errors_total

Scenario: Issue 212: Parse errors from multiple files in same namespace
Given a running exporter listening with configuration file "test-config-issue212b.yaml"
When the following HTTP request is logged to "access.log"
"""
foo
bar
bar
bar
"""
And the following HTTP request is logged to "access2.log"
"""
bar
bar
"""
Then the exporter should report value 5 for metric test_parse_errors_total

Scenario: Issue 212: Parse errors from multiple namespaces with namespace as label
Given a running exporter listening with configuration file "test-config-issue212c.yaml"
When the following HTTP request is logged to "access.log"
"""
wrong
foo
wrong
wrong
foo
"""
And the following HTTP request is logged to "access2.log"
"""
bar
wrong
bar
wrong
"""
Then the exporter should report value 3 for metric http_parse_errors_total{vhost="test"}
And the exporter should report value 2 for metric http_parse_errors_total{vhost="test2"}

Scenario: Issue 224: Missing float values
Given a running exporter listening with configuration file "test-config-issue217.yaml"
When the following HTTP request is logged to "access.log"
Expand All @@ -44,4 +100,5 @@ Feature: Various issues reported in the bug tracker remain solved
www.example.com 10.0.0.2 - - [27/Oct/2021:06:00:15 +0200] "GET /websocket HTTP/1.1" 200 552 "-" "AnotherUserAgent" - "1.000" . TLSv1.3/TLS_AES_256_GCM_SHA384 1234567890 www.example.com
"""
Then the exporter should report value 0 for metric test_parse_errors_total
Then the exporter should report value 4 for metric test_http_upstream_time_seconds_sum{method="GET",status="200"}
Then the exporter should report value 4 for metric test_http_upstream_time_seconds_sum{method="GET",status="200"}

14 changes: 14 additions & 0 deletions features/test-config-issue212.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
enable_experimental: true

listen:
port: 4040

namespaces:
- name: test
format: "foo"
source_files:
- .behave-sandbox/access.log
- name: test2
format: "bar"
source_files:
- .behave-sandbox/access2.log
11 changes: 11 additions & 0 deletions features/test-config-issue212b.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
enable_experimental: true

listen:
port: 4040

namespaces:
- name: test
format: "foo"
source_files:
- .behave-sandbox/access.log
- .behave-sandbox/access2.log
20 changes: 20 additions & 0 deletions features/test-config-issue212c.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
enable_experimental: true

listen:
port: 4040

namespaces:
- name: test
namespace_label: vhost
metrics_override:
prefix: http
format: "foo"
source_files:
- .behave-sandbox/access.log
- name: test2
namespace_label: vhost
metrics_override:
prefix: http
format: "bar"
source_files:
- .behave-sandbox/access2.log

0 comments on commit 1664ce8

Please sign in to comment.