Skip to content

Commit 10020e6

Browse files
authored
Merge branch 'master' into fix-httpx-instrumentation
2 parents 6fd2926 + 2eb6436 commit 10020e6

File tree

4 files changed

+92
-64
lines changed

4 files changed

+92
-64
lines changed

tests/bdd/features/api_key.feature

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1-
Feature: API Key.
1+
Feature: APM server authentication with API key and secret token
22

3-
Scenario: A configured API key is sent in the Authorization header.
4-
Given an agent
5-
When an api key is set to 'RTNxMjlXNEJt' in the config
6-
Then the Authorization header is 'ApiKey RTNxMjlXNEJt'
3+
Scenario: A configured API key is sent in the Authorization header
4+
Given an agent configured with
5+
| setting | value |
6+
| api_key | RTNxMjlXNEJt |
7+
When the agent sends a request to APM server
8+
Then the Authorization header of the request is 'ApiKey RTNxMjlXNEJt'
79

8-
Scenario: A configured API key takes precedence over a secret token.
9-
Given an agent
10-
When an api key is set to 'MjlXNEJasdfDt' in the config
11-
And a secret_token is set to 'secr3tT0ken' in the config
12-
Then the Authorization header is 'ApiKey MjlXNEJasdfDt'
10+
Scenario: A configured secret token is sent in the Authorization header
11+
Given an agent configured with
12+
| setting | value |
13+
| secret_token | secr3tT0ken |
14+
When the agent sends a request to APM server
15+
Then the Authorization header of the request is 'Bearer secr3tT0ken'
16+
17+
Scenario: A configured API key takes precedence over a secret token
18+
Given an agent configured with
19+
| setting | value |
20+
| api_key | MjlXNEJasdfDt |
21+
| secret_token | secr3tT0ken |
22+
When the agent sends a request to APM server
23+
Then the Authorization header of the request is 'ApiKey MjlXNEJasdfDt'
1324

14-
Scenario: A configured secret token is sent if no API key is configured.
15-
Given an agent
16-
When a secret_token is set to 'secr3tT0ken' in the config
17-
And an api key is not set in the config
18-
Then the Authorization header is 'Bearer secr3tT0ken'

tests/bdd/features/azure_app_service_metadata.feature

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
Feature: Extracting Metadata for Azure App Service
22

33
Background:
4-
Given an instrumented application is configured to collect cloud provider metadata for azure
4+
Given an agent configured with
5+
| setting | value |
6+
| cloud_provider | azure |
57

68
Scenario Outline: Azure App Service with all environment variables present in expected format
79
Given the following environment variables are present

tests/bdd/features/outcome.feature

Lines changed: 43 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,60 @@
11
Feature: Outcome
22

3+
Background: An agent with default configuration
4+
Given an agent
5+
36
# ---- user set outcome
47

58
Scenario: User set outcome on span has priority over instrumentation
6-
Given an agent
7-
And an active span
8-
And user sets span outcome to 'failure'
9-
And span terminates with outcome 'success'
10-
Then span outcome is 'failure'
9+
Given an active span
10+
And the agent sets the span outcome to 'success'
11+
And a user sets the span outcome to 'failure'
12+
When the span ends
13+
Then the span outcome is 'failure'
1114

1215
Scenario: User set outcome on transaction has priority over instrumentation
13-
Given an agent
14-
And an active transaction
15-
And user sets transaction outcome to 'unknown'
16-
And transaction terminates with outcome 'failure'
17-
Then transaction outcome is 'unknown'
16+
Given an active transaction
17+
And the agent sets the transaction outcome to 'failure'
18+
And a user sets the transaction outcome to 'unknown'
19+
When the transaction ends
20+
Then the transaction outcome is 'unknown'
1821

1922
# ---- span & transaction outcome from reported errors
2023

2124
Scenario: span with error
22-
Given an agent
23-
And an active span
24-
And span terminates with an error
25-
Then span outcome is 'failure'
25+
Given an active span
26+
And an error is reported to the span
27+
When the span ends
28+
Then the span outcome is 'failure'
2629

2730
Scenario: span without error
28-
Given an agent
29-
And an active span
30-
And span terminates without error
31-
Then span outcome is 'success'
31+
Given an active span
32+
When the span ends
33+
Then the span outcome is 'success'
3234

