Skip to content

Commit d42c5a9

Browse files
committed
Fix: Update
1 parent 649f830 commit d42c5a9

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

dbos/dbos.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,6 @@ func NewDBOSContext(ctx context.Context, inputConfig Config) (DBOSContext, error
322322
gob.Register(ws)
323323
var si []StepInfo
324324
gob.Register(si)
325-
var bh baseWorkflowHandle
326-
gob.Register(bh)
327325
var h workflowHandle[any]
328326
gob.Register(h)
329327
var ph workflowPollingHandle[any]

dbos/dbos_test.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,3 +719,38 @@ func TestCustomPool(t *testing.T) {
719719
assert.False(t, systemDB.(*sysDB).launched)
720720
})
721721
}
722+
723+
func TestWorkflowHandlerRegistration(t *testing.T) {
724+
databaseURL := getDatabaseURL()
725+
ctx, err := NewDBOSContext(context.Background(), Config{
726+
DatabaseURL: databaseURL,
727+
AppName: "test-initialize",
728+
})
729+
require.NoError(t, err)
730+
defer func() {
731+
if ctx != nil {
732+
Shutdown(ctx, 1*time.Minute)
733+
}
734+
}() // Clean up executor
735+
736+
require.NotNil(t, ctx)
737+
738+
wf := func(ctx DBOSContext, input string) (string, error) {
739+
return input, nil
740+
}
741+
742+
RegisterWorkflow(ctx, wf)
743+
744+
// Launch a workflow
745+
err = Launch(ctx)
746+
require.NoError(t, err)
747+
defer Shutdown(ctx, 1*time.Minute)
748+
749+
// Run a workflow
750+
handle, err := RunWorkflow(ctx, wf, "test-input")
751+
require.NoError(t, err)
752+
753+
result, err := handle.GetResult()
754+
require.NoError(t, err, "failed to get result from workflow")
755+
assert.Equal(t, "test-input", result)
756+
}

0 commit comments

Comments
 (0)