mirror of https://github.com/databricks/cli.git
add test
This commit is contained in:
parent
e3e29ea78d
commit
0521385485
|
@ -88,3 +88,21 @@ func TestComplexVariablesOverrideWithMultipleFiles(t *testing.T) {
|
||||||
require.Equalf(t, "false", cluster.NewCluster.SparkConf["spark.speculation"], "cluster: %v", cluster.JobClusterKey)
|
require.Equalf(t, "false", cluster.NewCluster.SparkConf["spark.speculation"], "cluster: %v", cluster.JobClusterKey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestComplexVariablesOverrideWithFullSyntax(t *testing.T) {
|
||||||
|
b, diags := loadTargetWithDiags("variables/complex", "dev")
|
||||||
|
require.Empty(t, diags)
|
||||||
|
|
||||||
|
diags = bundle.Apply(context.Background(), b, bundle.Seq(
|
||||||
|
mutator.SetVariables(),
|
||||||
|
mutator.ResolveVariableReferencesInComplexVariables(),
|
||||||
|
mutator.ResolveVariableReferences(
|
||||||
|
"variables",
|
||||||
|
),
|
||||||
|
))
|
||||||
|
require.NoError(t, diags.Error())
|
||||||
|
require.Empty(t, diags)
|
||||||
|
|
||||||
|
complexvar := b.Config.Variables["complexvar"].Value
|
||||||
|
require.Equal(t, map[string]interface{}{"key1": "1", "key2": "2", "key3": "3"}, complexvar)
|
||||||
|
}
|
||||||
|
|
|
@ -35,6 +35,13 @@ variables:
|
||||||
- jar: "/path/to/jar"
|
- jar: "/path/to/jar"
|
||||||
- egg: "/path/to/egg"
|
- egg: "/path/to/egg"
|
||||||
- whl: "/path/to/whl"
|
- whl: "/path/to/whl"
|
||||||
|
complexvar:
|
||||||
|
type: complex
|
||||||
|
description: "A complex variable"
|
||||||
|
default:
|
||||||
|
key1: "value1"
|
||||||
|
key2: "value2"
|
||||||
|
key3: "value3"
|
||||||
|
|
||||||
|
|
||||||
targets:
|
targets:
|
||||||
|
@ -49,3 +56,9 @@ targets:
|
||||||
spark_conf:
|
spark_conf:
|
||||||
spark.speculation: false
|
spark.speculation: false
|
||||||
spark.databricks.delta.retentionDurationCheck.enabled: false
|
spark.databricks.delta.retentionDurationCheck.enabled: false
|
||||||
|
complexvar:
|
||||||
|
type: complex
|
||||||
|
default:
|
||||||
|
key1: "1"
|
||||||
|
key2: "2"
|
||||||
|
key3: "3"
|
||||||
|
|
Loading…
Reference in New Issue