Skip to content

Commit

Permalink
backport of commit b59d1ef
Browse files Browse the repository at this point in the history
  • Loading branch information
lgfa29 committed Mar 3, 2023
1 parent f8239c0 commit f80d466
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions command/job_inspect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestInspectCommand_Fails(t *testing.T) {
if code := cmd.Run([]string{"-address=" + url, "nope"}); code != 1 {
t.Fatalf("expect exit 1, got: %d", code)
}
if out := ui.ErrorWriter.String(); !strings.Contains(out, "No job(s) with prefix or id") {
if out := ui.ErrorWriter.String(); !strings.Contains(out, "No job(s) with prefix or ID") {
t.Fatalf("expect not found error, got: %s", out)
}
ui.ErrorWriter.Reset()
Expand All @@ -47,7 +47,7 @@ func TestInspectCommand_Fails(t *testing.T) {
if code := cmd.Run([]string{"-address=nope", "nope"}); code != 1 {
t.Fatalf("expected exit code 1, got: %d", code)
}
if out := ui.ErrorWriter.String(); !strings.Contains(out, "Error inspecting job") {
if out := ui.ErrorWriter.String(); !strings.Contains(out, "Error querying job prefix") {
t.Fatalf("expected failed query error, got: %s", out)
}
ui.ErrorWriter.Reset()
Expand Down
3 changes: 0 additions & 3 deletions command/job_scaling_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ func (j *JobScalingEventsCommand) Run(args []string) int {
return 1
}

// Get the job ID.
jobID := args[0]

// Get the HTTP client.
client, err := j.Meta.Client()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions command/job_stop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func TestStopCommand_Fails(t *testing.T) {
must.One(t, code)

out = ui.ErrorWriter.String()
must.StrContains(t, out, "No job(s) with prefix or id")
must.StrContains(t, out, "No job(s) with prefix or ID")

ui.ErrorWriter.Reset()

Expand All @@ -123,7 +123,7 @@ func TestStopCommand_Fails(t *testing.T) {
must.One(t, code)

out = ui.ErrorWriter.String()
must.StrContains(t, out, "Error finding jobs with prefix: nope")
must.StrContains(t, out, "Error querying job prefix")
}

func TestStopCommand_AutocompleteArgs(t *testing.T) {
Expand Down
1 change: 0 additions & 1 deletion command/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ func (m *Meta) JobIDByPrefix(client *api.Client, prefix string, filter JobByPref
if len(jobs) > 1 {
exactMatch := prefix == jobs[0].ID
matchInMultipleNamespaces := m.allNamespaces() && jobs[0].ID == jobs[1].ID
fmt.Println(m.allNamespaces())
if !exactMatch || matchInMultipleNamespaces {
return "", "", fmt.Errorf(
"Prefix %q matched multiple jobs\n\n%s",
Expand Down

0 comments on commit f80d466

Please sign in to comment.