fix: scheduler empty-resreq JOB_UPDATE crash (bug-1904); xcecli jobs list rejection text (bug-1906)
bug-1904: both scheduler JOB_UPDATE paths parsed "" as-is:
parse_resreq() returns success with a PRIMARY container whose body is
NULL, and apply_job_task_count() wrote through it. Use ingest's default
("type == any") instead.
bug-1906: xcecli jobs list sent local selection-parse errors through
ExtractErrorMessage, which strips brackets and the quoted selection;
report them as written.
Also logs bug-1905 (xcecd_virtual ignores kill of a running job). All
three found by job-array-one-based-index task 10.2's live REST flow.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6439e5852f
commit
6e631caa22
9 changed files with 392 additions and 12 deletions
|
|
@ -99,8 +99,9 @@ func (jq *JobsQuerier) RunJobsList() error {
|
|||
// Get filter string
|
||||
filterStr, err := jq.filter.HandleJobFilter("")
|
||||
if err != nil {
|
||||
errMsg := request.ExtractErrorMessage(err)
|
||||
return fmt.Errorf("failed to get parameter: [%s]", errMsg)
|
||||
// A local parse error: report it as written (it names the
|
||||
// rejected selection); ExtractErrorMessage strips brackets.
|
||||
return fmt.Errorf("failed to get parameter: [%v]", err)
|
||||
} else if filterStr != "" {
|
||||
params["filter"] = filterStr
|
||||
}
|
||||
|
|
@ -190,8 +191,9 @@ func (jq *JobsQuerier) runArrayJobStats(serverInfo *config.APIServerInfo, apiCli
|
|||
|
||||
filterStr, err := jq.filter.HandleJobFilter("array_stats")
|
||||
if err != nil {
|
||||
errMsg := request.ExtractErrorMessage(err)
|
||||
return fmt.Errorf("failed to get parameter: [%s]", errMsg)
|
||||
// A local parse error: report it as written (it names the
|
||||
// rejected selection); ExtractErrorMessage strips brackets.
|
||||
return fmt.Errorf("failed to get parameter: [%v]", err)
|
||||
}
|
||||
|
||||
if filterStr != "" {
|
||||
|
|
|
|||
51
src/frontend/xcecli/cmd/jobs/list_test.go
Normal file
51
src/frontend/xcecli/cmd/jobs/list_test.go
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
package jobs
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"xcecli/config"
|
||||
)
|
||||
|
||||
// newTestQuerier returns a JobsQuerier whose config points at an unreachable
|
||||
// API server: a rejected selection must be reported before any request.
|
||||
func newTestQuerier(t *testing.T, args ...string) *JobsQuerier {
|
||||
t.Helper()
|
||||
cm := config.NewConfigManagerWithPath(filepath.Join(t.TempDir(), "config.json"))
|
||||
cfg := &config.Config{APIServerInfo: config.APIServerInfoArray{{URL: "http://127.0.0.1:1"}}}
|
||||
if err := cm.SaveConfig(cfg); err != nil {
|
||||
t.Fatalf("save config: %v", err)
|
||||
}
|
||||
jq := NewJobsQuerier(cm)
|
||||
if err := jq.ParseCmdArgs(nil, args); err != nil {
|
||||
t.Fatalf("ParseCmdArgs: %v", err)
|
||||
}
|
||||
return jq
|
||||
}
|
||||
|
||||
// A rejected selection is reported as written, naming the selection and
|
||||
// keeping the [k] syntax in the message (Requirement 5.12; the list path
|
||||
// used to strip every bracket and everything before the last ": ").
|
||||
func TestRunJobsListReportsRejectedSelectionVerbatim(t *testing.T) {
|
||||
cases := []struct {
|
||||
sel string
|
||||
want []string
|
||||
}{
|
||||
{"1-0-1700000000-0[40000]", []string{"'1-0-1700000000-0[40000]'", "at most 32767"}},
|
||||
{"1-0-1700000000-0[1,3]", []string{"'1-0-1700000000-0[1,3]'", "<array-id>[k]"}},
|
||||
{"1-0-1700000000-5[1]", []string{"'1-0-1700000000-5[1]'", "not an array identity"}},
|
||||
{"garbage", []string{"'garbage'", "<array-id>[k] or <array-id>[a-b]"}},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
err := newTestQuerier(t, tc.sel).RunJobsList()
|
||||
if err == nil {
|
||||
t.Fatalf("%s: want rejection, got nil", tc.sel)
|
||||
}
|
||||
for _, w := range tc.want {
|
||||
if !strings.Contains(err.Error(), w) {
|
||||
t.Errorf("%s: error %q does not contain %q", tc.sel, err.Error(), w)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue