diff --git a/.github/workflows/publish-egress.yaml b/.github/workflows/publish-egress.yaml index 0b87f447..b19e6fd5 100644 --- a/.github/workflows/publish-egress.yaml +++ b/.github/workflows/publish-egress.yaml @@ -33,7 +33,7 @@ jobs: ~/go/pkg/mod ~/go/bin ~/.cache - key: ${{ runner.os }}-egress-${{ hashFiles('**/go.sum') }} + key: "${{ runner.os }}-egress-${{ hashFiles('**/go.sum') }}" restore-keys: ${{ runner.os }}-egress - name: Docker metadata diff --git a/pkg/pipeline/sink/uploader/azure.go b/pkg/pipeline/sink/uploader/azure.go index 130abd3a..a84e178f 100644 --- a/pkg/pipeline/sink/uploader/azure.go +++ b/pkg/pipeline/sink/uploader/azure.go @@ -19,6 +19,7 @@ import ( "fmt" "net/url" "os" + "path" "github.com/Azure/azure-storage-blob-go/azblob" @@ -88,5 +89,5 @@ func (u *AzureUploader) upload(localFilepath, storageFilepath string, outputType return "", 0, errors.ErrUploadFailed("Azure", err) } - return fmt.Sprintf("%s/%s", u.container, storageFilepath), stat.Size(), nil + return path.Join(u.container, storageFilepath), stat.Size(), nil } diff --git a/test/file.go b/test/file.go index 2257a317..b77dc496 100644 --- a/test/file.go +++ b/test/file.go @@ -17,7 +17,7 @@ package test import ( - "fmt" + "path" "strings" "testing" "time" @@ -77,10 +77,11 @@ func (r *Runner) verifyFile(t *testing.T, p *config.PipelineConfig, res *livekit localPath := fileRes.Filename require.NotEmpty(t, storagePath) require.False(t, strings.Contains(storagePath, "{")) + storageFilename := path.Base(storagePath) // download from cloud storage if uploadConfig := p.GetFileConfig().UploadConfig; uploadConfig != nil { - localPath = fmt.Sprintf("%s/%s", r.FilePrefix, storagePath) + localPath = path.Join(r.FilePrefix, storageFilename) download(t, uploadConfig, localPath, storagePath) download(t, uploadConfig, localPath+".json", storagePath+".json") } diff --git a/test/images.go b/test/images.go index f0165956..645aeaec 100644 --- a/test/images.go +++ b/test/images.go @@ -62,15 +62,15 @@ func (r *Runner) verifyImages(t *testing.T, p *config.PipelineConfig, filenameSu // r.verifyManifest(t, p, segments.PlaylistName) } -//func (r *Runner) verifyManifest(t *testing.T, p *config.PipelineConfig, plName string) { -// localPlaylistPath := fmt.Sprintf("%s/%s", r.FilePrefix, plName) +// func (r *Runner) verifyManifest(t *testing.T, p *config.PipelineConfig, plName string) { +// localPlaylistPath := path.Join(r.FilePrefix, plName) // // if uploadConfig := p.GetSegmentConfig().UploadConfig; uploadConfig != nil { // download(t, uploadConfig, localPlaylistPath+".json", plName+".json") // } -//} +// } -//func (r *Runner) verifySegmentOutput(t *testing.T, p *config.PipelineConfig, filenameSuffix livekit.SegmentedFileSuffix, plName string, plLocation string, segmentCount int, res *livekit.EgressInfo, plType m3u8.PlaylistType) { +// func (r *Runner) verifySegmentOutput(t *testing.T, p *config.PipelineConfig, filenameSuffix livekit.SegmentedFileSuffix, plName string, plLocation string, segmentCount int, res *livekit.EgressInfo, plType m3u8.PlaylistType) { // require.NotEmpty(t, plName) // require.NotEmpty(t, plLocation) @@ -79,14 +79,14 @@ func (r *Runner) verifyImages(t *testing.T, p *config.PipelineConfig, filenameSu // // download from cloud storage // if uploadConfig := p.GetSegmentConfig().UploadConfig; uploadConfig != nil { -// localPlaylistPath = fmt.Sprintf("%s/%s", r.FilePrefix, storedPlaylistPath) +// localPlaylistPath = path.Join(r.FilePrefix, storedPlaylistPath) // download(t, uploadConfig, localPlaylistPath, storedPlaylistPath) // if plType == m3u8.PlaylistTypeEvent { // // Only download segments once // base := storedPlaylistPath[:len(storedPlaylistPath)-5] // for i := 0; i < int(segmentCount); i++ { // cloudPath := fmt.Sprintf("%s_%05d.ts", base, i) -// localPath := fmt.Sprintf("%s/%s", r.FilePrefix, cloudPath) +// localPath := path.Join(r.FilePrefix, cloudPath) // download(t, uploadConfig, localPath, cloudPath) // } // } @@ -94,4 +94,4 @@ func (r *Runner) verifyImages(t *testing.T, p *config.PipelineConfig, filenameSu // verify // verify(t, localPlaylistPath, p, res, types.EgressTypeSegments, r.Muting, r.sourceFramerate, plType == m3u8.PlaylistTypeLive) -//} +// } diff --git a/test/integration.go b/test/integration.go index 0407eea1..f1b6100b 100644 --- a/test/integration.go +++ b/test/integration.go @@ -45,8 +45,6 @@ const ( badStreamUrl2 = "rtmp://localhost:1936/live/stream" redactedBadUrl2 = "rtmp://localhost:1936/live/{st...am}" webUrl = "https://videoplayer-2k23.vercel.app/videos/eminem" - - uploadPrefix = "integration" ) var ( @@ -62,6 +60,8 @@ var ( types.MimeTypeVP8: time.Microsecond * 41708, types.MimeTypeVP9: time.Microsecond * 41708, } + + uploadPrefix = fmt.Sprintf("integration/%s", time.Now().Format("2006-01-02")) ) type testCase struct { diff --git a/test/segments.go b/test/segments.go index 048e097a..78e9c858 100644 --- a/test/segments.go +++ b/test/segments.go @@ -19,6 +19,7 @@ package test import ( "fmt" "os" + "path" "strconv" "strings" "testing" @@ -76,7 +77,7 @@ func (r *Runner) verifySegments(t *testing.T, p *config.PipelineConfig, filename } func (r *Runner) verifyManifest(t *testing.T, p *config.PipelineConfig, plName string) { - localPlaylistPath := fmt.Sprintf("%s/%s", r.FilePrefix, plName) + localPlaylistPath := path.Join(r.FilePrefix, plName) if uploadConfig := p.GetSegmentConfig().UploadConfig; uploadConfig != nil { download(t, uploadConfig, localPlaylistPath+".json", plName+".json") @@ -92,14 +93,14 @@ func (r *Runner) verifySegmentOutput(t *testing.T, p *config.PipelineConfig, fil // download from cloud storage if uploadConfig := p.GetSegmentConfig().UploadConfig; uploadConfig != nil { - localPlaylistPath = fmt.Sprintf("%s/%s", r.FilePrefix, storedPlaylistPath) + localPlaylistPath = path.Join(r.FilePrefix, storedPlaylistPath) download(t, uploadConfig, localPlaylistPath, storedPlaylistPath) if plType == m3u8.PlaylistTypeEvent { // Only download segments once base := storedPlaylistPath[:len(storedPlaylistPath)-5] for i := 0; i < segmentCount; i++ { cloudPath := fmt.Sprintf("%s_%05d.ts", base, i) - localPath := fmt.Sprintf("%s/%s", r.FilePrefix, cloudPath) + localPath := path.Join(r.FilePrefix, cloudPath) download(t, uploadConfig, localPath, cloudPath) } }