Skip to content

Commit 4104a7d

Browse files
committed
Adopting the new Actor API changes.
1 parent 1795b42 commit 4104a7d

7 files changed

Lines changed: 14 additions & 15 deletions

File tree

cmd/ateapi/internal/controlapi/workflow_pause.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func (s *MarkPausingStep) IsComplete(ctx context.Context, input *PauseInput, sta
8787
func (s *MarkPausingStep) CheckPrerequisite(ctx context.Context, input *PauseInput, state *PauseState) error {
8888
// The pause edge only exists from RUNNING; PAUSING/PAUSED are fast-forwarded by IsComplete.
8989
if state.Actor.GetStatus() != ateapipb.Actor_STATUS_RUNNING {
90-
return status.Errorf(codes.FailedPrecondition, "MarkPausingStep prerequisite not met for Actor: %s (got: %v, want %s)", input.ActorID, state.Actor.GetStatus(), ateapipb.Actor_STATUS_RUNNING)
90+
return status.Errorf(codes.FailedPrecondition, "MarkPausingStep prerequisite not met for Actor: %s (got: %v, want %s)", input.ActorName, state.Actor.GetStatus(), ateapipb.Actor_STATUS_RUNNING)
9191
}
9292
return nil
9393
}
@@ -116,7 +116,7 @@ func (s *CallAteletPauseStep) IsComplete(ctx context.Context, input *PauseInput,
116116
}
117117
func (s *CallAteletPauseStep) CheckPrerequisite(ctx context.Context, input *PauseInput, state *PauseState) error {
118118
if state.Actor.GetStatus() != ateapipb.Actor_STATUS_PAUSING {
119-
return status.Errorf(codes.FailedPrecondition, "CallAteletPauseStep prerequisite not met for Actor: %s (got: %v, want %s)", input.ActorID, state.Actor.GetStatus(), ateapipb.Actor_STATUS_PAUSING)
119+
return status.Errorf(codes.FailedPrecondition, "CallAteletPauseStep prerequisite not met for Actor: %s (got: %v, want %s)", input.ActorName, state.Actor.GetStatus(), ateapipb.Actor_STATUS_PAUSING)
120120
}
121121
return nil
122122
}
@@ -175,7 +175,7 @@ func (s *FinalizePausedStep) IsComplete(ctx context.Context, input *PauseInput,
175175
}
176176
func (s *FinalizePausedStep) CheckPrerequisite(ctx context.Context, input *PauseInput, state *PauseState) error {
177177
if state.Actor.GetStatus() != ateapipb.Actor_STATUS_PAUSING {
178-
return status.Errorf(codes.FailedPrecondition, "FinalizePausedStep prerequisite not met for Actor: %s (got: %v, want %s)", input.ActorID, state.Actor.GetStatus(), ateapipb.Actor_STATUS_PAUSING)
178+
return status.Errorf(codes.FailedPrecondition, "FinalizePausedStep prerequisite not met for Actor: %s (got: %v, want %s)", input.ActorName, state.Actor.GetStatus(), ateapipb.Actor_STATUS_PAUSING)
179179
}
180180
return nil
181181
}

cmd/ateapi/internal/controlapi/workflow_pause_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func TestPauseSteps_CheckPrerequisite(t *testing.T) {
136136
t.Run(tc.name, func(t *testing.T) {
137137
ctx := context.Background()
138138
for _, st := range allActorStatuses {
139-
err := tc.step.CheckPrerequisite(ctx, &PauseInput{ActorID: "id1"}, &PauseState{Actor: &ateapipb.Actor{Status: st}})
139+
err := tc.step.CheckPrerequisite(ctx, &PauseInput{ActorName: "id1"}, &PauseState{Actor: &ateapipb.Actor{Status: st}})
140140
assertPrerequisiteResult(t, st, err, tc.allowed == nil || tc.allowed[st])
141141
}
142142
})

cmd/ateapi/internal/controlapi/workflow_resume.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func (s *AssignWorkerStep) CheckPrerequisite(ctx context.Context, input *ResumeI
128128
case ateapipb.Actor_STATUS_SUSPENDED, ateapipb.Actor_STATUS_PAUSED, ateapipb.Actor_STATUS_RESUMING:
129129
return nil
130130
default:
131-
return status.Errorf(codes.FailedPrecondition, "AssignWorkerStep prerequisite not met for Actor: %s (got: %v, want %s, %s or %s)", input.ActorID, state.Actor.GetStatus(), ateapipb.Actor_STATUS_SUSPENDED, ateapipb.Actor_STATUS_PAUSED, ateapipb.Actor_STATUS_RESUMING)
131+
return status.Errorf(codes.FailedPrecondition, "AssignWorkerStep prerequisite not met for Actor: %s (got: %v, want %s, %s or %s)", input.ActorName, state.Actor.GetStatus(), ateapipb.Actor_STATUS_SUSPENDED, ateapipb.Actor_STATUS_PAUSED, ateapipb.Actor_STATUS_RESUMING)
132132
}
133133
}
134134

@@ -273,7 +273,7 @@ func (s *CallAteletRestoreStep) IsComplete(ctx context.Context, input *ResumeInp
273273
}
274274
func (s *CallAteletRestoreStep) CheckPrerequisite(ctx context.Context, input *ResumeInput, state *ResumeState) error {
275275
if state.Actor.GetStatus() != ateapipb.Actor_STATUS_RESUMING {
276-
return status.Errorf(codes.FailedPrecondition, "CallAteletRestoreStep prerequisite not met for Actor: %s (got: %v, want %s)", input.ActorID, state.Actor.GetStatus(), ateapipb.Actor_STATUS_RESUMING)
276+
return status.Errorf(codes.FailedPrecondition, "CallAteletRestoreStep prerequisite not met for Actor: %s (got: %v, want %s)", input.ActorName, state.Actor.GetStatus(), ateapipb.Actor_STATUS_RESUMING)
277277
}
278278
return nil
279279
}
@@ -383,7 +383,7 @@ func (s *FinalizeRunningStep) IsComplete(ctx context.Context, input *ResumeInput
383383
}
384384
func (s *FinalizeRunningStep) CheckPrerequisite(ctx context.Context, input *ResumeInput, state *ResumeState) error {
385385
if state.Actor.GetStatus() != ateapipb.Actor_STATUS_RESUMING {
386-
return status.Errorf(codes.FailedPrecondition, "FinalizeRunningStep prerequisite not met for Actor: %s (got: %v, want %s)", input.ActorID, state.Actor.GetStatus(), ateapipb.Actor_STATUS_RESUMING)
386+
return status.Errorf(codes.FailedPrecondition, "FinalizeRunningStep prerequisite not met for Actor: %s (got: %v, want %s)", input.ActorName, state.Actor.GetStatus(), ateapipb.Actor_STATUS_RESUMING)
387387
}
388388
return nil
389389
}

cmd/ateapi/internal/controlapi/workflow_resume_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ func TestResumeSteps_CheckPrerequisite(t *testing.T) {
288288
t.Run(tc.name, func(t *testing.T) {
289289
ctx := context.Background()
290290
for _, st := range allActorStatuses {
291-
err := tc.step.CheckPrerequisite(ctx, &ResumeInput{ActorID: "id1"}, &ResumeState{Actor: &ateapipb.Actor{Status: st}})
291+
err := tc.step.CheckPrerequisite(ctx, &ResumeInput{ActorName: "id1"}, &ResumeState{Actor: &ateapipb.Actor{Status: st}})
292292
assertPrerequisiteResult(t, st, err, tc.allowed == nil || tc.allowed[st])
293293
}
294294
})

cmd/ateapi/internal/controlapi/workflow_suspend.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func (s *MarkSuspendingStep) IsComplete(ctx context.Context, input *SuspendInput
8787
}
8888
func (s *MarkSuspendingStep) CheckPrerequisite(ctx context.Context, input *SuspendInput, state *SuspendState) error {
8989
if state.Actor.GetStatus() != ateapipb.Actor_STATUS_RUNNING {
90-
return status.Errorf(codes.FailedPrecondition, "MarkSuspendingStep prerequisite not met for Actor: %s (got: %v, want %s)", input.ActorID, state.Actor.GetStatus(), ateapipb.Actor_STATUS_RUNNING)
90+
return status.Errorf(codes.FailedPrecondition, "MarkSuspendingStep prerequisite not met for Actor: %s (got: %v, want %s)", input.ActorName, state.Actor.GetStatus(), ateapipb.Actor_STATUS_RUNNING)
9191
}
9292
return nil
9393
}
@@ -117,7 +117,7 @@ func (s *CallAteletSuspendStep) IsComplete(ctx context.Context, input *SuspendIn
117117
}
118118
func (s *CallAteletSuspendStep) CheckPrerequisite(ctx context.Context, input *SuspendInput, state *SuspendState) error {
119119
if state.Actor.GetStatus() != ateapipb.Actor_STATUS_SUSPENDING {
120-
return status.Errorf(codes.FailedPrecondition, "CallAteletSuspendStep prerequisite not met for Actor: %s (got: %v, want %s)", input.ActorID, state.Actor.GetStatus(), ateapipb.Actor_STATUS_SUSPENDING)
120+
return status.Errorf(codes.FailedPrecondition, "CallAteletSuspendStep prerequisite not met for Actor: %s (got: %v, want %s)", input.ActorName, state.Actor.GetStatus(), ateapipb.Actor_STATUS_SUSPENDING)
121121
}
122122
return nil
123123
}
@@ -176,7 +176,7 @@ func (s *FinalizeSuspendedStep) IsComplete(ctx context.Context, input *SuspendIn
176176
}
177177
func (s *FinalizeSuspendedStep) CheckPrerequisite(ctx context.Context, input *SuspendInput, state *SuspendState) error {
178178
if state.Actor.GetStatus() != ateapipb.Actor_STATUS_SUSPENDING {
179-
return status.Errorf(codes.FailedPrecondition, "FinalizeSuspendedStep prerequisite not met for Actor: %s (got: %v, want %s)", input.ActorID, state.Actor.GetStatus(), ateapipb.Actor_STATUS_SUSPENDING)
179+
return status.Errorf(codes.FailedPrecondition, "FinalizeSuspendedStep prerequisite not met for Actor: %s (got: %v, want %s)", input.ActorName, state.Actor.GetStatus(), ateapipb.Actor_STATUS_SUSPENDING)
180180
}
181181
return nil
182182
}

cmd/ateapi/internal/controlapi/workflow_suspend_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func TestSuspendSteps_CheckPrerequisite(t *testing.T) {
137137
t.Run(tc.name, func(t *testing.T) {
138138
ctx := context.Background()
139139
for _, st := range allActorStatuses {
140-
err := tc.step.CheckPrerequisite(ctx, &SuspendInput{ActorID: "id1"}, &SuspendState{Actor: &ateapipb.Actor{Status: st}})
140+
err := tc.step.CheckPrerequisite(ctx, &SuspendInput{ActorName: "id1"}, &SuspendState{Actor: &ateapipb.Actor{Status: st}})
141141
assertPrerequisiteResult(t, st, err, tc.allowed == nil || tc.allowed[st])
142142
}
143143
})

cmd/ateapi/internal/controlapi/workflow_testutil_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,15 @@ func newTestActorWorkflow(t *testing.T, st store.Interface, tmplNamespace, tmplN
5050
func seedWorkflowActor(t *testing.T, ctx context.Context, st store.Interface, atespace, id, tmplNamespace, tmplName string, actorStatus ateapipb.Actor_Status, opts ...func(*ateapipb.Actor)) {
5151
t.Helper()
5252
actor := &ateapipb.Actor{
53-
ActorId: id,
54-
Atespace: atespace,
53+
Metadata: &ateapipb.ResourceMetadata{Name: id, Atespace: atespace},
5554
Status: actorStatus,
5655
ActorTemplateNamespace: tmplNamespace,
5756
ActorTemplateName: tmplName,
5857
}
5958
for _, opt := range opts {
6059
opt(actor)
6160
}
62-
if err := st.CreateActor(ctx, actor); err != nil {
61+
if _, err := st.CreateActor(ctx, actor); err != nil {
6362
t.Fatalf("seed actor: %v", err)
6463
}
6564
}

0 commit comments

Comments
 (0)