Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
codebien committed Jan 31, 2025
1 parent 23fde82 commit 7e205bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions internal/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,17 @@ func readEnvConfig(envMap map[string]string) (Config, error) {
// TODO: accumulate all errors and differentiate between the layers?
func getConsolidatedConfig(gs *state.GlobalState, cliConf Config, runnerOpts lib.Options) (conf Config, err error) {
fileConf, err := readLegacyDiskConfig(gs)
if errors.Is(err, fs.ErrNotExist) {
if errors.Is(err, fs.ErrNotExist) { //nolint:gocritic
fileConf, err = readDiskConfig(gs)
if err != nil {
return conf, errext.WithExitCodeIfNone(err, exitcodes.InvalidConfig)
}
} else if err != nil {
return conf, errext.WithExitCodeIfNone(err, exitcodes.InvalidConfig)
} else {
gs.Logger.Warn("The configuration file has been found on the old path. Please, run again `k6 cloud login` or `k6 login` commands to migrate to the new path. If you already migrated it manually, then remove the file from the old path.\n\n")
gs.Logger.Warn("The configuration file has been found on the old path. " +
"Please, run again `k6 cloud login` or `k6 login` commands to migrate to the new path. " +
"If you already migrated it manually, then remove the file from the old path.\n\n")
}

envConf, err := readEnvConfig(gs.Env)
Expand Down
4 changes: 3 additions & 1 deletion internal/cmd/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,11 +409,12 @@ func TestWriteDiskConfigNoJSONContentError(t *testing.T) {
}

func TestMigrateLegacyConfigFileIfAny(t *testing.T) {
t.Parallel()
memfs := fsext.NewMemMapFs()

conf := []byte(`{"iterations":1028,"cloud":{"field1":"testvalue"}}`)
legacyConfigPath := ".config/loadimpact/k6/config.json"
fsext.WriteFile(memfs, legacyConfigPath, conf, 0o644)
require.NoError(t, fsext.WriteFile(memfs, legacyConfigPath, conf, 0o644))

logger := logrus.New()
logger.SetOutput(io.Discard)
Expand All @@ -439,6 +440,7 @@ func TestMigrateLegacyConfigFileIfAny(t *testing.T) {
}

func TestMigrateLegacyConfigFileIfAnyWhenFileDoesNotExist(t *testing.T) {
t.Parallel()
memfs := fsext.NewMemMapFs()

defaultFlags := state.GetDefaultFlags(".config")
Expand Down

0 comments on commit 7e205bb

Please sign in to comment.