Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Revolyssup committed Jan 26, 2025
1 parent 75fce79 commit 1ad7c5f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 10 deletions.
35 changes: 25 additions & 10 deletions t/plugin/opentelemetry3.t
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ add_block_preprocessor(sub {
plugins:
- http-logger
- opentelemetry
plugin_attr:
opentelemetry:
set_ngx_var: true
batch_span_processor:
max_export_batch_size: 1
inactive_timeout: 0.5
_EOC_
$block->set_value("extra_yaml_config", $extra_yaml_config);
}
Expand Down Expand Up @@ -107,7 +101,7 @@ __DATA__
"max_export_batch_size": 1,
"inactive_timeout": 0.5
},
set_ngx_var: true
"set_ngx_var": true
}]]
)
if code >= 300 then
Expand Down Expand Up @@ -177,12 +171,33 @@ qr/request log: \{.*"opentelemetry_context_traceparent":"00-\w{32}-\w{16}-01".*\
plugins:
- http-logger
- opentelemetry
plugin_attr:
opentelemetry:
set_ngx_var: false
--- config
location /t {
content_by_lua_block {
local t = require("lib.test_admin").test
local code, body = t('/apisix/admin/plugin_metadata/opentelemetry',
ngx.HTTP_PUT,
[[{
"set_ngx_var": false
}]]
)
if code >= 300 then
ngx.status = code
return body
end
}
}
--- request
GET /t
=== TEST 4: trigger opentelemetry with open set variables
--- request
GET /hello
--- response_body
hello world
--- wait: 1
--- error_log eval
qr/request log: \{.*"opentelemetry_context_traceparent":"".*\}/
4 changes: 4 additions & 0 deletions t/plugin/opentelemetry4-bugfix-pb-state.t
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ __DATA__
ngx.say(body)
}
}
--- request
GET /t
--- response_body
passed
Expand Down
3 changes: 3 additions & 0 deletions t/plugin/opentelemetry5.t
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ __DATA__
"inactive_timeout": 0.5
},
"trace_id_source": "x-request-id",
"resource": {
"service.name": "APISIX"
},
"collector": {
"address": "127.0.0.1:4318",
"request_timeout": 3,
Expand Down

0 comments on commit 1ad7c5f

Please sign in to comment.