-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16299 from alexlarsson/quadlet-shortname-warning
quadlet: Warn in generator if using short names
- Loading branch information
Showing
29 changed files
with
150 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestIsUnambiguousName(t *testing.T) { | ||
tests := []struct { | ||
input string | ||
res bool | ||
}{ | ||
// Ambiguous names | ||
{"fedora", false}, | ||
{"fedora:latest", false}, | ||
{"library/fedora", false}, | ||
{"library/fedora:latest", false}, | ||
{"busybox@sha256:d366a4665ab44f0648d7a00ae3fae139d55e32f9712c67accd604bb55df9d05a", false}, | ||
{"busybox:latest@sha256:d366a4665ab44f0648d7a00ae3fae139d55e32f9712c67accd604bb55df9d05a", false}, | ||
{"d366a4665ab44f0648d7a00ae3fae139d55e32f9712c67accd604bb55df9d05", false}, | ||
{"d366a4665ab44f0648d7a00ae3fae139d55e32f9712c67accd604bb55df9d05aa", false}, | ||
|
||
// Unambiguous names | ||
{"quay.io/fedora", true}, | ||
{"docker.io/fedora", true}, | ||
{"docker.io/library/fedora:latest", true}, | ||
{"localhost/fedora", true}, | ||
{"localhost:5000/fedora:latest", true}, | ||
{"example.foo.this.may.be.garbage.but.maybe.not:1234/fedora:latest", true}, | ||
{"docker.io/library/busybox@sha256:d366a4665ab44f0648d7a00ae3fae139d55e32f9712c67accd604bb55df9d05a", true}, | ||
{"docker.io/library/busybox:latest@sha256:d366a4665ab44f0648d7a00ae3fae139d55e32f9712c67accd604bb55df9d05a", true}, | ||
{"docker.io/fedora@sha256:d366a4665ab44f0648d7a00ae3fae139d55e32f9712c67accd604bb55df9d05a", true}, | ||
{"sha256:d366a4665ab44f0648d7a00ae3fae139d55e32f9712c67accd604bb55df9d05a", true}, | ||
{"d366a4665ab44f0648d7a00ae3fae139d55e32f9712c67accd604bb55df9d05a", true}, | ||
} | ||
|
||
for _, test := range tests { | ||
res := isUnambiguousName(test.input) | ||
assert.Equal(t, res, test.res, "%q", test.input) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
## assert-podman-final-args imagename | ||
## assert-podman-final-args localhost/imagename | ||
## assert-podman-args --env "FOO1=foo1" | ||
## assert-podman-args --env "FOO2=foo2 " | ||
## assert-podman-args --env "FOO3=foo3" | ||
## assert-podman-args --env "REPLACE=replaced" | ||
## assert-podman-args --env "FOO4=foo\\nfoo" | ||
|
||
[Container] | ||
Image=imagename | ||
Image=localhost/imagename | ||
Environment=FOO1=foo1 "FOO2=foo2 " \ | ||
FOO3=foo3 REPLACE=replace | ||
Environment=REPLACE=replaced 'FOO4=foo\nfoo' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
## assert-podman-final-args "/some/path" "an arg" "a;b\\nc\\td'e" "a;b\\nc\\td" "a\"b" | ||
|
||
[Container] | ||
Image=imagename | ||
Image=localhost/imagename | ||
Exec=/some/path "an arg" "a;b\nc\td'e" a;b\nc\td 'a"b' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
## assert-podman-final-args imagename "/some/binary file" "--arg1" "arg 2" | ||
## assert-podman-final-args localhost/imagename "/some/binary file" "--arg1" "arg 2" | ||
|
||
[Container] | ||
Image=imagename | ||
Image=localhost/imagename | ||
Exec="/some/binary file" --arg1 \ | ||
"arg 2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
## assert-podman-final-args imagename | ||
## assert-podman-final-args localhost/imagename | ||
|
||
[Container] | ||
Image=imagename | ||
Image=localhost/imagename |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
## assert-podman-args "--name=foobar" | ||
|
||
[Container] | ||
Image=imagename | ||
Image=localhost/imagename | ||
ContainerName=foobar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ | |
## !assert-podman-args --gidmap | ||
|
||
[Container] | ||
Image=imagename | ||
Image=localhost/imagename | ||
RemapUsers=no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
## assert-podman-args "--sdnotify=container" | ||
|
||
[Container] | ||
Image=imagename | ||
Image=localhost/imagename | ||
Notify=yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
## assert-podman-final-args imagename | ||
## assert-podman-final-args localhost/imagename | ||
## assert-key-is "Unit" "Foo" "bar1" "bar2" | ||
## assert-key-is "X-Container" "Image" "imagename" | ||
## assert-key-is "X-Container" "Image" "localhost/imagename" | ||
|
||
[Unit] | ||
Foo=bar1 | ||
Foo=bar2 | ||
|
||
[Container] | ||
Image=imagename | ||
Image=localhost/imagename |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
## assert-stderr-contains "not a fully qualified image name" | ||
|
||
[Container] | ||
Image=shortname |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
## assert-podman-args --tz=foo | ||
|
||
[Container] | ||
Image=imagename | ||
Image=localhost/imagename | ||
Timezone=foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
## assert-podman-final-args imagename | ||
## assert-podman-final-args localhost/imagename | ||
## assert-podman-args "--user" "998:999" | ||
|
||
[Container] | ||
Image=imagename | ||
Image=localhost/imagename | ||
User=998 | ||
Group=999 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters