Skip to content

Commit 715bd6e

Browse files
Merge pull request #9 from jasondborneman/jdb/tester/smallfixes
small fixes for style
2 parents fbddd73 + 1a94d26 commit 715bd6e

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

example/weather/services/tester/run_tests.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ func getStackTrace(wg *sync.WaitGroup, m *sync.Mutex) string {
3737
outC := make(chan string)
3838
go func() {
3939
var buf bytes.Buffer
40-
io.Copy(&buf, f)
40+
_, err := io.Copy(&buf, f)
41+
if err != nil {
42+
log.Errorf(context.Background(), err, "error copying buffer when captiring stack trace for test panic")
43+
}
4144
outC <- buf.String()
4245
}()
4346

@@ -63,9 +66,9 @@ func recoverFromTestPanic(ctx context.Context, testName string, testCollection *
6366
wg.Add(1)
6467
trace := getStackTrace(&wg, &m)
6568
wg.Wait()
66-
err = errors.New(fmt.Sprintf("%v : %v", r, trace))
69+
err = fmt.Errorf("%v : %v", r, trace)
6770
// log the error and add the test result to the test collection
68-
logError(ctx, err)
71+
_ = logError(ctx, err)
6972
resultMsg := fmt.Sprintf("%v | %v", msg, r)
7073
testCollection.AppendTestResult(&gentester.TestResult{
7174
Name: testName,
@@ -96,7 +99,7 @@ func (svc *Service) runTests(ctx context.Context, p *gentester.TesterPayload, te
9699
testsToRun[test] = testFunc
97100
} else {
98101
err := fmt.Errorf("test [%v] not found in test map", test)
99-
logError(ctx, err)
102+
_ = logError(ctx, err)
100103
}
101104
}
102105
} 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

example/weather/services/tester/test_methods.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ func (svc *Service) TestAll(ctx context.Context, p *gentester.TesterPayload) (re
2626
filteringPayload = p
2727
forecasterResults, err := svc.TestForecaster(ctx)
2828
if err != nil {
29-
logError(ctx, err)
29+
_ = logError(ctx, err)
3030
return nil, err
3131
}
3232
locatorResults, err := svc.TestLocator(ctx)
3333
if err != nil {
34-
logError(ctx, err)
34+
_ = logError(ctx, err)
3535
return nil, err
3636
}
3737

0 commit comments

Comments
 (0)