Skip to content

Commit

Permalink
vod-tester: Fix direct&resumable upload tests (#194)
Browse files Browse the repository at this point in the history
* vodtester: Cap summary to 1024 characters

* vodtester: Update go-api-client for longer upload timeout

* vodtester: Stop tests on first error

* [TEMP] Disable tus tests

* vodtester: tus fixes on go-api-client

* vodtester: enable tus uploads

Co-authored-by: gioelecerati <[email protected]>
  • Loading branch information
victorges and gioelecerati authored Sep 16, 2022
1 parent 5d4a938 commit c1e427d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/golang/glog v1.0.0
github.com/gosuri/uilive v0.0.3 // indirect
github.com/gosuri/uiprogress v0.0.1
github.com/livepeer/go-api-client v0.2.9-0.20220908143323-8ff49d9fddce
github.com/livepeer/go-api-client v0.2.9-0.20220916171125-c13c05817515
github.com/livepeer/go-livepeer v0.5.31
github.com/livepeer/joy4 v0.1.2-0.20220210094601-95e4d28f5f07
github.com/livepeer/leaderboard-serverless v1.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,8 @@ github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL
github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/livepeer/go-api-client v0.2.9-0.20220908143323-8ff49d9fddce h1:YbZcqp276/5Dp/ys680emXveyt2UTHAirkhg1LUF5MQ=
github.com/livepeer/go-api-client v0.2.9-0.20220908143323-8ff49d9fddce/go.mod h1:Jdb+RI7JyzEZOHd1GUuKofwFDKMO/btTa80SdpUpYQw=
github.com/livepeer/go-api-client v0.2.9-0.20220916171125-c13c05817515 h1:3UvLoSvntPi0Z/yW6zskPmZZwA+lnm0pQVIvG/uBnrE=
github.com/livepeer/go-api-client v0.2.9-0.20220916171125-c13c05817515/go.mod h1:Jdb+RI7JyzEZOHd1GUuKofwFDKMO/btTa80SdpUpYQw=
github.com/livepeer/go-livepeer v0.5.31 h1:LcN+qDnqWRws7fdVYc4ucZPVcLQRs2tehUYCQVnlnRw=
github.com/livepeer/go-livepeer v0.5.31/go.mod h1:cpBikcGWApkx0cyR0Ht+uAym7j3uAwXGpPbvaOA8XUU=
github.com/livepeer/joy4 v0.1.2-0.20191121080656-b2fea45cbded/go.mod h1:xkDdm+akniYxVT9KW1Y2Y7Hso6aW+rZObz3nrA9yTHw=
Expand Down
6 changes: 5 additions & 1 deletion internal/app/vodtester/continuous_vod_tester.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,15 @@ func (cvt *continuousVodTester) sendPagerdutyEvent(vt IVodTester, err error) {
}
return
}
summary := fmt.Sprintf("%s:vhs: VOD %s for `%s` error: %v", lopriPrefix, cvt.pagerDutyComponent, cvt.host, err)
if len(summary) > 1024 {
summary = summary[:1021] + "..."
}
event.Payload = &pagerduty.V2Payload{
Source: cvt.host,
Component: cvt.pagerDutyComponent,
Severity: severity,
Summary: fmt.Sprintf("%s:vhs: VOD %s for `%s` error: %v", lopriPrefix, cvt.pagerDutyComponent, cvt.host, err),
Summary: summary,
Timestamp: time.Now().UTC().Format(time.RFC3339),
}
resp, err := pagerduty.ManageEvent(event)
Expand Down
12 changes: 7 additions & 5 deletions internal/app/vodtester/vodtester_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func NewVodTester(gctx context.Context, opts VodTesterOptions) IVodTester {
func (vt *vodTester) Start(fileName string, vodImportUrl string, taskPollDuration time.Duration) (int, error) {
defer vt.cancel()

eg, _ := errgroup.WithContext(vt.ctx)
eg, egCtx := errgroup.WithContext(vt.ctx)

eg.Go(func() error {

Expand Down Expand Up @@ -91,7 +91,6 @@ func (vt *vodTester) Start(fileName string, vodImportUrl string, taskPollDuratio
})

eg.Go(func() error {

err := vt.directUploadTester(fileName, taskPollDuration)

if err != nil {
Expand All @@ -112,13 +111,15 @@ func (vt *vodTester) Start(fileName string, vodImportUrl string, taskPollDuratio

return nil
})

go func() {
<-egCtx.Done()
vt.cancel()
}()
if err := eg.Wait(); err != nil {
return 1, err
}

glog.Info("Done VOD Test")

return 0, nil
}

Expand Down Expand Up @@ -164,7 +165,7 @@ func (vt *vodTester) directUploadTester(fileName string, taskPollDuration time.D
return fmt.Errorf("error opening file=%s: %w", fileName, err)
}

err = vt.lapi.UploadAsset(uploadEndpoint, file)
err = vt.lapi.UploadAsset(vt.ctx, uploadEndpoint, file)
if err != nil {
glog.Errorf("Error uploading file filePath=%s err=%v", fileName, err)
return fmt.Errorf("error uploading for assetId=%s taskId=%s: %w", uploadAsset.ID, uploadTask.ID, err)
Expand All @@ -178,6 +179,7 @@ func (vt *vodTester) directUploadTester(fileName string, taskPollDuration time.D
}

func (vt *vodTester) resumableUploadTester(fileName string, taskPollDuration time.Duration) error {

hostName, _ := os.Hostname()
assetName := fmt.Sprintf("vod_test_upload_resumable_%s_%s", hostName, time.Now().Format("2006-01-02T15:04:05Z07:00"))
requestUpload, err := vt.lapi.RequestUpload(assetName)
Expand Down

0 comments on commit c1e427d

Please sign in to comment.