github.com/cilium/cilium@v1.16.2/pkg/testutils/file.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright Authors of Cilium 3 4 package testutils 5 6 import ( 7 "errors" 8 "os" 9 "testing" 10 ) 11 12 func SkipIfFileMissing(t testing.TB, file string) { 13 _, err := os.Open(file) 14 if errors.Is(err, os.ErrNotExist) { 15 t.Skipf("Skipping due to missing file %s", file) 16 } 17 if err != nil { 18 t.Fatal(err) 19 } 20 }