Fix Run file capability negotiation
This commit is contained in:
@@ -611,7 +611,7 @@ func firstEligibleSupportedJob(jobs []domain.Job, capabilities []string, stamp t
|
||||
if !eligible || !job.CancelRequestedAt.IsZero() {
|
||||
continue
|
||||
}
|
||||
if len(capabilitySet) > 0 && !isServerFileCapability(job.Capability) {
|
||||
if len(capabilitySet) > 0 {
|
||||
if _, supported := capabilitySet[job.Capability]; !supported {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ func TestCoreServiceRunJobClaimNoJob(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCoreServiceRunJobClaimAllowsServerFileCapabilityWithoutDeclaration(t *testing.T) {
|
||||
func TestCoreServiceRunJobClaimSkipsServerFileCapabilityWithoutDeclaration(t *testing.T) {
|
||||
svc := newTestCoreService()
|
||||
plugin, endpoint := createPluginAndRunEndpoint(t, svc)
|
||||
instance, err := svc.CreateServerInstance(domain.ServerInstance{
|
||||
@@ -139,8 +139,12 @@ func TestCoreServiceRunJobClaimAllowsServerFileCapabilityWithoutDeclaration(t *t
|
||||
if err != nil {
|
||||
t.Fatalf("claim file list job: %v", err)
|
||||
}
|
||||
if !claim.Accepted || !claim.HasJob || claim.Job.JobID != "job-file-list" || claim.Job.Capability != domain.JobCapabilityFilesList {
|
||||
t.Fatalf("expected file job claim without files.list declaration, got %+v", claim)
|
||||
if !claim.Accepted || claim.HasJob || claim.Job != nil || claim.NextPollSeconds <= 0 {
|
||||
t.Fatalf("expected unsupported file job to remain queued, got %+v", claim)
|
||||
}
|
||||
jobs, err := svc.store.Jobs().List(domain.JobFilter{RunEndpointID: endpoint.ID})
|
||||
if err != nil || len(jobs) != 1 || jobs[0].State != domain.JobStateQueued {
|
||||
t.Fatalf("expected unsupported file job to remain queued in storage, jobs=%+v err=%v", jobs, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user