forked from containers/podman
-
Notifications
You must be signed in to change notification settings - Fork 0
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 containers#22057 from jbtrystram/quadlet-image-net…
…work quadlet: Add a network requirement on .image and .containers units
- Loading branch information
Showing
10 changed files
with
79 additions
and
2 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
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
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,7 @@ | ||
## assert-last-key-is-regex "Unit" "After" "^$" | ||
|
||
[Unit] | ||
After= | ||
|
||
[Container] | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## assert-last-key-is-regex "Unit" "After" "^$" | ||
|
||
[Unit] | ||
After= | ||
|
||
[Image] | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -172,6 +172,24 @@ func (t *quadletTestcase) assertKeyIsRegex(args []string, unit *parser.UnitFile) | |
return true | ||
} | ||
|
||
func (t *quadletTestcase) assertLastKeyIsRegex(args []string, unit *parser.UnitFile) bool { | ||
Expect(len(args)).To(BeNumerically(">=", 3)) | ||
group := args[0] | ||
key := args[1] | ||
regex := args[2] | ||
|
||
value, ok := unit.LookupLast(group, key) | ||
if !ok { | ||
return false | ||
} | ||
|
||
matched, err := regexp.MatchString(regex, value) | ||
if err != nil || !matched { | ||
return false | ||
} | ||
return true | ||
} | ||
|
||
func (t *quadletTestcase) assertKeyContains(args []string, unit *parser.UnitFile) bool { | ||
Expect(args).To(HaveLen(3)) | ||
group := args[0] | ||
|
@@ -469,6 +487,8 @@ func (t *quadletTestcase) doAssert(check []string, unit *parser.UnitFile, sessio | |
ok = t.assertKeyIsRegex(args, unit) | ||
case "assert-key-contains": | ||
ok = t.assertKeyContains(args, unit) | ||
case "assert-last-key-is-regex": | ||
ok = t.assertLastKeyIsRegex(args, unit) | ||
case "assert-podman-args": | ||
ok = t.assertStartPodmanArgs(args, unit) | ||
case "assert-podman-args-regex": | ||
|
@@ -847,6 +867,7 @@ BOGUS=foo | |
Entry("merged-override.container", "merged-override.container", 0, ""), | ||
Entry("[email protected]", "[email protected]", 0, ""), | ||
Entry("[email protected]", "[email protected]", 0, ""), | ||
Entry("Unit After Override", "unit-after-override.container", 0, ""), | ||
|
||
Entry("basic.volume", "basic.volume", 0, ""), | ||
Entry("device-copy.volume", "device-copy.volume", 0, ""), | ||
|
@@ -921,6 +942,7 @@ BOGUS=foo | |
Entry("Image - Arch and OS", "arch-os.image", 0, ""), | ||
Entry("Image - global args", "globalargs.image", 0, ""), | ||
Entry("Image - Containers Conf Modules", "containersconfmodule.image", 0, ""), | ||
Entry("Image - Unit After Override", "unit-after-override.image", 0, ""), | ||
|
||
Entry("basic.pod", "basic.pod", 0, ""), | ||
Entry("name.pod", "name.pod", 0, ""), | ||
|