Skip to content

Commit db08e77

Browse files
committed
refactor: streamline logging and test execution in conformance tests
- Removed redundant logging statements in the ConfigmapGzip and ConfigMapGzipEnvoy tests to enhance clarity and reduce noise during test execution. - Simplified the test case iteration by eliminating unnecessary index tracking, improving code readability. - Updated error handling to provide more concise failure messages, ensuring quicker identification of issues during test runs. - Overall, these changes aim to improve the maintainability and efficiency of the conformance test suite.
1 parent 9e36755 commit db08e77

File tree

3 files changed

+17
-296
lines changed

3 files changed

+17
-296
lines changed

β€Žtest/e2e/conformance/tests/configmap-gzip.goβ€Ž

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -280,26 +280,15 @@ var ConfigmapGzip = suite.ConformanceTest{
280280
Description: "The Ingress in the higress-conformance-infra namespace uses the configmap gzip.",
281281
Manifests: []string{"tests/configmap-gzip.yaml"},
282282
Features: []suite.SupportedFeature{suite.HTTPConformanceFeature},
283-
Parallel: false,
284283
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
285-
t.Log("πŸš€ ConfigmapGzip: Test started")
286284
t.Run("Configmap Gzip", func(t *testing.T) {
287-
t.Log("πŸ“ ConfigmapGzip: Processing", len(testCases), "test cases")
288-
for i, testcase := range testCases {
289-
t.Logf("πŸ“ ConfigmapGzip: Processing test case %d/%d: %s", i+1, len(testCases), testcase.httpAssert.Meta.TestCaseName)
290-
285+
for _, testcase := range testCases {
291286
err := kubernetes.ApplyConfigmapDataWithYaml(t, suite.Client, "higress-system", "higress-config", "higress", testcase.higressConfig)
292287
if err != nil {
293-
t.Logf("❌ ConfigmapGzip: Failed to apply config for test case %d: %v", i+1, err)
294-
t.Logf("πŸ“ ConfigmapGzip: Failed to apply configmap %s in namespace %s for data key %s", "higress-config", "higress-system", "higress")
295-
t.FailNow()
288+
t.Fatalf("can't apply conifgmap %s in namespace %s for data key %s", "higress-config", "higress-system", "higress")
296289
}
297-
t.Logf("βœ… ConfigmapGzip: Config applied for test case %d", i+1)
298-
299290
http.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, suite.GatewayAddress, testcase.httpAssert)
300-
t.Logf("βœ… ConfigmapGzip: HTTP assertion passed for test case %d", i+1)
301291
}
302-
t.Log("πŸŽ‰ ConfigmapGzip: All test cases completed successfully")
303292
})
304293
},
305294
}
@@ -309,27 +298,16 @@ var ConfigMapGzipEnvoy = suite.ConformanceTest{
309298
Description: "The Envoy config should contain gzip config",
310299
Manifests: []string{"tests/configmap-gzip.yaml"},
311300
Features: []suite.SupportedFeature{suite.EnvoyConfigConformanceFeature},
312-
Parallel: false,
313301
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
314-
t.Log("πŸš€ ConfigMapGzipEnvoy: Test started")
315302
t.Run("ConfigMap Gzip Envoy", func(t *testing.T) {
316-
t.Log("πŸ“ ConfigMapGzipEnvoy: Processing", len(testCases), "test cases")
317-
for i, testcase := range testCases {
318-
t.Logf("πŸ“ ConfigMapGzipEnvoy: Processing test case %d/%d", i+1, len(testCases))
319-
303+
for _, testcase := range testCases {
320304
// apply config
321305
err := kubernetes.ApplyConfigmapDataWithYaml(t, suite.Client, "higress-system", "higress-config", "higress", testcase.higressConfig)
322306
if err != nil {
323-
t.Logf("❌ ConfigMapGzipEnvoy: Failed to apply config for test case %d: %v", i+1, err)
324-
t.Logf("πŸ“ ConfigMapGzipEnvoy: Failed to apply configmap %s in namespace %s for data key %s", "higress-config", "higress-system", "higress")
325-
t.FailNow()
307+
t.Fatalf("can't apply conifgmap %s in namespace %s for data key %s", "higress-config", "higress-system", "higress")
326308
}
327-
t.Logf("βœ… ConfigMapGzipEnvoy: Config applied for test case %d", i+1)
328-
329309
envoy.AssertEnvoyConfig(t, suite.TimeoutConfig, testcase.envoyAssertion)
330-
t.Logf("βœ… ConfigMapGzipEnvoy: Envoy assertion passed for test case %d", i+1)
331310
}
332-
t.Log("πŸŽ‰ ConfigMapGzipEnvoy: All test cases completed successfully")
333311
})
334312
},
335-
}
313+
}

0 commit comments

Comments
Β (0)