| 1 | package configscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/ |
| 2 | |
| 3 | import ( |
| 4 | "testingscip-go gomod github.com/golang/go/src go1.20 testing/" |
| 5 | |
| 6 | "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/assert`/" |
| 7 | "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.9.0 `github.com/stretchr/testify/require`/" |
| 8 | ) |
| 9 | |
| 10 | const ( |
| 11 | passwordscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/password. = "password" |
| 12 | secretscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/secret. = "secret" |
| 13 | ) |
| 14 | |
| 15 | func newTestConfigSecretscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfigSecret().() (*Configscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#, error) { |
| 16 | cfg := Newscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/New().(NewEmptyInMemoryStoragescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/NewEmptyInMemoryStorage().(), NewEmptyInMemorySecretStoragescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/NewEmptyInMemorySecretStorage().()) |
| 17 | |
| 18 | cfg.AddSettingscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#AddSetting().(passwordscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/password., Secretscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Secret#(""), validateStringscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/validateString()., SuccessfullyAppliedscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SuccessfullyApplied()., "") |
| 19 | cfg.AddSettingscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#AddSetting().(secretscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/secret., Secretscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Secret#("apples"), validateStringscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/validateString()., SuccessfullyAppliedscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SuccessfullyApplied()., "") |
| 20 | return cfg, nil |
| 21 | } |
| 22 | |
| 23 | func TestGetSecretscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/TestGetSecret().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) { |
| 24 | cfg, err := newTestConfigSecretscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfigSecret().() |
| 25 | 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) |
| 26 | |
| 27 | 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#{ |
| 28 | Valuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Value.: Secretscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Secret#("apples"), |
| 29 | IsDefaultscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#IsDefault.: true, |
| 30 | IsSecretscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#IsSecret.: true, |
| 31 | }, cfg.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(secretscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/secret.)) |
| 32 | } |
| 33 | |
| 34 | func TestSecretConfigUnknownscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/TestSecretConfigUnknown().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) { |
| 35 | cfg, err := newTestConfigSecretscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfigSecret().() |
| 36 | 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) |
| 37 | |
| 38 | 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#{ |
| 39 | Invalidscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Invalid.: true, |
| 40 | }, cfg.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().("baz")) |
| 41 | } |
| 42 | |
| 43 | func TestSecretConfigSetAndGetscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/TestSecretConfigSetAndGet().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) { |
| 44 | cfg, err := newTestConfigSecretscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfigSecret().() |
| 45 | 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) |
| 46 | |
| 47 | _, err = cfg.Setscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Set().(passwordscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/password., "pass123") |
| 48 | 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) |
| 49 | |
| 50 | 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#{ |
| 51 | Valuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Value.: Secretscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Secret#("pass123"), |
| 52 | IsDefaultscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#IsDefault.: false, |
| 53 | IsSecretscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#IsSecret.: true, |
| 54 | }, cfg.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(passwordscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/password.)) |
| 55 | } |
| 56 | |
| 57 | func TestSecretConfigUnsetAndGetscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/TestSecretConfigUnsetAndGet().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) { |
| 58 | cfg, err := newTestConfigSecretscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/newTestConfigSecret().() |
| 59 | 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) |
| 60 | |
| 61 | _, err = cfg.Unsetscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Unset().(secretscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/secret.) |
| 62 | 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) |
| 63 | |
| 64 | 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#{ |
| 65 | Valuescip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#Value.: Secretscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Secret#("apples"), |
| 66 | IsDefaultscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#IsDefault.: true, |
| 67 | IsSecretscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/SettingValue#IsSecret.: true, |
| 68 | }, cfg.Getscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/Config#Get().(secretscip-go gomod github.com/crc-org/crc/v2 . `github.com/crc-org/crc/v2/pkg/crc/config`/secret.)) |
| 69 | } |