2022-11-21 14:40:27 +00:00
|
|
|
package config_tests
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestYAMLAnchors(t *testing.T) {
|
2022-11-28 09:59:43 +00:00
|
|
|
b := load(t, "./yaml_anchors")
|
2022-12-01 21:39:15 +00:00
|
|
|
assert.Len(t, b.Config.Resources.Jobs, 1)
|
2022-11-21 14:40:27 +00:00
|
|
|
|
2022-12-01 21:39:15 +00:00
|
|
|
j := b.Config.Resources.Jobs["my_job"]
|
2022-11-21 14:40:27 +00:00
|
|
|
require.Len(t, j.Tasks, 2)
|
|
|
|
|
|
|
|
t0 := j.Tasks[0]
|
|
|
|
t1 := j.Tasks[1]
|
|
|
|
require.NotNil(t, t0)
|
|
|
|
require.NotNil(t, t1)
|
|
|
|
|
2024-04-10 09:55:02 +00:00
|
|
|
require.NotNil(t, t0.NewCluster)
|
|
|
|
require.NotNil(t, t1.NewCluster)
|
2022-11-21 14:40:27 +00:00
|
|
|
assert.Equal(t, "10.4.x-scala2.12", t0.NewCluster.SparkVersion)
|
|
|
|
assert.Equal(t, "10.4.x-scala2.12", t1.NewCluster.SparkVersion)
|
|
|
|
}
|
2024-04-10 09:55:02 +00:00
|
|
|
|
|
|
|
func TestYAMLAnchorsNoWarnings(t *testing.T) {
|
|
|
|
_, diags := loadTargetWithDiags("./yaml_anchors", "default")
|
|
|
|
assert.Empty(t, diags)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestYAMLAnchorsSeparateBlockNoWarnings(t *testing.T) {
|
|
|
|
_, diags := loadTargetWithDiags("./yaml_anchors_separate_block", "default")
|
|
|
|
assert.Empty(t, diags)
|
|
|
|
}
|