mirror of https://github.com/databricks/cli.git
Update run_as tests for dashboards
This commit is contained in:
parent
5fb35e358f
commit
1b51c0cf0e
|
@ -110,6 +110,16 @@ func validateRunAs(b *bundle.Bundle) diag.Diagnostics {
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dashboards do not support run_as in the API.
|
||||||
|
if len(b.Config.Resources.Dashboards) > 0 {
|
||||||
|
diags = diags.Extend(reportRunAsNotSupported(
|
||||||
|
"dashboards",
|
||||||
|
b.Config.GetLocation("resources.dashboards"),
|
||||||
|
b.Config.Workspace.CurrentUser.UserName,
|
||||||
|
identity,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
return diags
|
return diags
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ func allResourceTypes(t *testing.T) []string {
|
||||||
// also update this check when adding a new resource
|
// also update this check when adding a new resource
|
||||||
require.Equal(t, []string{
|
require.Equal(t, []string{
|
||||||
"clusters",
|
"clusters",
|
||||||
|
"dashboards",
|
||||||
"experiments",
|
"experiments",
|
||||||
"jobs",
|
"jobs",
|
||||||
"model_serving_endpoints",
|
"model_serving_endpoints",
|
||||||
|
@ -188,6 +189,7 @@ func TestRunAsErrorForUnsupportedResources(t *testing.T) {
|
||||||
Config: *r,
|
Config: *r,
|
||||||
}
|
}
|
||||||
diags := bundle.Apply(context.Background(), b, SetRunAs())
|
diags := bundle.Apply(context.Background(), b, SetRunAs())
|
||||||
|
require.Error(t, diags.Error())
|
||||||
assert.Contains(t, diags.Error().Error(), "do not support a setting a run_as user that is different from the owner.\n"+
|
assert.Contains(t, diags.Error().Error(), "do not support a setting a run_as user that is different from the owner.\n"+
|
||||||
"Current identity: alice. Run as identity: bob.\n"+
|
"Current identity: alice. Run as identity: bob.\n"+
|
||||||
"See https://docs.databricks.com/dev-tools/bundles/run-as.html to learn more about the run_as property.", rt)
|
"See https://docs.databricks.com/dev-tools/bundles/run-as.html to learn more about the run_as property.", rt)
|
||||||
|
|
Loading…
Reference in New Issue