|
16 | 16 | cm_service_name = f"{TEST_DATA}/otel/configmap-with-service-name.yaml" |
17 | 17 | cm_otel_trace = f"{TEST_DATA}/otel/configmap-with-otel-trace.yaml" |
18 | 18 | cm_all = f"{TEST_DATA}/otel/configmap-with-all.yaml" |
| 19 | +cm_all_except_endpoint = f"{TEST_DATA}/otel/configmap-with-all-except-endpoint.yaml" |
19 | 20 | otel_module = "modules/ngx_otel_module.so" |
20 | 21 | exporter = "otel.example.com:4317" |
21 | 22 | otel_exporter_header_name = "x-otel-header" |
@@ -420,3 +421,53 @@ def test_otel_all( |
420 | 421 | cm_default, |
421 | 422 | ) |
422 | 423 | wait_before_test(WAIT_TIME) |
| 424 | + |
| 425 | + def test_otel_all_except_endpoint( |
| 426 | + self, |
| 427 | + kube_apis, |
| 428 | + ingress_controller_prerequisites, |
| 429 | + ingress_controller, |
| 430 | + ): |
| 431 | + """ |
| 432 | + Test: |
| 433 | + 1. NIC starts with all otel configuration except endpoint configured in the `nginx-config` |
| 434 | + 2. Ensure that the `ngx_otel_module.so` is not in the nginx.conf |
| 435 | + 3. Ensure that the `otel_exporter` is not in the nginx.conf |
| 436 | + 4. Ensure that the `service-name` is not in the nginx.conf |
| 437 | + 5. Ensure that `otel_trace` is not in the nginx.conf |
| 438 | + """ |
| 439 | + configmap_name = "nginx-config" |
| 440 | + |
| 441 | + print("Step 1: apply nginx-config map") |
| 442 | + replace_configmap_from_yaml( |
| 443 | + kube_apis.v1, |
| 444 | + configmap_name, |
| 445 | + ingress_controller_prerequisites.namespace, |
| 446 | + cm_all_except_endpoint, |
| 447 | + ) |
| 448 | + |
| 449 | + wait_before_test(WAIT_TIME) |
| 450 | + nginx_config = get_nginx_template_conf( |
| 451 | + kube_apis.v1, ingress_controller_prerequisites.namespace, print_log=False |
| 452 | + ) |
| 453 | + |
| 454 | + print("Step 2: Ensure that the otel module is not loaded") |
| 455 | + assert otel_module not in (nginx_config) |
| 456 | + |
| 457 | + print("Step 3: Ensure that the otel_exporter is not enabled") |
| 458 | + assert "otel_exporter" not in (nginx_config) |
| 459 | + |
| 460 | + print("Step 4: Ensure that the service-name is not correctly configured") |
| 461 | + assert f"otel_service_name {otel_service_name}" not in (nginx_config) |
| 462 | + |
| 463 | + print("Step 5: Ensure that otel_trace is not configured") |
| 464 | + assert "otel_trace on;" not in (nginx_config) |
| 465 | + |
| 466 | + print("Step 6: reset the configmap to default") |
| 467 | + replace_configmap_from_yaml( |
| 468 | + kube_apis.v1, |
| 469 | + configmap_name, |
| 470 | + ingress_controller_prerequisites.namespace, |
| 471 | + cm_default, |
| 472 | + ) |
| 473 | + wait_before_test(WAIT_TIME) |
0 commit comments