Skip to content

small fixes for style #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions example/weather/services/tester/run_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ func getStackTrace(wg *sync.WaitGroup, m *sync.Mutex) string {
outC := make(chan string)
go func() {
var buf bytes.Buffer
io.Copy(&buf, f)
_, err := io.Copy(&buf, f)
if err != nil {
log.Errorf(context.Background(), err, "error copying buffer when captiring stack trace for test panic")
}
outC <- buf.String()
}()

Expand All @@ -63,9 +66,9 @@ func recoverFromTestPanic(ctx context.Context, testName string, testCollection *
wg.Add(1)
trace := getStackTrace(&wg, &m)
wg.Wait()
err = errors.New(fmt.Sprintf("%v : %v", r, trace))
err = fmt.Errorf("%v : %v", r, trace)
// log the error and add the test result to the test collection
logError(ctx, err)
_ = logError(ctx, err)
resultMsg := fmt.Sprintf("%v | %v", msg, r)
testCollection.AppendTestResult(&gentester.TestResult{
Name: testName,
Expand Down Expand Up @@ -96,7 +99,7 @@ func (svc *Service) runTests(ctx context.Context, p *gentester.TesterPayload, te
testsToRun[test] = testFunc
} else {
err := fmt.Errorf("test [%v] not found in test map", test)
logError(ctx, err)
_ = logError(ctx, err)
}
}
} else if len(p.Exclude) > 0 { // If there is only an exclude list, we add tests not found in that exclude list to the tests to run
Expand Down
4 changes: 2 additions & 2 deletions example/weather/services/tester/test_methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ func (svc *Service) TestAll(ctx context.Context, p *gentester.TesterPayload) (re
filteringPayload = p
forecasterResults, err := svc.TestForecaster(ctx)
if err != nil {
logError(ctx, err)
_ = logError(ctx, err)
return nil, err
}
locatorResults, err := svc.TestLocator(ctx)
if err != nil {
logError(ctx, err)
_ = logError(ctx, err)
return nil, err
}

Expand Down