2022-11-18 09:57:31 +00:00
|
|
|
package config_tests
|
|
|
|
|
|
|
|
import (
|
2023-04-12 14:17:13 +00:00
|
|
|
"path/filepath"
|
2022-11-18 09:57:31 +00:00
|
|
|
"sort"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"golang.org/x/exp/maps"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestIncludeDefault(t *testing.T) {
|
2022-11-28 09:59:43 +00:00
|
|
|
b := load(t, "./include_default")
|
2022-11-18 09:57:31 +00:00
|
|
|
|
2022-12-01 21:39:15 +00:00
|
|
|
// Test that both jobs were loaded.
|
|
|
|
keys := maps.Keys(b.Config.Resources.Jobs)
|
2022-11-18 09:57:31 +00:00
|
|
|
sort.Strings(keys)
|
2022-12-01 21:39:15 +00:00
|
|
|
assert.Equal(t, []string{"my_first_job", "my_second_job"}, keys)
|
2023-04-12 14:17:13 +00:00
|
|
|
|
|
|
|
first := b.Config.Resources.Jobs["my_first_job"]
|
|
|
|
assert.Equal(t, "1", first.ID)
|
|
|
|
assert.Equal(t, "include_default/my_first_job/resource.yml", filepath.ToSlash(first.ConfigFilePath))
|
|
|
|
|
|
|
|
second := b.Config.Resources.Jobs["my_second_job"]
|
|
|
|
assert.Equal(t, "2", second.ID)
|
|
|
|
assert.Equal(t, "include_default/my_second_job/resource.yml", filepath.ToSlash(second.ConfigFilePath))
|
2022-11-18 09:57:31 +00:00
|
|
|
}
|