MCPcopy
hub / github.com/grafana/tempo / restartServiceWithConfigOverlay

Method restartServiceWithConfigOverlay

integration/util/harness.go:344–369  ·  view source on GitHub ↗

restartServiceWithConfigOverlay stops a service, applies a config overlay, and restarts the service. The overlay file is merged onto the existing config, with overlay values taking precedence.

(t *testing.T, service *e2e.HTTPService, overlayPath string)

Source from the content-addressed store, hash-verified

342// restartServiceWithConfigOverlay stops a service, applies a config overlay, and restarts the service.
343// The overlay file is merged onto the existing config, with overlay values taking precedence.
344func (h *TempoHarness) restartServiceWithConfigOverlay(t *testing.T, service *e2e.HTTPService, overlayPath string) error {
345 // Stop the service
346 err := service.Stop()
347 if strings.Contains(err.Error(), "exit status 137") { // 137 is returned by linux when it is force killed b/c it doesn't stop in time.
348 t.Logf("service %s was force killed during stop: %v", service.Name(), err)
349 } else if err != nil {
350 return fmt.Errorf("failed to stop service: %w", err)
351 }
352
353 // Apply overlay to current config
354 err = applyConfigOverlay(h.TestScenario, overlayPath, nil)
355 if err != nil {
356 return fmt.Errorf("failed to apply config overlay: %w", err)
357 }
358
359 // Restart the service
360 if err := service.Start(h.TestScenario.NetworkName(), h.TestScenario.SharedDir()); err != nil {
361 return fmt.Errorf("failed to restart service: %w", err)
362 }
363
364 if err := service.WaitReady(); err != nil {
365 return fmt.Errorf("service did not become ready after restart: %w", err)
366 }
367
368 return nil
369}
370
371func (h *TempoHarness) WaitTracesWritable(t *testing.T) {
372 t.Helper()

Callers 1

ForceBackendQueryingMethod · 0.95

Calls 5

applyConfigOverlayFunction · 0.85
StopMethod · 0.65
ErrorMethod · 0.65
NameMethod · 0.65
StartMethod · 0.65

Tested by

no test coverage detected