Skip to content
Open
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
8 changes: 8 additions & 0 deletions runtime/config_reloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ func (r *configReloader) reloadConfig(ctx context.Context, instanceID string) (v
return 0, false, err
}

// Nothing to reload without an admin connector (not configured for tests
// and standalone runtimes). Acquiring the admin service anyway fails with
// `unknown connector ""`, which made CreateInstance return a 500 on
// standalone runtimes even though the instance was created successfully.
if inst.AdminConnector == "" {
return 0, false, nil
}

admin, release, err := r.rt.Admin(ctx, instanceID)
if err != nil {
return 0, false, err
Expand Down
36 changes: 36 additions & 0 deletions runtime/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,3 +537,39 @@ func must[T any](v T, err error) T {
}
return v
}

func TestRuntime_ReloadConfigWithoutAdminConnector(t *testing.T) {
// Standalone runtimes (`rill runtime start`) run with the config reloader
// enabled but often without an admin connector. CreateInstance calls
// ReloadConfig, so an unguarded admin acquisition here failed instance
// creation with `unknown connector ""` even though the instance was fine.
repodsn := t.TempDir()
rt := newTestRuntime(t)
rt.configReloader = newConfigReloader(rt)
defer rt.Close()
ctx := context.Background()

inst := &drivers.Instance{
Environment: "test",
OLAPConnector: "duckdb",
RepoConnector: "repo",
Connectors: []*runtimev1.Connector{
{
Type: "file",
Name: "repo",
Config: must(structpb.NewStruct(map[string]any{"dsn": repodsn})),
},
{
Type: "duckdb",
Name: "duckdb",
Config: must(structpb.NewStruct(map[string]any{"dsn": ":memory:"})),
},
},
}
require.NoError(t, rt.CreateInstance(ctx, inst))

summary, err := rt.ReloadConfig(ctx, inst.ID)
require.NoError(t, err)
require.Zero(t, summary.VarsCount)
require.False(t, summary.VarsModified)
}