Skip to content

Commit 51f2830

Browse files
committed
Record tests against opentelemetry-go
1 parent 46bfa05 commit 51f2830

3 files changed

Lines changed: 53 additions & 26 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## How to record tests cassettes
2+
3+
### Run the server
4+
5+
Checkout [opentelemetry-go](https://github.com/open-telemetry/opentelemetry-go) and build it with:
6+
7+
```
8+
make
9+
```
10+
11+
Then run the example server with:
12+
13+
```
14+
./internal/examples/server/bin/server
15+
```
16+
17+
### Record the cassettes
18+
19+
We are using `vcr.py` for recording HTTP responses from the server, it works by serializing the response in a yaml file and then replying
20+
it. `vcr.py` will record a new cassettes only if it does not find it so to redo a recording you need to delete the recording in the
21+
`cassettes/` directory.
22+
23+
Because of vcr.py issues with older urllib3 versions tests are skipped with Python older than 3.10.

opamp/opentelemetry-opamp-client/tests/opamp/cassettes/test_connection_remote_config_status_heartbeat_disconnection.yaml

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
interactions:
22
- request:
33
body: !!binary |
4-
ChABnL5Ramh0Y4Y52kt7YrNoGj0KFQoMc2VydmljZS5uYW1lEgUKA2ZvbwokChtkZXBsb3ltZW50
4+
ChABnL5b5k5046/FazbAJ7r4Gj0KFQoMc2VydmljZS5uYW1lEgUKA2ZvbwokChtkZXBsb3ltZW50
55
LmVudmlyb25tZW50Lm5hbWUSBQoDZm9vIIdg
66
headers:
77
Accept:
@@ -17,27 +17,26 @@ interactions:
1717
User-Agent:
1818
- OTel-OpAMP-Python/0.1b0.dev
1919
method: POST
20-
uri: http://localhost:4320/v1/opamp
20+
uri: https://localhost:4320/v1/opamp
2121
response:
2222
body:
2323
string: !!binary |
24-
ChABnL5Ramh0Y4Y52kt7YrNoGmYKOgo4CgdlbGFzdGljEi0KGXsibG9nZ2luZ19sZXZlbCI6ImRl
25-
YnVnIn0SEGFwcGxpY2F0aW9uL2pzb24SKGY3MzA5M2VjZDEyNjkzZGMxNDUxYWQ2MjdlZDA2MWJl
26-
ZWM5ZjU1OWM4AlIA
24+
ChABnL5b5k5046/FazbAJ7r4GioKBgoECgASABIg47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZ
25+
G3hSuFUwAVIA
2726
headers:
2827
Content-Length:
29-
- '126'
28+
- '66'
3029
Content-Type:
3130
- application/x-protobuf
3231
Date:
33-
- Thu, 05 Mar 2026 14:05:32 GMT
32+
- Thu, 05 Mar 2026 14:16:59 GMT
3433
status:
3534
code: 200
3635
message: OK
3736
- request:
3837
body: !!binary |
39-
ChABnL5Ramh0Y4Y52kt7YrNoEAEgh2A6LAooZjczMDkzZWNkMTI2OTNkYzE0NTFhZDYyN2VkMDYx
40-
YmVlYzlmNTU5YxAB
38+
ChABnL5b5k5046/FazbAJ7r4EAEgh2A6JAog47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hS
39+
uFUQAQ==
4140
headers:
4241
Accept:
4342
- '*/*'
@@ -46,30 +45,31 @@ interactions:
4645
Connection:
4746
- keep-alive
4847
Content-Length:
49-
- '69'
48+
- '61'
5049
Content-Type:
5150
- application/x-protobuf
5251
User-Agent:
5352
- OTel-OpAMP-Python/0.1b0.dev
5453
method: POST
55-
uri: http://localhost:4320/v1/opamp
54+
uri: https://localhost:4320/v1/opamp
5655
response:
5756
body:
5857
string: !!binary |
59-
ChABnL5Ramh0Y4Y52kt7YrNoOAJSAA==
58+
ChABnL5b5k5046/FazbAJ7r4GioKBgoECgASABIg47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZ
59+
G3hSuFUwAVIA
6060
headers:
6161
Content-Length:
62-
- '22'
62+
- '66'
6363
Content-Type:
6464
- application/x-protobuf
6565
Date:
66-
- Thu, 05 Mar 2026 14:05:32 GMT
66+
- Thu, 05 Mar 2026 14:16:59 GMT
6767
status:
6868
code: 200
6969
message: OK
7070
- request:
7171
body: !!binary |
72-
ChABnL5Ramh0Y4Y52kt7YrNoEAIgh2A=
72+
ChABnL5b5k5046/FazbAJ7r4EAIgh2A=
7373
headers:
7474
Accept:
7575
- '*/*'
@@ -84,24 +84,25 @@ interactions:
8484
User-Agent:
8585
- OTel-OpAMP-Python/0.1b0.dev
8686
method: POST
87-
uri: http://localhost:4320/v1/opamp
87+
uri: https://localhost:4320/v1/opamp
8888
response:
8989
body:
9090
string: !!binary |
91-
ChABnL5Ramh0Y4Y52kt7YrNoOAJSAA==
91+
ChABnL5b5k5046/FazbAJ7r4GioKBgoECgASABIg47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZ
92+
G3hSuFUwAVIA
9293
headers:
9394
Content-Length:
94-
- '22'
95+
- '66'
9596
Content-Type:
9697
- application/x-protobuf
9798
Date:
98-
- Thu, 05 Mar 2026 14:05:33 GMT
99+
- Thu, 05 Mar 2026 14:17:00 GMT
99100
status:
100101
code: 200
101102
message: OK
102103
- request:
103104
body: !!binary |
104-
ChABnL5Ramh0Y4Y52kt7YrNoEAMgh2BKAA==
105+
ChABnL5b5k5046/FazbAJ7r4EAMgh2BKAA==
105106
headers:
106107
Accept:
107108
- '*/*'
@@ -116,18 +117,19 @@ interactions:
116117
User-Agent:
117118
- OTel-OpAMP-Python/0.1b0.dev
118119
method: POST
119-
uri: http://localhost:4320/v1/opamp
120+
uri: https://localhost:4320/v1/opamp
120121
response:
121122
body:
122123
string: !!binary |
123-
ChABnL5Ramh0Y4Y52kt7YrNoOAJSAA==
124+
ChABnL5b5k5046/FazbAJ7r4GioKBgoECgASABIg47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZ
125+
G3hSuFUwAVIA
124126
headers:
125127
Content-Length:
126-
- '22'
128+
- '66'
127129
Content-Type:
128130
- application/x-protobuf
129131
Date:
130-
- Thu, 05 Mar 2026 14:05:34 GMT
132+
- Thu, 05 Mar 2026 14:17:01 GMT
131133
status:
132134
code: 200
133135
message: OK

opamp/opentelemetry-opamp-client/tests/opamp/test_e2e.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ def opamp_handler(agent, client, message):
5454
agent.send(payload=message)
5555

5656
opamp_client = OpAMPClient(
57-
endpoint="http://localhost:4320/v1/opamp",
57+
endpoint="https://localhost:4320/v1/opamp",
5858
agent_identifying_attributes={
5959
"service.name": "foo",
6060
"deployment.environment.name": "foo",
6161
},
62+
tls_certificate=False,
6263
)
6364
opamp_agent = OpAMPAgent(
6465
interval=1,
@@ -97,11 +98,12 @@ def test_with_server_not_responding(caplog):
9798
opamp_handler = mock.Mock()
9899

99100
opamp_client = OpAMPClient(
100-
endpoint="http://localhost:4321/v1/opamp",
101+
endpoint="https://localhost:4399/v1/opamp",
101102
agent_identifying_attributes={
102103
"service.name": "foo",
103104
"deployment.environment.name": "foo",
104105
},
106+
tls_certificate=False,
105107
)
106108
opamp_agent = OpAMPAgent(
107109
interval=1,

0 commit comments

Comments
 (0)