worker: require workers to pass their architecture
Jobs are scheduled with type "osbuild:{arch}", to ensure that workers
only get jobs with the right architecture assigned.
This commit is contained in:
parent
44c2144994
commit
9008a1defc
10 changed files with 59 additions and 19 deletions
|
|
@ -64,10 +64,10 @@ func TestCreate(t *testing.T) {
|
|||
}
|
||||
server := worker.NewServer(nil, testjobqueue.New(), "")
|
||||
|
||||
_, err = server.Enqueue(manifest, nil)
|
||||
_, err = server.Enqueue(arch.Name(), manifest, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
test.TestRoute(t, server, false, "POST", "/jobs", `{"types":["osbuild"]}`, http.StatusCreated,
|
||||
test.TestRoute(t, server, false, "POST", "/jobs", `{"types":["osbuild"],"arch":"x86_64"}`, http.StatusCreated,
|
||||
`{"type":"osbuild","args":{"manifest":{"pipeline":{},"sources":{}}}}`, "id", "location", "artifact_location")
|
||||
}
|
||||
|
||||
|
|
@ -87,10 +87,10 @@ func TestCancel(t *testing.T) {
|
|||
}
|
||||
server := worker.NewServer(nil, testjobqueue.New(), "")
|
||||
|
||||
jobId, err := server.Enqueue(manifest, nil)
|
||||
jobId, err := server.Enqueue(arch.Name(), manifest, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
token, j, _, err := server.RequestOSBuildJob(context.Background())
|
||||
token, j, _, err := server.RequestOSBuildJob(context.Background(), arch.Name())
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, jobId, j)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue