Flamenco/internal/worker/common_test.go
Michael Cook bc7b434121 Always use local time for job compiler timestamp variable
The 'Simple Blender Render' job compiler script uses a `{timestamp}`
variable to determine the render output path. This variable is now set
to the local time, rather than UTC.

This fixes #104219: Unit tests are timezone-dependent

The solution uses Go `time.Local` timezone to satisfy unit tests
assertions using a Mock clock. The timezone of the local workstation
running the tests.
2023-08-23 16:08:01 +02:00

20 lines
371 B
Go

package worker
// SPDX-License-Identifier: GPL-3.0-or-later
import (
"testing"
"time"
"github.com/benbjohnson/clock"
"github.com/stretchr/testify/assert"
)
func mockedClock(t *testing.T) *clock.Mock {
c := clock.NewMock()
now, err := time.ParseInLocation("2006-01-02T15:04:05", "2006-01-02T15:04:05", time.Local)
assert.NoError(t, err)
c.Set(now)
return c
}