blob: d8726279daf970e03aaa930bc483ea7ab5af96a3 [file] [log] [blame]
Mohammed Naserf5b77ee2023-11-29 23:10:43 -05001package senlin
2
3import (
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"
11)
12
13var (
14 //go:embed vars/main.yml
15 varsFile []byte
16 vars Vars
17)
18
19type Vars struct {
20 SenlinHelmValues `yaml:"_senlin_helm_values"`
21}
22
23type SenlinHelmValues struct {
24 Conf `yaml:"conf"`
25}
26
27type Conf struct {
28 Senlin SenlinConf `yaml:"senlin"`
29}
30
31type SenlinConf struct {
32 API SenlinAPIConf `yaml:"senlin_api"`
33}
34
35type SenlinAPIConf struct {
36 Workers int32 `yaml:"workers"`
37}
38
39func TestMain(m *testing.M) {
40 t := &testing.T{}
41 err := yaml.UnmarshalWithOptions(varsFile, &vars)
42 require.NoError(t, err)
43
44 code := m.Run()
45 os.Exit(code)
46}
47
48func TestSenlinHelmValues(t *testing.T) {
49 assert.Equal(t, int32(2), vars.SenlinHelmValues.Conf.Senlin.API.Workers)
50}