Rename misleading assertion name

Signed-off-by: Dmitry Konishchev <konishchev@gmail.com>
This commit is contained in:
Dmitry Konishchev
2025-10-27 19:23:51 +03:00
parent 5a0b74b13e
commit 23057fd5ed
10 changed files with 33 additions and 33 deletions

View File

@@ -1,7 +1,7 @@
## assert-key-contains Service ExecStart " --opt type=bind " ## assert-last-key-contains Service ExecStart " --opt type=bind "
## assert-key-contains Service ExecStart " --opt device=/var/lib/data " ## assert-last-key-contains Service ExecStart " --opt device=/var/lib/data "
## assert-key-contains Service ExecStart " --opt nocopy " ## assert-last-key-contains Service ExecStart " --opt nocopy "
## assert-key-contains Unit RequiresMountsFor "/var/lib/data" ## assert-last-key-contains Unit RequiresMountsFor "/var/lib/data"
[Volume] [Volume]
Device=/var/lib/data Device=/var/lib/data

View File

@@ -1,7 +1,7 @@
## assert-key-contains Service ExecStart " --opt o=uid=0,gid=11,rw,compress=zstd " ## assert-last-key-contains Service ExecStart " --opt o=uid=0,gid=11,rw,compress=zstd "
## assert-key-contains Service ExecStart " --opt type=btrfs " ## assert-last-key-contains Service ExecStart " --opt type=btrfs "
## assert-key-contains Service ExecStart " --opt device=/dev/vda1 " ## assert-last-key-contains Service ExecStart " --opt device=/dev/vda1 "
## assert-key-contains Service ExecStart " --opt copy " ## assert-last-key-contains Service ExecStart " --opt copy "
[Volume] [Volume]
# Test usernames too # Test usernames too

View File

@@ -1,7 +1,7 @@
## assert-key-contains Service ExecStart " --opt o=uid=0,gid=11,rw,compress=zstd " ## assert-last-key-contains Service ExecStart " --opt o=uid=0,gid=11,rw,compress=zstd "
## assert-key-contains Service ExecStart " --opt type=btrfs " ## assert-last-key-contains Service ExecStart " --opt type=btrfs "
## assert-key-contains Service ExecStart " --opt device=/dev/vda1 " ## assert-last-key-contains Service ExecStart " --opt device=/dev/vda1 "
## assert-key-contains Service ExecStart " --opt nocopy " ## assert-last-key-contains Service ExecStart " --opt nocopy "
[Volume] [Volume]
# Test usernames too # Test usernames too

View File

@@ -2,7 +2,7 @@
## assert-podman-args "--ipv6" ## assert-podman-args "--ipv6"
## assert-key-is Service Type exec ## assert-key-is Service Type exec
## assert-key-is Service RemainAfterExit no ## assert-key-is Service RemainAfterExit no
## assert-key-contains Service SyslogIdentifier "Modify %N" ## assert-last-key-contains Service SyslogIdentifier "Modify %N"
[Network] [Network]
IPv6=yes IPv6=yes

View File

@@ -1,6 +1,6 @@
## assert-key-contains Service ExecStart " --label org.foo.Arg1=arg1 " ## assert-last-key-contains Service ExecStart " --label org.foo.Arg1=arg1 "
## assert-key-contains Service ExecStart " --label org.foo.Arg2=arg2 " ## assert-last-key-contains Service ExecStart " --label org.foo.Arg2=arg2 "
## assert-key-contains Service ExecStart " --label org.foo.Arg3=arg3 " ## assert-last-key-contains Service ExecStart " --label org.foo.Arg3=arg3 "
[Volume] [Volume]
Label=org.foo.Arg1=arg1 Label=org.foo.Arg1=arg1

View File

@@ -1,7 +1,7 @@
## assert-key-contains "Unit" "Wants" "startwithpod_yes.service" ## assert-last-key-contains "Unit" "Wants" "startwithpod_yes.service"
## assert-key-contains "Unit" "Before" "startwithpod_yes.service" ## assert-last-key-contains "Unit" "Before" "startwithpod_yes.service"
## assert-key-not-contains "Unit" "Wants" "startwithpod_no.service" ## assert-last-key-not-contains "Unit" "Wants" "startwithpod_no.service"
## assert-key-not-contains "Unit" "Before" "startwithpod_no.service" ## assert-last-key-not-contains "Unit" "Before" "startwithpod_no.service"
[Pod] [Pod]

View File

@@ -1,5 +1,5 @@
# assert-key-contains "Unit" "After" "startwithpod-pod.service" # assert-last-key-contains "Unit" "After" "startwithpod-pod.service"
# assert-key-contains "Unit" "BindsTo" "startwithpod-pod.service" # assert-last-key-contains "Unit" "BindsTo" "startwithpod-pod.service"
[Container] [Container]
Image=localhost/image Image=localhost/image

View File

@@ -1,5 +1,5 @@
# assert-key-contains "Unit" "After" "startwithpod-pod.service" # assert-last-key-contains "Unit" "After" "startwithpod-pod.service"
# assert-key-contains "Unit" "BindsTo" "startwithpod-pod.service" # assert-last-key-contains "Unit" "BindsTo" "startwithpod-pod.service"
[Container] [Container]
Image=localhost/image Image=localhost/image

View File

@@ -1,7 +1,7 @@
## assert-key-contains Service ExecStart " --opt o=uid=0,gid=11 " ## assert-last-key-contains Service ExecStart " --opt o=uid=0,gid=11 "
## assert-key-is Service Type oneshot ## assert-key-is Service Type oneshot
## assert-key-is Service RemainAfterExit no ## assert-key-is Service RemainAfterExit no
## assert-key-contains Service SyslogIdentifier "Modify %N" ## assert-last-key-contains Service SyslogIdentifier "Modify %N"
[Volume] [Volume]
# Test usernames too # Test usernames too

View File

@@ -219,7 +219,7 @@ func (t *quadletTestcase) assertLastKeyIsRegex(args []string, unit *parser.UnitF
return true return true
} }
func (t *quadletTestcase) assertKeyContains(args []string, unit *parser.UnitFile) bool { func (t *quadletTestcase) assertLastKeyContains(args []string, unit *parser.UnitFile) bool {
Expect(args).To(HaveLen(3)) Expect(args).To(HaveLen(3))
group := args[0] group := args[0]
key := args[1] key := args[1]
@@ -229,8 +229,8 @@ func (t *quadletTestcase) assertKeyContains(args []string, unit *parser.UnitFile
return ok && strings.Contains(realValue, value) return ok && strings.Contains(realValue, value)
} }
func (t *quadletTestcase) assertKeyNotContains(args []string, unit *parser.UnitFile) bool { func (t *quadletTestcase) assertLastKeyNotContains(args []string, unit *parser.UnitFile) bool {
return !t.assertKeyContains(args, unit) return !t.assertLastKeyContains(args, unit)
} }
func (t *quadletTestcase) assertPodmanArgs(args []string, unit *parser.UnitFile, key string, allowRegex, globalOnly bool) bool { func (t *quadletTestcase) assertPodmanArgs(args []string, unit *parser.UnitFile, key string, allowRegex, globalOnly bool) bool {
@@ -544,10 +544,10 @@ func (t *quadletTestcase) doAssert(check []string, unit *parser.UnitFile, sessio
ok = t.assertKeyIsEmpty(args, unit) ok = t.assertKeyIsEmpty(args, unit)
case "assert-key-is-regex": case "assert-key-is-regex":
ok = t.assertKeyIsRegex(args, unit) ok = t.assertKeyIsRegex(args, unit)
case "assert-key-contains": case "assert-last-key-contains":
ok = t.assertKeyContains(args, unit) ok = t.assertLastKeyContains(args, unit)
case "assert-key-not-contains": case "assert-last-key-not-contains":
ok = t.assertKeyNotContains(args, unit) ok = t.assertLastKeyNotContains(args, unit)
case "assert-last-key-is-regex": case "assert-last-key-is-regex":
ok = t.assertLastKeyIsRegex(args, unit) ok = t.assertLastKeyIsRegex(args, unit)
case "assert-podman-args": case "assert-podman-args":