Skip to content

Commit

Permalink
stream-tester: Add hostname to start&end logs
Browse files Browse the repository at this point in the history
  • Loading branch information
victorges committed Dec 24, 2021
1 parent 71b6ce3 commit ad40824
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/app/recordtester/continuous_record_tester.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"net/url"
"os"
"strconv"
"time"

Expand Down Expand Up @@ -67,7 +68,8 @@ func NewContinuousRecordTester(gctx context.Context, lapi *livepeer.API, lanalyz
}

func (crt *continuousRecordTester) Start(fileName string, testDuration, pauseDuration, pauseBetweenTests time.Duration) error {
messenger.SendMessage(fmt.Sprintf("Starting continuous test of %s", crt.host))
hostname, _ := os.Hostname()
messenger.SendMessage(fmt.Sprintf("Starting continuous test of %s on hostname=%s", crt.host, hostname))
try := 0
notRtmpTry := 0
maxTestDuration := 2*testDuration + pauseDuration + 15*time.Minute
Expand All @@ -83,7 +85,7 @@ func (crt *continuousRecordTester) Start(fileName string, testDuration, pauseDur
cancel()

if crt.ctx.Err() != nil {
messenger.SendMessage(fmt.Sprintf("Continuous record test of %s cancelled", crt.host))
messenger.SendMessage(fmt.Sprintf("Continuous record test of %s cancelled on hostname=%s", crt.host, hostname))
return crt.ctx.Err()
} else if ctxErr != nil {
msg := fmt.Sprintf("Record test of %s timed out, potential deadlock! ctxErr=%q err=%q", crt.host, ctxErr, err)
Expand Down Expand Up @@ -121,9 +123,7 @@ func (crt *continuousRecordTester) Start(fileName string, testDuration, pauseDur
glog.Infof("Waiting %s before next test", pauseBetweenTests)
select {
case <-crt.ctx.Done():
err := crt.ctx.Err()
msg := fmt.Sprintf("Continuous record test of %s cancelled err=%q", crt.host, err)
messenger.SendMessage(msg)
messenger.SendMessage(fmt.Sprintf("Continuous record test of %s cancelled on hostname=%s", crt.host, hostname))
return err
case <-time.After(pauseBetweenTests):
}
Expand Down

0 comments on commit ad40824

Please sign in to comment.