| 1 | package configscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/ |
| 2 | |
| 3 | import ( |
| 4 | "osscip-go gomod github.com/golang/go/src go1.20 os/" |
| 5 | "path/filepathscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/" |
| 6 | "testingscip-go gomod github.com/golang/go/src go1.20 testing/" |
| 7 | |
| 8 | "github.com/crc-org/crc/v2/pkg/crc/presetscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/preset`/" |
| 9 | "github.com/spf13/pflagscip-go gomod github.com/spf13/pflag v1.0.5 `github.com/spf13/pflag`/" |
| 10 | "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/" |
| 11 | "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/" |
| 12 | ) |
| 13 | |
| 14 | const ( |
| 15 | cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus. = "cpus" |
| 16 | nameServerscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/nameServer. = "nameservers" |
| 17 | ) |
| 18 | |
| 19 | func newTestConfigscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfig().(configFile, envPrefix string) (*Configscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#, error) { |
| 20 | validCPUs := func(value interface{}) (bool, string) { |
| 21 | return validateCPUsscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/validateCPUs().(value, presetscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/preset`/.OpenShiftscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/preset`/OpenShift.) |
| 22 | } |
| 23 | storage, err := NewViperStoragescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/NewViperStorage().(configFile, envPrefix) |
| 24 | if err != nil { |
| 25 | return nil, err |
| 26 | } |
| 27 | |
| 28 | secretStorage := NewEmptyInMemorySecretStoragescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/NewEmptyInMemorySecretStorage().() |
| 29 | config := Newscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/New().(storage, secretStorage) |
| 30 | config.AddSettingscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#AddSetting().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus., 4, validCPUs, RequiresRestartMsgscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/RequiresRestartMsg()., "") |
| 31 | config.AddSettingscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#AddSetting().(nameServerscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/nameServer., "", validateIPAddressscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/validateIPAddress()., SuccessfullyAppliedscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SuccessfullyApplied()., "") |
| 32 | return config, nil |
| 33 | } |
| 34 | |
| 35 | func TestViperConfigUnknownscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/TestViperConfigUnknown().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) { |
| 36 | dir := t.TempDirscip-go gomod github.com/golang/go/src go1.20 testing/common#TempDir().() |
| 37 | configFile := filepathscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/Join().(dir, "crc.json") |
| 38 | |
| 39 | config, err := newTestConfigscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfig().(configFile, "CRC") |
| 40 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 41 | |
| 42 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, SettingValuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#{ |
| 43 | Invalidscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Invalid.: true, |
| 44 | }, config.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().("foo")) |
| 45 | } |
| 46 | |
| 47 | func TestViperConfigSetAndGetscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/TestViperConfigSetAndGet().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) { |
| 48 | dir := t.TempDirscip-go gomod github.com/golang/go/src go1.20 testing/common#TempDir().() |
| 49 | configFile := filepathscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/Join().(dir, "crc.json") |
| 50 | |
| 51 | config, err := newTestConfigscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfig().(configFile, "CRC") |
| 52 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 53 | |
| 54 | _, err = config.Setscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Set().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus., 5) |
| 55 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 56 | |
| 57 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, SettingValuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#{ |
| 58 | Valuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Value.: 5, |
| 59 | IsDefaultscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#IsDefault.: false, |
| 60 | }, config.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus.)) |
| 61 | |
| 62 | bin, err := osscip-go gomod github.com/golang/go/src go1.20 os/.ReadFilescip-go gomod github.com/golang/go/src go1.20 os/ReadFile().(configFile) |
| 63 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 64 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.JSONEqscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/JSONEq().(t, `{"cpus":5}`, string(bin)) |
| 65 | } |
| 66 | |
| 67 | func TestViperConfigUnsetAndGetscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/TestViperConfigUnsetAndGet().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) { |
| 68 | dir := t.TempDirscip-go gomod github.com/golang/go/src go1.20 testing/common#TempDir().() |
| 69 | configFile := filepathscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/Join().(dir, "crc.json") |
| 70 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/NoError().(t, osscip-go gomod github.com/golang/go/src go1.20 os/.WriteFilescip-go gomod github.com/golang/go/src go1.20 os/WriteFile().(configFile, []byte("{\"cpus\": 5}"), 0600)) |
| 71 | |
| 72 | config, err := newTestConfigscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfig().(configFile, "CRC") |
| 73 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 74 | |
| 75 | _, err = config.Unsetscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Unset().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus.) |
| 76 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 77 | |
| 78 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, SettingValuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#{ |
| 79 | Valuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Value.: 4, |
| 80 | IsDefaultscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#IsDefault.: true, |
| 81 | }, config.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus.)) |
| 82 | |
| 83 | bin, err := osscip-go gomod github.com/golang/go/src go1.20 os/.ReadFilescip-go gomod github.com/golang/go/src go1.20 os/ReadFile().(configFile) |
| 84 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 85 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, "{}", string(bin)) |
| 86 | } |
| 87 | |
| 88 | func TestViperConfigSetReloadAndGetscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/TestViperConfigSetReloadAndGet().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) { |
| 89 | dir := t.TempDirscip-go gomod github.com/golang/go/src go1.20 testing/common#TempDir().() |
| 90 | configFile := filepathscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/Join().(dir, "crc.json") |
| 91 | |
| 92 | config, err := newTestConfigscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfig().(configFile, "CRC") |
| 93 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 94 | |
| 95 | _, err = config.Setscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Set().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus., 5) |
| 96 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 97 | |
| 98 | config, err = newTestConfigscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfig().(configFile, "CRC") |
| 99 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 100 | |
| 101 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, SettingValuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#{ |
| 102 | Valuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Value.: 5, |
| 103 | IsDefaultscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#IsDefault.: false, |
| 104 | }, config.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus.)) |
| 105 | } |
| 106 | |
| 107 | func TestViperConfigLoadDefaultValuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/TestViperConfigLoadDefaultValue().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) { |
| 108 | dir := t.TempDirscip-go gomod github.com/golang/go/src go1.20 testing/common#TempDir().() |
| 109 | configFile := filepathscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/Join().(dir, "crc.json") |
| 110 | |
| 111 | config, err := newTestConfigscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfig().(configFile, "CRC") |
| 112 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 113 | |
| 114 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, SettingValuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#{ |
| 115 | Valuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Value.: 4, |
| 116 | IsDefaultscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#IsDefault.: true, |
| 117 | }, config.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus.)) |
| 118 | _, err = config.Setscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Set().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus., 4) |
| 119 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 120 | |
| 121 | bin, err := osscip-go gomod github.com/golang/go/src go1.20 os/.ReadFilescip-go gomod github.com/golang/go/src go1.20 os/ReadFile().(configFile) |
| 122 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 123 | // Setting default value will not update |
| 124 | // write to the config so expected would be {} |
| 125 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.JSONEqscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/JSONEq().(t, `{}`, string(bin)) |
| 126 | |
| 127 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, SettingValuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#{ |
| 128 | Valuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Value.: 4, |
| 129 | IsDefaultscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#IsDefault.: true, |
| 130 | }, config.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus.)) |
| 131 | |
| 132 | config, err = newTestConfigscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfig().(configFile, "CRC") |
| 133 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 134 | |
| 135 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, SettingValuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#{ |
| 136 | Valuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Value.: 4, |
| 137 | IsDefaultscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#IsDefault.: true, |
| 138 | }, config.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus.)) |
| 139 | } |
| 140 | |
| 141 | func TestViperConfigBindFlagSetscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/TestViperConfigBindFlagSet().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) { |
| 142 | dir := t.TempDirscip-go gomod github.com/golang/go/src go1.20 testing/common#TempDir().() |
| 143 | configFile := filepathscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/Join().(dir, "crc.json") |
| 144 | |
| 145 | validCPUs := func(value interface{}) (bool, string) { |
| 146 | return validateCPUsscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/validateCPUs().(value, presetscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/preset`/.OpenShiftscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/preset`/OpenShift.) |
| 147 | } |
| 148 | storage, err := NewViperStoragescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/NewViperStorage().(configFile, "CRC") |
| 149 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 150 | config := Newscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/New().(storage, NewEmptyInMemorySecretStoragescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/NewEmptyInMemorySecretStorage().()) |
| 151 | config.AddSettingscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#AddSetting().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus., 4, validCPUs, RequiresRestartMsgscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/RequiresRestartMsg()., "") |
| 152 | config.AddSettingscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#AddSetting().(nameServerscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/nameServer., "", validateIPAddressscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/validateIPAddress()., SuccessfullyAppliedscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SuccessfullyApplied()., "") |
| 153 | |
| 154 | flagSet := pflagscip-go gomod github.com/spf13/pflag v1.0.5 `github.com/spf13/pflag`/.NewFlagSetscip-go gomod github.com/spf13/pflag v1.0.5 `github.com/spf13/pflag`/NewFlagSet().("start", pflagscip-go gomod github.com/spf13/pflag v1.0.5 `github.com/spf13/pflag`/.ExitOnErrorscip-go gomod github.com/spf13/pflag v1.0.5 `github.com/spf13/pflag`/ExitOnError.) |
| 155 | flagSet.IntPscip-go gomod github.com/spf13/pflag v1.0.5 `github.com/spf13/pflag`/FlagSet#IntP().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus., "c", 4, "") |
| 156 | flagSet.StringPscip-go gomod github.com/spf13/pflag v1.0.5 `github.com/spf13/pflag`/FlagSet#StringP().(nameServerscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/nameServer., "n", "", "") |
| 157 | flagSet.StringPscip-go gomod github.com/spf13/pflag v1.0.5 `github.com/spf13/pflag`/FlagSet#StringP().("extra", "e", "", "") |
| 158 | |
| 159 | _ = storage.BindFlagSetscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/ViperStorage#BindFlagSet().(flagSet) |
| 160 | |
| 161 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, SettingValuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#{ |
| 162 | Valuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Value.: 4, |
| 163 | IsDefaultscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#IsDefault.: true, |
| 164 | }, config.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus.)) |
| 165 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, SettingValuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#{ |
| 166 | Valuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Value.: "", |
| 167 | IsDefaultscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#IsDefault.: true, |
| 168 | }, config.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(nameServerscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/nameServer.)) |
| 169 | |
| 170 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/NoError().(t, flagSet.Setscip-go gomod github.com/spf13/pflag v1.0.5 `github.com/spf13/pflag`/FlagSet#Set().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus., "5")) |
| 171 | |
| 172 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, SettingValuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#{ |
| 173 | Valuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Value.: 5, |
| 174 | IsDefaultscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#IsDefault.: false, |
| 175 | }, config.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus.)) |
| 176 | |
| 177 | _, err = config.Setscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Set().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus., "6") |
| 178 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 179 | |
| 180 | bin, err := osscip-go gomod github.com/golang/go/src go1.20 os/.ReadFilescip-go gomod github.com/golang/go/src go1.20 os/ReadFile().(configFile) |
| 181 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 182 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.JSONEqscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/JSONEq().(t, `{"cpus":6}`, string(bin)) |
| 183 | } |
| 184 | |
| 185 | func TestViperConfigCastSetscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/TestViperConfigCastSet().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) { |
| 186 | dir := t.TempDirscip-go gomod github.com/golang/go/src go1.20 testing/common#TempDir().() |
| 187 | configFile := filepathscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/Join().(dir, "crc.json") |
| 188 | |
| 189 | config, err := newTestConfigscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfig().(configFile, "CRC") |
| 190 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 191 | |
| 192 | _, err = config.Setscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Set().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus., "5") |
| 193 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 194 | |
| 195 | config, err = newTestConfigscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfig().(configFile, "CRC") |
| 196 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 197 | |
| 198 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, SettingValuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#{ |
| 199 | Valuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Value.: 5, |
| 200 | IsDefaultscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#IsDefault.: false, |
| 201 | }, config.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus.)) |
| 202 | |
| 203 | bin, err := osscip-go gomod github.com/golang/go/src go1.20 os/.ReadFilescip-go gomod github.com/golang/go/src go1.20 os/ReadFile().(configFile) |
| 204 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 205 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.JSONEqscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/JSONEq().(t, `{"cpus": 5}`, string(bin)) |
| 206 | } |
| 207 | |
| 208 | func TestCannotSetWithWrongTypescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/TestCannotSetWithWrongType().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) { |
| 209 | dir := t.TempDirscip-go gomod github.com/golang/go/src go1.20 testing/common#TempDir().() |
| 210 | configFile := filepathscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/Join().(dir, "crc.json") |
| 211 | |
| 212 | config, err := newTestConfigscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfig().(configFile, "CRC") |
| 213 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 214 | |
| 215 | _, err = config.Setscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Set().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus., "helloworld") |
| 216 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.EqualErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/EqualError().(t, err, "Value 'helloworld' for configuration property 'cpus' is invalid, reason: requires integer value >= 4") |
| 217 | } |
| 218 | |
| 219 | func TestCannotGetWithWrongTypescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/TestCannotGetWithWrongType().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) { |
| 220 | dir := t.TempDirscip-go gomod github.com/golang/go/src go1.20 testing/common#TempDir().() |
| 221 | configFile := filepathscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/Join().(dir, "crc.json") |
| 222 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/NoError().(t, osscip-go gomod github.com/golang/go/src go1.20 os/.WriteFilescip-go gomod github.com/golang/go/src go1.20 os/WriteFile().(configFile, []byte("{\"cpus\": \"hello\"}"), 0600)) |
| 223 | |
| 224 | config, err := newTestConfigscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfig().(configFile, "CRC") |
| 225 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 226 | |
| 227 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/True().(t, config.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus.).Invalidscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Invalid.) |
| 228 | } |
| 229 | |
| 230 | func TestTwoInstancesSharingSameConfigurationscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/TestTwoInstancesSharingSameConfiguration().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) { |
| 231 | dir := t.TempDirscip-go gomod github.com/golang/go/src go1.20 testing/common#TempDir().() |
| 232 | configFile := filepathscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/Join().(dir, "crc.json") |
| 233 | |
| 234 | config1, err := newTestConfigscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfig().(configFile, "CRC") |
| 235 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 236 | |
| 237 | config2, err := newTestConfigscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfig().(configFile, "CRC") |
| 238 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 239 | |
| 240 | _, err = config1.Setscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Set().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus., 5) |
| 241 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 242 | |
| 243 | bin, err := osscip-go gomod github.com/golang/go/src go1.20 os/.ReadFilescip-go gomod github.com/golang/go/src go1.20 os/ReadFile().(configFile) |
| 244 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 245 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.JSONEqscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/JSONEq().(t, `{"cpus":5}`, string(bin)) |
| 246 | |
| 247 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, SettingValuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#{ |
| 248 | Valuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Value.: 5, |
| 249 | IsDefaultscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#IsDefault.: false, |
| 250 | }, config2.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus.)) |
| 251 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, SettingValuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#{ |
| 252 | Valuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Value.: 5, |
| 253 | IsDefaultscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#IsDefault.: false, |
| 254 | }, config1.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus.)) |
| 255 | } |
| 256 | |
| 257 | func TestTwoInstancesWriteSameConfigurationscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/TestTwoInstancesWriteSameConfiguration().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) { |
| 258 | dir := t.TempDirscip-go gomod github.com/golang/go/src go1.20 testing/common#TempDir().() |
| 259 | configFile := filepathscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/Join().(dir, "crc.json") |
| 260 | |
| 261 | config1, err := newTestConfigscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfig().(configFile, "CRC") |
| 262 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 263 | |
| 264 | config2, err := newTestConfigscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfig().(configFile, "CRC") |
| 265 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 266 | |
| 267 | _, err = config1.Setscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Set().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus., 5) |
| 268 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 269 | |
| 270 | _, err = config2.Setscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Set().(nameServerscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/nameServer., "1.1.1.1") |
| 271 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 272 | |
| 273 | bin, err := osscip-go gomod github.com/golang/go/src go1.20 os/.ReadFilescip-go gomod github.com/golang/go/src go1.20 os/ReadFile().(configFile) |
| 274 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 275 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.JSONEqscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/JSONEq().(t, `{"cpus":5, "nameservers":"1.1.1.1"}`, string(bin)) |
| 276 | |
| 277 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, 5, config2.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus.).Valuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Value.) |
| 278 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, 5, config1.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus.).Valuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Value.) |
| 279 | |
| 280 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, "1.1.1.1", config2.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(nameServerscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/nameServer.).Valuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Value.) |
| 281 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, "1.1.1.1", config1.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(nameServerscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/nameServer.).Valuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Value.) |
| 282 | } |
| 283 | |
| 284 | func TestTwoInstancesSetAndUnsetSameConfigurationscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/TestTwoInstancesSetAndUnsetSameConfiguration().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) { |
| 285 | dir := t.TempDirscip-go gomod github.com/golang/go/src go1.20 testing/common#TempDir().() |
| 286 | configFile := filepathscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/Join().(dir, "crc.json") |
| 287 | |
| 288 | config1, err := newTestConfigscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfig().(configFile, "CRC") |
| 289 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 290 | |
| 291 | config2, err := newTestConfigscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfig().(configFile, "CRC") |
| 292 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 293 | |
| 294 | _, err = config1.Setscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Set().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus., 5) |
| 295 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 296 | |
| 297 | _, err = config2.Unsetscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Unset().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus.) |
| 298 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 299 | |
| 300 | bin, err := osscip-go gomod github.com/golang/go/src go1.20 os/.ReadFilescip-go gomod github.com/golang/go/src go1.20 os/ReadFile().(configFile) |
| 301 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 302 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.JSONEqscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/JSONEq().(t, `{}`, string(bin)) |
| 303 | |
| 304 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, 4, config2.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus.).Valuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Value.) |
| 305 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, 4, config1.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus.).Valuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Value.) |
| 306 | } |
| 307 | |
| 308 | func TestNotifierscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/TestNotifier().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) { |
| 309 | dir := t.TempDirscip-go gomod github.com/golang/go/src go1.20 testing/common#TempDir().() |
| 310 | configFile := filepathscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/Join().(dir, "crc.json") |
| 311 | |
| 312 | config, err := newTestConfigscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfig().(configFile, "CRC") |
| 313 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 314 | |
| 315 | var notified = false |
| 316 | err = config.RegisterNotifierscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#RegisterNotifier().(CPUsscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/CPUs., func(config *Configscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#, key string, value interface{}) { |
| 317 | notified = true |
| 318 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/Equal().(t, key, CPUsscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/CPUs.) |
| 319 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/Equal().(t, SettingValuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#{ |
| 320 | Valuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Value.: value, |
| 321 | IsDefaultscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#IsDefault.: false, |
| 322 | }, config.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus.)) |
| 323 | |
| 324 | }) |
| 325 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 326 | _, err = config.Setscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Set().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus., 5) |
| 327 | assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 328 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/True().(t, notified) |
| 329 | } |
| 330 | |
| 331 | func TestCallbacksscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/TestCallbacks().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) { |
| 332 | dir := t.TempDirscip-go gomod github.com/golang/go/src go1.20 testing/common#TempDir().() |
| 333 | configFile := filepathscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.20 `path/filepath`/Join().(dir, "crc.json") |
| 334 | |
| 335 | config, err := newTestConfigscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfig().(configFile, "CRC") |
| 336 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 337 | |
| 338 | callback, err := config.Setscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Set().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus., 5) |
| 339 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 340 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NotEmptyscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NotEmpty().(t, callback) |
| 341 | |
| 342 | callback, err = config.Unsetscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Unset().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus.) |
| 343 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 344 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NotEmptyscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NotEmpty().(t, callback) |
| 345 | |
| 346 | callback, err = config.Setscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Set().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus., 4) |
| 347 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 348 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NotEmptyscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NotEmpty().(t, callback) |
| 349 | |
| 350 | callback, err = config.Unsetscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Unset().(cpusscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/cpus.) |
| 351 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 352 | requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/.NotEmptyscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/NotEmpty().(t, callback) |
| 353 | } |