Mohammed Naser | f5b77ee | 2023-11-29 23:10:43 -0500 | [diff] [blame] | 1 | package senlin |
| 2 | |
| 3 | import ( |
| 4 | _ "embed" |
| 5 | "os" |
| 6 | "testing" |
| 7 | |
| 8 | "github.com/goccy/go-yaml" |
| 9 | "github.com/stretchr/testify/assert" |
| 10 | "github.com/stretchr/testify/require" |
Mohammed Naser | c6e431b | 2024-03-15 01:21:44 -0400 | [diff] [blame] | 11 | |
| 12 | "github.com/vexxhost/atmosphere/internal/openstack_helm" |
| 13 | "github.com/vexxhost/atmosphere/internal/testutils" |
Mohammed Naser | f5b77ee | 2023-11-29 23:10:43 -0500 | [diff] [blame] | 14 | ) |
| 15 | |
| 16 | var ( |
| 17 | //go:embed vars/main.yml |
| 18 | varsFile []byte |
| 19 | vars Vars |
| 20 | ) |
| 21 | |
| 22 | type Vars struct { |
Mohammed Naser | c6e431b | 2024-03-15 01:21:44 -0400 | [diff] [blame] | 23 | openstack_helm.HelmValues `yaml:"_senlin_helm_values"` |
Mohammed Naser | f5b77ee | 2023-11-29 23:10:43 -0500 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | func TestMain(m *testing.M) { |
| 27 | t := &testing.T{} |
| 28 | err := yaml.UnmarshalWithOptions(varsFile, &vars) |
| 29 | require.NoError(t, err) |
| 30 | |
| 31 | code := m.Run() |
| 32 | os.Exit(code) |
| 33 | } |
| 34 | |
Mohammed Naser | c6e431b | 2024-03-15 01:21:44 -0400 | [diff] [blame] | 35 | func TestHelmValues(t *testing.T) { |
| 36 | vals, err := openstack_helm.CoalescedHelmValues("../../charts/senlin", &vars.HelmValues) |
| 37 | require.NoError(t, err) |
| 38 | |
| 39 | assert.Equal(t, int32(2), vals.Conf.Senlin.API.Workers) |
| 40 | |
| 41 | testutils.TestDatabaseConf(t, vals.Conf.Senlin.Database) |
Mohammed Naser | f5b77ee | 2023-11-29 23:10:43 -0500 | [diff] [blame] | 42 | } |