@@ -14,7 +14,6 @@ limitations under the License.
14
14
package driver
15
15
16
16
import (
17
- "io/ioutil"
18
17
"os"
19
18
"path/filepath"
20
19
"strings"
@@ -151,7 +150,7 @@ func TestExecWatchdog(t *testing.T) {
151
150
}
152
151
153
152
func createTempDir (t * testing.T ) string {
154
- name , err := ioutil . TempDir ("" , "" )
153
+ name , err := os . MkdirTemp ("" , "" )
155
154
checkError (t , err )
156
155
return name
157
156
}
@@ -259,7 +258,7 @@ func TestSetupWithAdditionalDirectoryInStaticFilesDirectory(t *testing.T) {
259
258
staticFileDirName := createTempDir (t )
260
259
defer os .RemoveAll (staticFileDirName )
261
260
262
- _ , err := ioutil . TempDir (staticFileDirName , "" )
261
+ _ , err := os . MkdirTemp (staticFileDirName , "" )
263
262
checkError (t , err )
264
263
265
264
w := newExecWatchdog (configDirName , staticFileDirName , "sleep" , "300" ).(* execWatchdog )
@@ -270,7 +269,7 @@ func TestSetupWithAdditionalDirectoryInStaticFilesDirectory(t *testing.T) {
270
269
}
271
270
272
271
func TestRemoveLibwrapOption (t * testing.T ) {
273
- tempDir , err := ioutil . TempDir ("" , "test-stunnel-configs" )
272
+ tempDir , err := os . MkdirTemp ("" , "test-stunnel-configs" )
274
273
if err != nil {
275
274
t .Fatalf ("Failed to create temp dir: %v" , err )
276
275
}
@@ -285,7 +284,7 @@ connect = fs-123.efs.us-west-2.amazonaws.com:2049
285
284
libwrap = no
286
285
` )
287
286
testFilePath := filepath .Join (tempDir , "stunnel-config.test" )
288
- if err := ioutil .WriteFile (testFilePath , testConfig , 0644 ); err != nil {
287
+ if err := os .WriteFile (testFilePath , testConfig , 0644 ); err != nil {
289
288
t .Fatalf ("Failed to write test config: %v" , err )
290
289
}
291
290
@@ -295,7 +294,7 @@ libwrap = no
295
294
t .Fatalf ("removeLibwrapOption failed: %v" , err )
296
295
}
297
296
298
- content , err := ioutil .ReadFile (testFilePath )
297
+ content , err := os .ReadFile (testFilePath )
299
298
if err != nil {
300
299
t .Fatalf ("Failed to read updated config: %v" , err )
301
300
}
@@ -306,7 +305,7 @@ libwrap = no
306
305
}
307
306
308
307
func verifyFileContent (t * testing.T , fileName string , expectedFileContent string ) {
309
- fileContent , err := ioutil .ReadFile (fileName )
308
+ fileContent , err := os .ReadFile (fileName )
310
309
if err != nil {
311
310
t .Fatalf ("Failed to read file %v, %v" , fileName , err )
312
311
}
@@ -317,7 +316,7 @@ func verifyFileContent(t *testing.T, fileName string, expectedFileContent string
317
316
}
318
317
319
318
func verifyConfigFile (t * testing.T , configFilePath string ) {
320
- configFileContent , err := ioutil .ReadFile (configFilePath )
319
+ configFileContent , err := os .ReadFile (configFilePath )
321
320
checkError (t , err )
322
321
actualConfig := string (configFileContent )
323
322
if actualConfig != expectedEfsUtilsConfig {
0 commit comments