1
1
package ffclient_test
2
2
3
3
import (
4
- "io/ioutil"
5
4
"log"
6
5
"os"
7
6
"testing"
@@ -174,8 +173,8 @@ func TestUpdateFlag(t *testing.T) {
174
173
false: false
175
174
default: false`
176
175
177
- flagFile , _ := ioutil . TempFile ("" , "" )
178
- _ = ioutil .WriteFile (flagFile .Name (), []byte (initialFileContent ), 0o600 )
176
+ flagFile , _ := os . CreateTemp ("" , "" )
177
+ _ = os .WriteFile (flagFile .Name (), []byte (initialFileContent ), 0o600 )
179
178
180
179
gffClient1 , _ := ffclient .New (ffclient.Config {
181
180
PollingInterval : 1 * time .Second ,
@@ -194,7 +193,7 @@ func TestUpdateFlag(t *testing.T) {
194
193
false: false
195
194
default: false`
196
195
197
- _ = ioutil .WriteFile (flagFile .Name (), []byte (updatedFileContent ), 0o600 )
196
+ _ = os .WriteFile (flagFile .Name (), []byte (updatedFileContent ), 0o600 )
198
197
199
198
flagValue , _ = gffClient1 .BoolVariation ("test-flag" , ffuser .NewUser ("random-key" ), false )
200
199
assert .True (t , flagValue )
@@ -213,8 +212,8 @@ func TestImpossibleToLoadfile(t *testing.T) {
213
212
false: false
214
213
default: false`
215
214
216
- flagFile , _ := ioutil . TempFile ("" , "impossible" )
217
- _ = ioutil .WriteFile (flagFile .Name (), []byte (initialFileContent ), 0o600 )
215
+ flagFile , _ := os . CreateTemp ("" , "impossible" )
216
+ _ = os .WriteFile (flagFile .Name (), []byte (initialFileContent ), 0o600 )
218
217
219
218
gffClient1 , _ := ffclient .New (ffclient.Config {
220
219
PollingInterval : 1 * time .Second ,
@@ -245,7 +244,7 @@ func TestFlagFileUnreachable(t *testing.T) {
245
244
false: "false"
246
245
default: "false"`
247
246
248
- tempDir , _ := ioutil . TempDir ("" , "" )
247
+ tempDir , _ := os . MkdirTemp ("" , "" )
249
248
defer os .Remove (tempDir )
250
249
251
250
flagFilePath := tempDir + "_FlagFileUnreachable.yaml"
@@ -262,7 +261,7 @@ func TestFlagFileUnreachable(t *testing.T) {
262
261
flagValue , _ := gff .StringVariation ("test-flag" , ffuser .NewUser ("random-key" ), "SDKdefault" )
263
262
assert .Equal (t , "SDKdefault" , flagValue , "should use the SDK default value" )
264
263
265
- _ = ioutil .WriteFile (flagFilePath , []byte (initialFileContent ), 0o600 )
264
+ _ = os .WriteFile (flagFilePath , []byte (initialFileContent ), 0o600 )
266
265
time .Sleep (2 * time .Second )
267
266
268
267
flagValue , _ = gff .StringVariation ("test-flag" , ffuser .NewUser ("random-key" ), "SDKdefault" )
0 commit comments