1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-08 03:31:59 +02:00

test: docker image template test cases

for #2281

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos A Becker 2021-06-04 00:12:47 +00:00
parent aa518027b4
commit e25b6bb313
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940

View File

@ -399,6 +399,48 @@ func TestRunPipe(t *testing.T) {
pubAssertError: shouldNotErr,
manifestAssertError: shouldNotErr,
},
"image template with env": {
env: map[string]string{
"FOO": "test_run_pipe_template",
},
dockers: []config.Docker{
{
ImageTemplates: []string{
registry + "goreleaser/{{.Env.FOO}}:{{.Tag}}",
},
Goos: "linux",
Goarch: "amd64",
Dockerfile: "testdata/Dockerfile",
},
},
expect: []string{
registry + "goreleaser/test_run_pipe_template:v1.0.0",
},
assertImageLabels: noLabels,
assertError: shouldNotErr,
pubAssertError: shouldNotErr,
manifestAssertError: shouldNotErr,
},
"image template uppercase": {
env: map[string]string{
"FOO": "test_run_pipe_template_UPPERCASE",
},
dockers: []config.Docker{
{
ImageTemplates: []string{
registry + "goreleaser/{{.Env.FOO}}:{{.Tag}}",
},
Goos: "linux",
Goarch: "amd64",
Dockerfile: "testdata/Dockerfile",
},
},
expect: []string{},
assertImageLabels: noLabels,
assertError: shouldErr(`goreleaser/test_run_pipe_template_UPPERCASE:v1.0.0" for "-t, --tag" flag: invalid reference format: repository name must be lowercase`),
pubAssertError: shouldNotErr,
manifestAssertError: shouldNotErr,
},
"empty image tag": {
dockers: []config.Docker{
{