@@ -33,8 +33,6 @@ import (
33
33
"path/filepath"
34
34
"sort"
35
35
"strings"
36
-
37
- "k8s.io/kubernetes/test/e2e/framework"
38
36
)
39
37
40
38
var filesources []FileSource
@@ -66,18 +64,6 @@ type FileSource interface {
66
64
DescribeFiles () string
67
65
}
68
66
69
- // ReadOrDie tries to retrieve the desired file content from
70
- // one of the registered file sources. In contrast to FileSource, it
71
- // will either return a valid slice or abort the test by calling the fatal function,
72
- // i.e. the caller doesn't have to implement error checking.
73
- func ReadOrDie (filePath string ) []byte {
74
- data , err := Read (filePath )
75
- if err != nil {
76
- framework .Fail (err .Error (), 1 )
77
- }
78
- return data
79
- }
80
-
81
67
// Read tries to retrieve the desired file content from
82
68
// one of the registered file sources.
83
69
func Read (filePath string ) ([]byte , error ) {
@@ -106,17 +92,17 @@ func Read(filePath string) ([]byte, error) {
106
92
// Exists checks whether a file could be read. Unexpected errors
107
93
// are handled by calling the fail function, which then should
108
94
// abort the current test.
109
- func Exists (filePath string ) bool {
95
+ func Exists (filePath string ) ( bool , error ) {
110
96
for _ , filesource := range filesources {
111
97
data , err := filesource .ReadTestFile (filePath )
112
98
if err != nil {
113
- framework . Fail ( fmt . Sprintf ( "fatal error looking for test file %s: %s" , filePath , err ), 1 )
99
+ return false , err
114
100
}
115
101
if data != nil {
116
- return true
102
+ return true , nil
117
103
}
118
104
}
119
- return false
105
+ return false , nil
120
106
}
121
107
122
108
// RootFileSource looks for files relative to a root directory.
0 commit comments