Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8d5a2ca
wip
maxdml Jul 29, 2025
b66a2aa
update tests
maxdml Jul 29, 2025
e346712
wip
maxdml Jul 30, 2025
8200442
new interface
maxdml Jul 30, 2025
897ba1a
cleanup interface + RunAsWorkflow
maxdml Jul 31, 2025
e1eb063
fix RunAsWorkflow and work on new step interface
maxdml Jul 31, 2025
c4f0c60
remove register functions from interface -- simply does nothing if we…
maxdml Jul 31, 2025
589b6d3
fix
maxdml Jul 31, 2025
38417e2
fix and nits
maxdml Aug 1, 2025
b6eb296
WIP: first pass at updating the tests
maxdml Aug 1, 2025
6c332ce
shutdown logs + check if launched
maxdml Aug 1, 2025
d0f4272
cleanup
maxdml Aug 1, 2025
c996d7a
fix step output handling + retrieval of registration-time options + c…
maxdml Aug 1, 2025
4a3fcd2
fix qrunner context for now
maxdml Aug 1, 2025
fb97d3d
update tests
maxdml Aug 1, 2025
c3ea87b
simpler
maxdml Aug 1, 2025
7a54132
fix bug in WithValue
maxdml Aug 1, 2025
e4a9806
comment
maxdml Aug 1, 2025
ab75aaf
identify uncancellable AwaitWorkflowResult -- will have to pass it a …
maxdml Aug 1, 2025
60808e3
add defensive type check
maxdml Aug 1, 2025
81c2fde
wrapper should use provided context
maxdml Aug 1, 2025
5149aa5
typo
maxdml Aug 1, 2025
cebb49b
fix small race in test + check recovery handles == original handles
maxdml Aug 1, 2025
2a77ad8
nit
maxdml Aug 1, 2025
aad3c37
Revert changes to step interface for now
maxdml Aug 1, 2025
a86463f
nit
maxdml Aug 2, 2025
92fe03f
revert unwanted changes
maxdml Aug 2, 2025
38aec11
remove unused WithWorkflowMaxRetries
maxdml Aug 2, 2025
f6c8fc5
type check + nits
maxdml Aug 2, 2025
d067655
simplify tests
maxdml Aug 2, 2025
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
4 changes: 2 additions & 2 deletions dbos/admin_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type queueMetadata struct {
RateLimit *RateLimiter `json:"rateLimit,omitempty"`
}

func newAdminServer(port int) *adminServer {
func newAdminServer(ctx *dbosContext, port int) *adminServer {
mux := http.NewServeMux()

// Health endpoint
Expand All @@ -50,7 +50,7 @@ func newAdminServer(port int) *adminServer {

getLogger().Info("Recovering workflows for executors", "executors", executorIDs)

handles, err := recoverPendingWorkflows(r.Context(), executorIDs)
handles, err := recoverPendingWorkflows(ctx, executorIDs)
if err != nil {
getLogger().Error("Error recovering workflows", "error", err)
http.Error(w, fmt.Sprintf("Recovery failed: %v", err), http.StatusInternalServerError)
Expand Down
32 changes: 17 additions & 15 deletions dbos/admin_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@ import (
)

func TestAdminServer(t *testing.T) {
databaseURL := getDatabaseURL(t)
databaseURL := getDatabaseURL()

t.Run("Admin server is not started by default", func(t *testing.T) {
// Ensure clean state
Shutdown()

err := Initialize(Config{
ctx, err := NewDBOSContext(Config{
DatabaseURL: databaseURL,
AppName: "test-app",
})
if err != nil {
t.Skipf("Failed to initialize DBOS: %v", err)
}
err = Launch()
err = ctx.Launch()
if err != nil {
t.Skipf("Failed to initialize DBOS: %v", err)
}

// Ensure cleanup
defer func() {
Shutdown()
if ctx != nil {
ctx.Shutdown()
}
}()

// Give time for any startup processes
Expand All @@ -45,46 +45,48 @@ func TestAdminServer(t *testing.T) {
}

// Verify the DBOS executor doesn't have an admin server instance
if dbos == nil {
if ctx == nil {
t.Fatal("Expected DBOS instance to be created")
}

if dbos.adminServer != nil {
exec := ctx.(*dbosContext)
if exec.adminServer != nil {
t.Error("Expected admin server to be nil when not configured")
}
})

t.Run("Admin server endpoints", func(t *testing.T) {
Shutdown()

// Launch DBOS with admin server once for all endpoint tests
err := Initialize(Config{
ctx, err := NewDBOSContext(Config{
DatabaseURL: databaseURL,
AppName: "test-app",
AdminServer: true,
})
if err != nil {
t.Skipf("Failed to initialize DBOS with admin server: %v", err)
}
err = Launch()
err = ctx.Launch()
if err != nil {
t.Skipf("Failed to initialize DBOS with admin server: %v", err)
}

// Ensure cleanup
defer func() {
Shutdown()
if ctx != nil {
ctx.Shutdown()
}
}()

// Give the server a moment to start
time.Sleep(100 * time.Millisecond)

// Verify the DBOS executor has an admin server instance
if dbos == nil {
if ctx == nil {
t.Fatal("Expected DBOS instance to be created")
}

if dbos.adminServer == nil {
exec := ctx.(*dbosContext)
if exec.adminServer == nil {
t.Fatal("Expected admin server to be created in DBOS instance")
}

Expand Down
Loading
Loading