github.com/cilium/cilium@v1.16.2/pkg/cleanup/cleanup_test.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright Authors of Cilium 3 4 package cleanup 5 6 import ( 7 "sync" 8 "testing" 9 10 "github.com/stretchr/testify/require" 11 ) 12 13 func TestHandleCleanup(t *testing.T) { 14 wg := &sync.WaitGroup{} 15 ch := make(chan struct{}) 16 i := 0 17 DeferTerminationCleanupFunction(wg, ch, func() { 18 i++ 19 }) 20 close(ch) 21 wg.Wait() 22 require.Equal(t, 1, i) 23 }