Test that YAML anchors work (#96)

This commit is contained in:
Pieter Noordhuis 2022-11-21 15:40:27 +01:00 committed by GitHub
parent 3b351d3b00
commit ab1df558a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,13 @@
bundle:
name: yaml_anchors
resources:
jobs:
my_job:
_: &common_cluster
spark_version: "10.4.x-scala2.12"
tasks:
- task_key: "t1"
new_cluster: *common_cluster
- task_key: "t2"
new_cluster: *common_cluster

View File

@ -0,0 +1,24 @@
package config_tests
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestYAMLAnchors(t *testing.T) {
root := load(t, "./yaml_anchors")
assert.Len(t, root.Resources.Jobs, 1)
j := root.Resources.Jobs["my_job"]
require.Len(t, j.Tasks, 2)
t0 := j.Tasks[0]
t1 := j.Tasks[1]
require.NotNil(t, t0)
require.NotNil(t, t1)
assert.Equal(t, "10.4.x-scala2.12", t0.NewCluster.SparkVersion)
assert.Equal(t, "10.4.x-scala2.12", t1.NewCluster.SparkVersion)
}