From d684366a4d282719443aab18baf20781a6656600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Pa=C3=9F?= <22845248+mpass99@users.noreply.github.com> Date: Thu, 9 Dec 2021 20:36:56 +0100 Subject: [PATCH] Add debug statements for TestSendsSignalAfterTimeout --- internal/runner/runner_test.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/runner/runner_test.go b/internal/runner/runner_test.go index b36ba0b..140c6e0 100644 --- a/internal/runner/runner_test.go +++ b/internal/runner/runner_test.go @@ -175,10 +175,15 @@ func (s *ExecuteInteractivelyTestSuite) TestSendsSignalAfterTimeout() { s.mockedExecuteCommandCall.Run(func(args mock.Arguments) { stdin, ok := args.Get(4).(io.Reader) s.Require().True(ok) - buffer := make([]byte, 1) //nolint:makezero,lll // If the length is zero, the Read call never reads anything. gofmt want this alignment. - for n := 0; !(n == 1 && buffer[0] == SIGQUIT); n, _ = stdin.Read(buffer) { //nolint:errcheck,lll // Read returns EOF errors but that is expected. This nolint makes the line too long. + buffer := make([]byte, 1) //nolint:makezero,lll // If the length is zero, the Read call never reads anything. gofmt want this alignment. + for n := 0; !(n == 1 && buffer[0] == SIGQUIT); { time.After(tests.ShortTimeout) + n, _ = stdin.Read(buffer) //nolint:errcheck,lll // Read returns EOF errors but that is expected. This nolint makes the line too long. + if n > 0 { + log.WithField("buffer", fmt.Sprintf("%x", buffer[0])).Info("Received Stdin") + } } + log.Info("After loop") close(quit) }).Return(0, nil) timeLimit := 1 @@ -186,10 +191,12 @@ func (s *ExecuteInteractivelyTestSuite) TestSendsSignalAfterTimeout() { s.runner.StoreExecution(defaultExecutionID, executionRequest) _, _, err := s.runner.ExecuteInteractively(defaultExecutionID, bytes.NewBuffer(make([]byte, 1)), nil, nil) s.Require().NoError(err) + log.Info("Before waiting") select { case <-time.After(2 * (time.Duration(timeLimit) * time.Second)): s.FailNow("The execution should receive a SIGQUIT after the timeout") case <-quit: + log.Info("Received quit") } }