fix(action): make dns.discover side-effect only

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-04 02:52:17 +00:00
parent d0b3da9494
commit d1e884f2e2
2 changed files with 4 additions and 11 deletions

View file

@ -147,13 +147,13 @@ func (service *Service) ActionDefinitions() []ActionDefinition {
if err := service.DiscoverAliases(context.Background()); err != nil {
return nil, false, err
}
return service.Health(), true, nil
return nil, true, nil
},
InvokeContext: func(ctx context.Context, _ map[string]any) (any, bool, error) {
if err := service.DiscoverAliases(ctx); err != nil {
return nil, false, err
}
return service.Health(), true, nil
return nil, true, nil
},
},
}

View file

@ -3499,18 +3499,11 @@ func TestServiceHandleActionReverseHealthServeAndDiscover(t *testing.T) {
if err != nil {
t.Fatalf("unexpected discover action error: %v", err)
}
if discoverPayload == nil || !ok {
t.Fatal("expected discover action payload")
}
if !ok {
t.Fatal("expected discover action to succeed")
}
discoverHealth, ok := discoverPayload.(HealthResult)
if !ok {
t.Fatalf("expected discover action payload HealthResult, got %T", discoverPayload)
}
if discoverHealth.TreeRoot != "discover-root" {
t.Fatalf("expected discover to refresh tree root, got %#v", discoverHealth.TreeRoot)
if discoverPayload != nil {
t.Fatalf("expected discover action to be side-effect only, got %#v", discoverPayload)
}
}