File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ var Flags AgentCmdFlags
5050const schemaVersion string = "v2.0.0"
5151
5252// Run starts the agent process
53- func Run (cmd * cobra.Command , args []string ) error {
53+ func Run (cmd * cobra.Command , args []string ) ( returnErr error ) {
5454 logs .Log .Printf ("Preflight agent version: %s (%s)" , version .PreflightVersion , version .Commit )
5555 ctx , cancel := context .WithCancel (
5656 klog .NewContext (
@@ -85,8 +85,8 @@ func Run(cmd *cobra.Command, args []string) error {
8585 defer func () {
8686 cancel ()
8787 if groupErr := group .Wait (); groupErr != nil {
88- err = multierror .Append (
89- err ,
88+ returnErr = multierror .Append (
89+ returnErr ,
9090 fmt .Errorf ("failed to wait for controller-runtime component to stop: %v" , groupErr ),
9191 )
9292 }
Original file line number Diff line number Diff line change @@ -44,8 +44,11 @@ func TestRunOneShot(t *testing.T) {
4444 require .NoError (t , err )
4545
4646 logs .Initialize ()
47- Run (c , nil )
48- klog .Flush ()
47+ defer klog .Flush ()
48+
49+ runErr := Run (c , nil )
50+ require .NoError (t , runErr , "Run returned an unexpected error" )
51+
4952 return
5053 }
5154 t .Log ("Running child process" )
You can’t perform that action at this time.
0 commit comments