File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package fluentd
33import (
44 "context"
55 "fmt"
6+ "strings"
67 "sync"
78 "time"
89
@@ -175,6 +176,16 @@ func testFluentdLabelSelector(
175176 err := CreateObjs (ctx , objects )
176177 Expect (err ).NotTo (HaveOccurred ())
177178
179+ // Ensure cleanup runs even if the test fails
180+ DeferCleanup (func () {
181+ // Clean up all objects
182+ err := DeleteObjs (ctx , objects )
183+ if err != nil {
184+ // Log the error but don't fail the cleanup
185+ fmt .Printf ("Warning: failed to cleanup objects: %v\n " , err )
186+ }
187+ })
188+
178189 // Wait for reconciliation
179190 time .Sleep (time .Second * 3 )
180191
@@ -187,11 +198,7 @@ func testFluentdLabelSelector(
187198 Expect (err ).NotTo (HaveOccurred ())
188199
189200 // Verify that the configuration matches expected
190- Expect (string (expectedConfig )).To (Equal (config ))
191-
192- // Clean up
193- err = DeleteObjs (ctx , objects )
194- Expect (err ).NotTo (HaveOccurred ())
201+ Expect (strings .TrimRight (string (expectedConfig ), "\r \n " )).To (Equal (config ))
195202}
196203
197204// This test verifies the fix for the bug where filterSelector and outputSelector
You can’t perform that action at this time.
0 commit comments