@@ -1138,23 +1138,28 @@ func testIsDenyListed(testname string) (bool, error) {
1138
1138
}
1139
1139
1140
1140
// registerTestDir parses one test directory and registers it as a test
1141
- func registerTestDir (dir , testprefix string , children []os.FileInfo ) error {
1141
+ func registerTestDir (dir , testprefix string , children []os.DirEntry ) error {
1142
1142
var dependencydir string
1143
1143
var meta externalTestMeta
1144
- var err error
1145
1144
userdata := conf .EmptyIgnition ()
1146
1145
executables := []string {}
1147
1146
for _ , c := range children {
1148
1147
fpath := filepath .Join (dir , c .Name ())
1148
+
1149
+ info , err := c .Info ()
1150
+ if err != nil {
1151
+ return errors .Wrapf (err , "c.Info %s" , c .Name ())
1152
+ }
1153
+
1149
1154
// follow symlinks; oddly, there's no IsSymlink()
1150
- if c .Mode ()& os .ModeSymlink != 0 {
1151
- c , err = os .Stat (fpath )
1155
+ if info .Mode ()& os .ModeSymlink != 0 {
1156
+ info , err = os .Stat (fpath )
1152
1157
if err != nil {
1153
1158
return errors .Wrapf (err , "stat %s" , fpath )
1154
1159
}
1155
1160
}
1156
- isreg := c .Mode ().IsRegular ()
1157
- if isreg && (c .Mode ().Perm ()& 0001 ) > 0 {
1161
+ isreg := info .Mode ().IsRegular ()
1162
+ if isreg && (info .Mode ().Perm ()& 0001 ) > 0 {
1158
1163
executables = append (executables , filepath .Join (dir , c .Name ()))
1159
1164
} else if isreg && c .Name () == "config.ign" {
1160
1165
v , err := ioutil .ReadFile (filepath .Join (dir , c .Name ()))
@@ -1183,23 +1188,23 @@ func registerTestDir(dir, testprefix string, children []os.FileInfo) error {
1183
1188
}
1184
1189
} else if c .IsDir () && c .Name () == kolaExtBinDataName {
1185
1190
dependencydir = filepath .Join (dir , c .Name ())
1186
- } else if c .Mode ()& os .ModeSymlink != 0 && c .Name () == kolaExtBinDataName {
1191
+ } else if info .Mode ()& os .ModeSymlink != 0 && c .Name () == kolaExtBinDataName {
1187
1192
target , err := filepath .EvalSymlinks (filepath .Join (dir , c .Name ()))
1188
1193
if err != nil {
1189
1194
return err
1190
1195
}
1191
1196
dependencydir = target
1192
1197
} else if c .IsDir () {
1193
1198
subdir := filepath .Join (dir , c .Name ())
1194
- subchildren , err := ioutil .ReadDir (subdir )
1199
+ subchildren , err := os .ReadDir (subdir )
1195
1200
if err != nil {
1196
1201
return err
1197
1202
}
1198
1203
subprefix := fmt .Sprintf ("%s.%s" , testprefix , c .Name ())
1199
1204
if err := registerTestDir (subdir , subprefix , subchildren ); err != nil {
1200
1205
return err
1201
1206
}
1202
- } else if isreg && (c .Mode ().Perm ()& 0001 ) == 0 {
1207
+ } else if isreg && (info .Mode ().Perm ()& 0001 ) == 0 {
1203
1208
file , err := os .Open (filepath .Join (dir , c .Name ()))
1204
1209
if err != nil {
1205
1210
return errors .Wrapf (err , "opening %s" , c .Name ())
@@ -1238,7 +1243,7 @@ func registerTestDir(dir, testprefix string, children []os.FileInfo) error {
1238
1243
1239
1244
func RegisterExternalTestsWithPrefix (dir , prefix string ) error {
1240
1245
testsdir := filepath .Join (dir , "tests/kola" )
1241
- children , err := ioutil .ReadDir (testsdir )
1246
+ children , err := os .ReadDir (testsdir )
1242
1247
if err != nil {
1243
1248
if os .IsNotExist (err ) {
1244
1249
// The directory doesn't exist.. Skip registering tests
0 commit comments