Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion submitqueue/orchestrator/controller/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func (c *Controller) startPath(ctx context.Context, store storage.Storage, batch
return fmt.Errorf("failed to record build %s: %w", buildID.ID, err)
}

link := entity.PathBuild{PathID: entry.ID, Attempt: entry.Attempt, BuildID: buildID.ID}
link := entity.PathBuild{Queue: batch.Queue, PathID: entry.ID, Attempt: entry.Attempt, BuildID: buildID.ID}
if err := store.GetPathBuildStore().Create(ctx, link); err != nil {
if errors.Is(err, storage.ErrAlreadyExists) {
// Another dispatch named this attempt first. Its build is the one
Expand Down
6 changes: 3 additions & 3 deletions submitqueue/orchestrator/controller/build/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func TestProcess_TriggersWithThePathsBase(t *testing.T) {
return nil
}),
deps.pathBuilds.EXPECT().Create(gomock.Any(), entity.PathBuild{
PathID: entry.ID, Attempt: 1, BuildID: "build-1",
Queue: "test-queue", PathID: entry.ID, Attempt: 1, BuildID: "build-1",
}).Return(nil),
deps.publisher.EXPECT().Publish(gomock.Any(), "buildsignal", gomock.Any()).
DoAndReturn(func(_ context.Context, _ string, msg entityqueue.Message) error {
Expand Down Expand Up @@ -270,7 +270,7 @@ func TestProcess_NeverWritesThePathSetAndIgnoresCancelling(t *testing.T) {
Return(entity.BuildID{ID: "build-1"}, nil)
deps.builds.EXPECT().Create(gomock.Any(), gomock.Any()).Return(nil)
deps.pathBuilds.EXPECT().Create(gomock.Any(), entity.PathBuild{
PathID: pending.ID, Attempt: 1, BuildID: "build-1",
Queue: "test-queue", PathID: pending.ID, Attempt: 1, BuildID: "build-1",
}).Return(nil)
expectSignal(t, deps, "build-1")

Expand Down Expand Up @@ -336,7 +336,7 @@ func TestProcess_LostDispatchRaceHandsBothBuildsToThePollLoop(t *testing.T) {
deps.pathBuilds.EXPECT().Get(gomock.Any(), entry.ID, 1).
Return(entity.PathBuild{}, storage.ErrNotFound),
deps.pathBuilds.EXPECT().Create(gomock.Any(), entity.PathBuild{
PathID: entry.ID, Attempt: 1, BuildID: "build-surplus",
Queue: "test-queue", PathID: entry.ID, Attempt: 1, BuildID: "build-surplus",
}).Return(storage.ErrAlreadyExists),
deps.pathBuilds.EXPECT().Get(gomock.Any(), entry.ID, 1).
Return(entity.PathBuild{PathID: entry.ID, Attempt: 1, BuildID: "build-winner"}, nil),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (c *Controller) dispatch(ctx context.Context, store storage.Storage, queue
// at all, because nothing marked it changed.
set, exists := snap.pathSets[batch.ID]
if !exists {
set = entity.SpeculationPathSet{Head: batch.ID}
set = entity.SpeculationPathSet{Queue: queue, Head: batch.ID}
}

changed := snap.isDirty(batch.ID)
Expand Down
4 changes: 4 additions & 0 deletions submitqueue/orchestrator/controller/speculate/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ func TestRun_FundsProposedPath(t *testing.T) {
h.pathSets.EXPECT().Create(gomock.Any(), gomock.Any()).
DoAndReturn(func(_ context.Context, set entity.SpeculationPathSet) error {
require.Len(t, set.Paths, 1)
// The set must name the queue it belongs to: the store is bound to
// one queue and refuses a write that disagrees, so an unstamped set
// means no head is ever funded.
assert.Equal(t, "q", set.Queue)
assert.Equal(t, path.ID(), set.Paths[0].ID)
assert.Equal(t, entity.SpeculationPathStatusPending, set.Paths[0].Status)
assert.Equal(t, 1, set.Paths[0].Attempt)
Expand Down
Loading