Run Flamenco Unit Tests in the local timezone #104236
@ -57,7 +57,8 @@ func exampleSubmittedJob() api.SubmittedJob {
|
||||
|
||||
func mockedClock(t *testing.T) clock.Clock {
|
||||
c := clock.NewMock()
|
||||
now, err := time.Parse(time.RFC3339, "2006-01-02T15:04:05+07:00")
|
||||
//current_location, err := time.LoadLocation("Local")
|
||||
|
||||
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
|
||||
@ -250,13 +251,13 @@ func TestSimpleBlenderRenderOutputPathFieldReplacement(t *testing.T) {
|
||||
require.NotNil(t, aj)
|
||||
|
||||
// The job compiler should have replaced the {timestamp} and {ext} fields.
|
||||
assert.Equal(t, "/root/2006-01-02_090405/jobname/######", aj.Settings["render_output_path"])
|
||||
dr.sybren marked this conversation as resolved
Sybren A. Stüvel
commented
This was intentionally using a mocked clock in a different timezone, and ensuring that the created timestamp is in UTC. By moving this all to the local timezone, the test semantics are changed. This was intentionally using a mocked clock in a different timezone, and ensuring that the created timestamp is in UTC. By moving this all to the local timezone, the test semantics are changed.
MichaelC
commented
I did wonder about that but moved it to local timezone. I didn't realise it was intentionally a timezone test. I can fix that back up to test UTC timestamps. I did wonder about that but moved it to local timezone. I didn't realise it was intentionally a timezone test. I can fix that back up to test UTC timestamps.
|
||||
assert.Equal(t, "/root/2006-01-02_150405/jobname/######", aj.Settings["render_output_path"])
|
||||
|
||||
// Tasks should have been created to render the frames: 1-3, 4-6, 7-9, 10, and video-encoding
|
||||
require.Len(t, aj.Tasks, 5)
|
||||
t0 := aj.Tasks[0]
|
||||
expectCliArgs := []interface{}{ // They are strings, but Goja doesn't know that and will produce an []interface{}.
|
||||
"--render-output", "/root/2006-01-02_090405/jobname/######",
|
||||
"--render-output", "/root/2006-01-02_150405/jobname/######",
|
||||
"--render-format", sj.Settings.AdditionalProperties["format"].(string),
|
||||
"--render-frame", "1..3",
|
||||
}
|
||||
@ -271,8 +272,8 @@ func TestSimpleBlenderRenderOutputPathFieldReplacement(t *testing.T) {
|
||||
tVideo := aj.Tasks[4] // This should be a video encoding task
|
||||
assert.EqualValues(t, AuthoredCommandParameters{
|
||||
"exe": "ffmpeg",
|
||||
"inputGlob": "/root/2006-01-02_090405/jobname/*.png",
|
||||
"outputFile": "/root/2006-01-02_090405/jobname/scene123-1-10.mp4",
|
||||
"inputGlob": "/root/2006-01-02_150405/jobname/*.png",
|
||||
"outputFile": "/root/2006-01-02_150405/jobname/scene123-1-10.mp4",
|
||||
"fps": int64(24),
|
||||
"args": expectedFramesToVideoArgs,
|
||||
}, tVideo.Commands[0].Parameters)
|
||||
|
@ -269,7 +269,7 @@ func testFixtures(t *testing.T) (*SleepScheduler, TestMocks, context.Context) {
|
||||
ctx := context.Background()
|
||||
|
||||
mockedClock := clock.NewMock()
|
||||
mockedNow, err := time.Parse(time.RFC3339, "2022-06-07T11:14:47+02:00")
|
||||
mockedNow, err := time.ParseInLocation("2006-01-02T15:04:05", "2022-06-07T11:14:47", time.Local)
|
||||
Sybren A. Stüvel
commented
The sleep scheduler should work well (that is, always treat the schedule as local time), regardless of whether the mocked clock is set to local time or not. I've taken the liberty of addressing this myself in The sleep scheduler should work well (that is, always treat the schedule as local time), regardless of whether the mocked clock is set to local time or not. I've taken the liberty of addressing this myself in eb9f46dc9b5212e99d44899e0c298f17610f2a24, so this change can be removed from this PR.
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
|
||||
func mockedClock(t *testing.T) *clock.Mock {
|
||||
c := clock.NewMock()
|
||||
now, err := time.Parse(time.RFC3339, "2006-01-02T15:04:05+07:00")
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user
Please remove the commented-out code.