3335
Scenario: transaction with error
34-
Given an agent
35-
And an active transaction
36-
And transaction terminates with an error
37-
Then transaction outcome is 'failure'
36+
Given an active transaction
37+
And an error is reported to the transaction
38+
When the transaction ends
39+
Then the transaction outcome is 'failure'
3840

3941
Scenario: transaction without error
40-
Given an agent
41-
And an active transaction
42-
And transaction terminates without error
43-
Then transaction outcome is 'success'
42+
Given an active transaction
43+
When the transaction ends
44+
Then the transaction outcome is 'success'
4445

4546
# ---- HTTP
4647

4748
@http
4849
Scenario Outline: HTTP transaction and span outcome
49-
Given an agent
50-
And an HTTP transaction with <status> response code
51-
Then transaction outcome is "<server>"
52-
Given an HTTP span with <status> response code
53-
Then span outcome is "<client>"
50+
Given an active transaction
51+
And a HTTP call is received that returns <status>
52+
When the transaction ends
53+
Then the transaction outcome is '<server>'
54+
Given an active span
55+
And a HTTP call is made that returns <status>
56+
When the span ends
57+
Then the span outcome is '<client>'
5458
Examples:
5559
| status | client | server |
5660
| 100 | success | success |
@@ -69,11 +73,14 @@ Feature: Outcome
6973

7074
@grpc
7175
Scenario Outline: gRPC transaction and span outcome
72-
Given an agent
73-
And a gRPC transaction with '<status>' status
74-
Then transaction outcome is "<server>"
75-
Given a gRPC span with '<status>' status
76-
Then span outcome is "<client>"
76+
Given an active transaction
77+
And a gRPC call is received that returns '<status>'
78+
When the transaction ends
79+
Then the transaction outcome is '<server>'
80+
Given an active span
81+
And a gRPC call is made that returns '<status>'
82+
When the span ends
83+
Then the span outcome is '<client>'
7784
Examples:
7885
| status | client | server |
7986
| OK | success | success |

tests/bdd/features/user_agent.feature

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,31 @@ Feature: Agent Transport User agent Header
22

33
Scenario: Default user-agent
44
Given an agent
5-
When service name is not set
6-
When service version is not set
7-
Then the User-Agent header matches regex '^apm-agent-[a-z]+/[^ ]*'
5+
When the agent sends a request to APM server
6+
Then the User-Agent header of the request matches regex '^apm-agent-[a-z]+/[^ ]* \(.*\)'
7+
8+
Scenario: Default user-agent when setting invalid service
9+
Given an agent configured with
10+
| setting | value |
11+
| service_name | myService/()<>@ |
12+
When the agent sends a request to APM server
13+
Then the User-Agent header of the request matches regex '^apm-agent-[a-z]+/[^ ]* \(.*\)'
814

915
Scenario: User-agent with service name only
10-
Given an agent
11-
When service name is set to 'myService'
12-
When service version is not set
13-
Then the User-Agent header matches regex '^apm-agent-[a-z]+/[^ ]* \(myService\)'
16+
Given an agent configured with
17+
| setting | value |
18+
| service_name | myService |
19+
When the agent sends a request to APM server
20+
Then the User-Agent header of the request matches regex '^apm-agent-[a-z]+/[^ ]* \(myService\)'
1421

15-
Scenario: User-agent with service name and service version
16-
Given an agent
17-
When service name is set to 'myService'
18-
When service version is set to 'v42'
19-
Then the User-Agent header matches regex '^apm-agent-[a-z]+/[^ ]* \(myService v42\)'
22+
Scenario Outline: User-agent with service name and service version
23+
Given an agent configured with
24+
| setting | value |
25+
| service_name | <SERVICE_NAME> |
26+
| service_version | <SERVICE_VERSION> |
27+
When the agent sends a request to APM server
28+
Then the User-Agent header of the request matches regex '^apm-agent-[a-z]+/[^ ]* \(<ESCAPED_SERVICE_NAME> <ESCAPED_SERVICE_VERSION>\)'
29+
Examples:
30+
| SERVICE_NAME | ESCAPED_SERVICE_NAME | SERVICE_VERSION | ESCAPED_SERVICE_VERSION |
31+
| myService | myService | v42 | v42 |
32+
| myService | myService | 123(:\;)456 | 123_:_;_456 |

0 commit comments

Comments
 (0)