@@ -375,52 +375,22 @@ func Test_replaceWithStaticTimestamps(t *testing.T) {
375375}
376376
377377func TestLogToSlogWriter (t * testing.T ) {
378- // This test makes sure that all the agent's Log.Fatalf calls are correctly
379- // translated to slog.Error calls.
378+ // This test makes sure that all the agent's remaining Log calls are correctly
379+ // translated to slog.Error calls where appropriate .
380380 //
381381 // This list was generated using:
382- // grep -r "Log\.Fatalf" ./cmd ./pkg
382+ // git grep -i "log\.\(print\|fatal\)" pkg/ cmd/ | fgrep -e error -e failed
383383 given := strings .TrimPrefix (`
384- Failed to load config file for agent from
385- Failed to read config file
386- Failed to parse config file
387- While evaluating configuration
388- failed to run pprof profiler
389- failed to run the health check server
390- failed to start a controller-runtime component
391- failed to wait for controller-runtime component to stop
392- running data gatherer %s of type %s as Local, data-path override present
393- failed to instantiate %q data gatherer
394- failed to read local data file
395- failed to unmarshal local data file
396- failed to output to local file
397- Exiting due to fatal error uploading
398- halting datagathering in strict mode due to error
399- Cannot marshal readings
400- Failed to read config file
401- Failed to parse config file
402- Failed to validate data gatherers
384+ failed to complete initial sync of %q data gatherer %q: %v
385+ error messages will not show in the pod's events because the POD_NAME environment variable is empty
386+ retrying in %v after error: %s
387+ datagatherer informer for %q has failed and is backing off due to error: %s
403388this is a happy log that should show as INFO` , "\n " )
404389 expect := strings .TrimPrefix (`
405- level=ERROR msg="Failed to load config file for agent from" source=agent
406- level=ERROR msg="Failed to read config file" source=agent
407- level=ERROR msg="Failed to parse config file" source=agent
408- level=ERROR msg="While evaluating configuration" source=agent
409- level=ERROR msg="failed to run pprof profiler" source=agent
410- level=ERROR msg="failed to run the health check server" source=agent
411- level=ERROR msg="failed to start a controller-runtime component" source=agent
412- level=ERROR msg="failed to wait for controller-runtime component to stop" source=agent
413- level=ERROR msg="running data gatherer %!s(MISSING) of type %!s(MISSING) as Local, data-path override present" source=agent
414- level=ERROR msg="failed to instantiate %!q(MISSING) data gatherer" source=agent
415- level=ERROR msg="failed to read local data file" source=agent
416- level=ERROR msg="failed to unmarshal local data file" source=agent
417- level=ERROR msg="failed to output to local file" source=agent
418- level=ERROR msg="Exiting due to fatal error uploading" source=agent
419- level=ERROR msg="halting datagathering in strict mode due to error" source=agent
420- level=ERROR msg="Cannot marshal readings" source=agent
421- level=ERROR msg="Failed to read config file" source=agent
422- level=ERROR msg="Failed to parse config file" source=agent
423- level=ERROR msg="Failed to validate data gatherers" source=agent
390+ level=ERROR msg="failed to complete initial sync of %!q(MISSING) data gatherer %!q(MISSING): %!v(MISSING)" source=agent
391+ level=ERROR msg="error messages will not show in the pod's events because the POD_NAME environment variable is empty" source=agent
392+ level=ERROR msg="retrying in %!v(MISSING) after error: %!s(MISSING)" source=agent
393+ level=ERROR msg="datagatherer informer for %!q(MISSING) has failed and is backing off due to error: %!s(MISSING)" source=agent
424394level=INFO msg="this is a happy log that should show as INFO" source=agent
425395` , "\n " )
426396
0 commit comments