Skip to content

Commit

Permalink
test: Fix FFMPEG command assert
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricioabreu committed Jan 11, 2024
1 parent 607f0f1 commit e49468d
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 14 deletions.
2 changes: 0 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ type Config struct {
API struct {
URL string
}
AssetsPath string
StaticsPath string
S3 struct {
Endpoint string
Expand Down Expand Up @@ -45,7 +44,6 @@ func NewConfig() *Config {
SecretAccessKey: os.Getenv("S3_SECRET_ACCESS_KEY"),
BucketName: os.Getenv("S3_BUCKET_NAME"),
},
AssetsPath: os.Getenv("ASSETS_PATH"),
StaticsPath: os.Getenv("STATICS_PATH"),
}
}
1 change: 0 additions & 1 deletion internal/mosaic/mosaic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ func TestBuildFFMPEGCommand(t *testing.T) {
"-hls_playlist_type", "event",
"-hls_time", "5",
"-strftime", "1",
"-hls_segment_filename", "hls/mosaicvideo/seg_%s.ts",
"-method", "PUT",
"-http_persistent", "1",
"-sc_threshold", "0",
Expand Down
9 changes: 0 additions & 9 deletions internal/worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package worker

import (
"context"
"os"
"time"

"github.com/mauricioabreu/mosaic-video/internal/config"
Expand All @@ -11,15 +10,7 @@ import (
"github.com/mauricioabreu/mosaic-video/internal/mosaic/command"
)

func createPath(path string) error {
return os.MkdirAll(path, os.ModePerm)
}

func GenerateMosaic(m mosaic.Mosaic, cfg *config.Config, locker locking.Locker, cmdExecutor mosaic.Command, runningProcesses map[string]bool) error {
if err := createPath(cfg.AssetsPath + "/" + m.Name); err != nil {
return err
}

_, exists := runningProcesses[m.Name]
if exists {
return nil
Expand Down
4 changes: 2 additions & 2 deletions internal/worker/worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestGenerateMosaicWhenLockingFails(t *testing.T) {
{URL: "http://example.com/mosaicvideo_2.m3u8"},
},
}
cfg := &config.Config{AssetsPath: "output"}
cfg := &config.Config{}
locker.EXPECT().Obtain(gomock.Any(), "mosaicvideo", gomock.Any()).Return(nil, errors.New("error obtaining lock"))
runningProcesses := make(map[string]bool)

Expand All @@ -38,7 +38,7 @@ func TestGenerateMosaicWhenLockingFails(t *testing.T) {
}

func TestGenerateMosaicWhenExecutingCommandFails(t *testing.T) {
cfg := &config.Config{AssetsPath: "output"}
cfg := &config.Config{}
ctrl := gomock.NewController(t)
locker := mocks.NewMockLocker(ctrl)
mosaic := mosaic.Mosaic{
Expand Down

0 comments on commit e49468d

Please sign in to comment.