2024-04-18 15:13:16 +00:00
|
|
|
package config_tests
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/databricks/cli/bundle"
|
|
|
|
"github.com/databricks/cli/bundle/config/validate"
|
|
|
|
"github.com/databricks/cli/libs/diag"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestJobClusterKeyNotDefinedTest(t *testing.T) {
|
|
|
|
b := loadTarget(t, "./job_cluster_key", "default")
|
|
|
|
|
|
|
|
diags := bundle.ApplyReadOnly(context.Background(), bundle.ReadOnly(b), validate.JobClusterKeyDefined())
|
|
|
|
require.Len(t, diags, 1)
|
|
|
|
require.NoError(t, diags.Error())
|
2025-01-02 11:03:41 +00:00
|
|
|
require.Equal(t, diag.Warning, diags[0].Severity)
|
|
|
|
require.Equal(t, "job_cluster_key key is not defined", diags[0].Summary)
|
2024-04-18 15:13:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestJobClusterKeyDefinedTest(t *testing.T) {
|
|
|
|
b := loadTarget(t, "./job_cluster_key", "development")
|
|
|
|
|
|
|
|
diags := bundle.ApplyReadOnly(context.Background(), bundle.ReadOnly(b), validate.JobClusterKeyDefined())
|
2025-01-02 11:03:41 +00:00
|
|
|
require.Empty(t, diags)
|
2024-04-18 15:13:16 +00:00
|
|
|
}
|