Skip to content

Commit

Permalink
replace deprecated ioutil.WriteFile calls in unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
bhamail committed Sep 7, 2022
1 parent 847ab73 commit c26d7b3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions internal/cmd/iq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"bytes"
"errors"
"fmt"
"io/ioutil"
"os"
"path"
"strings"
Expand Down Expand Up @@ -110,7 +109,7 @@ func TestInitIQConfig(t *testing.T) {
configuration.ViperKeyIQUsername, "iqUsernameValue",
configuration.ViperKeyIQToken, "iqTokenValue",
configuration.ViperKeyIQServer, "iqServerValue")
assert.Nil(t, ioutil.WriteFile(cfgFileIQ, []byte(credentials), 0644))
assert.Nil(t, os.WriteFile(cfgFileIQ, []byte(credentials), 0644))

// init order is not guaranteed
initIQConfig()
Expand Down Expand Up @@ -145,7 +144,7 @@ func TestInitIQConfigWithNoConfigFile(t *testing.T) {
configuration.ViperKeyIQUsername, "iqUsernameValue",
configuration.ViperKeyIQToken, "iqTokenValue",
configuration.ViperKeyIQServer, "iqServerValue")
assert.Nil(t, ioutil.WriteFile(cfgFileIQ, []byte(credentials), 0644))
assert.Nil(t, os.WriteFile(cfgFileIQ, []byte(credentials), 0644))

// delete the config files
assert.NoError(t, os.Remove(cfgFile))
Expand Down

0 comments on commit c26d7b3

Please sign in to comment.