From 4b859e5b4ca668da650ae844eec4129d88295eee Mon Sep 17 00:00:00 2001 From: Christopher Poile Date: Tue, 13 Feb 2024 09:44:31 -0500 Subject: [PATCH] don't capture the '-dev' in version checks; tests --- public/job/job.go | 4 ++-- public/job/job_test.go | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/public/job/job.go b/public/job/job.go index d3b9117..454fe40 100644 --- a/public/job/job.go +++ b/public/job/job.go @@ -79,11 +79,11 @@ func RunnerIsValid(runner, registry string) error { } recorderRunnerREs := []*regexp.Regexp{ - regexp.MustCompile(fmt.Sprintf(`^%s/%s:v((?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-dev)?)$`, registry, RecordingJobPrefix)), + regexp.MustCompile(fmt.Sprintf(`^%s/%s:v((?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*))(?:-dev)?$`, registry, RecordingJobPrefix)), regexp.MustCompile(fmt.Sprintf(`^%s/%s-daily:v((?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*))-dev$`, registry, RecordingJobPrefix)), } transcriberRunnerREs := []*regexp.Regexp{ - regexp.MustCompile(fmt.Sprintf(`^%s/%s:v((?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-dev)?)$`, registry, TranscribingJobPrefix)), + regexp.MustCompile(fmt.Sprintf(`^%s/%s:v((?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*))(?:-dev)?$`, registry, TranscribingJobPrefix)), regexp.MustCompile(fmt.Sprintf(`^%s/%s-daily:v((?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*))-dev$`, registry, TranscribingJobPrefix)), } diff --git a/public/job/job_test.go b/public/job/job_test.go index 29c2261..f8c2a83 100644 --- a/public/job/job_test.go +++ b/public/job/job_test.go @@ -118,6 +118,26 @@ func TestJobConfigIsValid(t *testing.T) { }, registry: ImageRegistryDefault, }, + { + name: "valid -dev build", + cfg: Config{ + Type: TypeRecording, + Runner: "mattermost/calls-recorder:v" + MinSupportedRecorderVersion + "-dev", + InputData: recorderCfg.ToMap(), + MaxDurationSec: 60, + }, + registry: ImageRegistryDefault, + }, + { + name: "valid -dev build, transcriber", + cfg: Config{ + Type: TypeRecording, + Runner: "mattermost/calls-transcriber:v" + MinSupportedTranscriberVersion + "-dev", + InputData: recorderCfg.ToMap(), + MaxDurationSec: 60, + }, + registry: ImageRegistryDefault, + }, { name: "valid daily", cfg: Config{ @@ -172,6 +192,15 @@ func TestServiceConfigIsValid(t *testing.T) { }, }, }, + { + name: "valid -dev config", + cfg: ServiceConfig{ + Runners: []string{ + "mattermost/calls-recorder:v" + MinSupportedRecorderVersion + "-dev", + "mattermost/calls-transcriber:v" + MinSupportedTranscriberVersion + "-dev", + }, + }, + }, } for _, tc := range tcs {