Skip to content

Commit

Permalink
don't capture the '-dev' in version checks; tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cpoile committed Feb 13, 2024
1 parent 2a4e566 commit 4b859e5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions public/job/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
}

Expand Down
29 changes: 29 additions & 0 deletions public/job/job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 4b859e5

Please sign in to comment.