Compare commits

..

No commits in common. "434aa17bde830cbe61962c06a66d88cef9008390" and "d3032c493c4476448cfbdad52ca5421075413db2" have entirely different histories.

2 changed files with 7 additions and 13 deletions

View File

@ -83,15 +83,11 @@ func validateJobTask(rb bundle.ReadOnlyBundle, task jobs.Task, taskPath dyn.Path
// notebook tasks without cluster spec will use notebook environment // notebook tasks without cluster spec will use notebook environment
} else { } else {
// path might be not very helpful, adding user-specified task key clarifies the context // path might be not very helpful, adding user-specified task key clarifies the context
detail := fmt.Sprintf( detail := fmt.Sprintf("Task %q has a task type that requires a cluster or environment, but neither is specified", task.TaskKey)
"Task %q requires a cluster or an environment to run.\nSpecify one of the following fields: %s.",
task.TaskKey,
strings.Join(unspecified, ", "),
)
diags = diags.Append(diag.Diagnostic{ diags = diags.Append(diag.Diagnostic{
Severity: diag.Error, Severity: diag.Error,
Summary: "Missing required cluster or environment settings", Summary: fmt.Sprintf("One of the following fields must be set: %s", strings.Join(unspecified, ", ")),
Detail: detail, Detail: detail,
Locations: rb.Config().GetLocations(taskPath.String()), Locations: rb.Config().GetLocations(taskPath.String()),
Paths: []dyn.Path{taskPath}, Paths: []dyn.Path{taskPath},

View File

@ -13,7 +13,7 @@ import (
) )
func TestJobTaskClusterSpec(t *testing.T) { func TestJobTaskClusterSpec(t *testing.T) {
expectedSummary := "Missing required cluster or environment settings" expectedSummary := "One of the following fields must be set: job_cluster_key, environment_key, existing_cluster_id, new_cluster"
type testCase struct { type testCase struct {
name string name string
@ -144,8 +144,7 @@ func TestJobTaskClusterSpec(t *testing.T) {
TaskKey: "my_task", TaskKey: "my_task",
}, },
errorPath: "resources.jobs.job1.tasks[0]", errorPath: "resources.jobs.job1.tasks[0]",
errorDetail: `Task "my_task" requires a cluster or an environment to run. errorDetail: "Task \"my_task\" has a task type that requires a cluster or environment, but neither is specified",
Specify one of the following fields: job_cluster_key, environment_key, existing_cluster_id, new_cluster.`,
errorSummary: expectedSummary, errorSummary: expectedSummary,
}, },
{ {
@ -159,8 +158,7 @@ Specify one of the following fields: job_cluster_key, environment_key, existing_
}, },
}, },
errorPath: "resources.jobs.job1.tasks[0].for_each_task.task", errorPath: "resources.jobs.job1.tasks[0].for_each_task.task",
errorDetail: `Task "my_task" requires a cluster or an environment to run. errorDetail: "Task \"my_task\" has a task type that requires a cluster or environment, but neither is specified",
Specify one of the following fields: job_cluster_key, environment_key, existing_cluster_id, new_cluster.`,
errorSummary: expectedSummary, errorSummary: expectedSummary,
}, },
} }