(t *testing.T)
| 141 | } |
| 142 | |
| 143 | func newPilotWithPlugin(t *testing.T) *TestPilotWithPlugin { |
| 144 | t.Helper() |
| 145 | |
| 146 | newService := func(name string) startstop.Service { |
| 147 | return startstop.StartStopFunc(func(ctx context.Context, shouldStart bool, started, stopped func()) error { |
| 148 | if !shouldStart { |
| 149 | return nil |
| 150 | } |
| 151 | |
| 152 | go func() { |
| 153 | started() |
| 154 | defer stopped() // this defer should come first so it's last out |
| 155 | |
| 156 | t.Logf("Test service started: %s", name) |
| 157 | |
| 158 | <-ctx.Done() |
| 159 | }() |
| 160 | |
| 161 | return nil |
| 162 | }) |
| 163 | } |
| 164 | |
| 165 | return &TestPilotWithPlugin{ |
| 166 | StandardPilot: riverpilot.StandardPilot{}, |
| 167 | maintenanceService: newService("maintenance service"), |
| 168 | service: newService("other service"), |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | func (d *TestPilotWithPlugin) PluginMaintenanceServices() []startstop.Service { |
| 173 | return []startstop.Service{d.maintenanceService} |
no test coverage detected
searching dependent graphs…