mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
Fix WorkloadIdentity.TTL handling, jobspec2 testing, and hcl1 vs 2 parsing (#19024)
* make the little dots consistent * don't trim delimiter as that over matches * test jobspec2 package * copy api/WorkloadIdentity.TTL -> structs * test ttl parsing * fix hcl1 v 2 parsing mismatch * make jobspec(1) tests match jobspec2 tests
This commit is contained in:
@@ -125,8 +125,8 @@ func isCoveredOne(p string, pkg string) bool {
|
||||
}
|
||||
|
||||
if strings.HasSuffix(p, "/...") {
|
||||
prefix := strings.TrimSuffix(p, "/...")
|
||||
if strings.HasPrefix(pkg, prefix) {
|
||||
prefix := strings.TrimSuffix(p, "...")
|
||||
if strings.HasPrefix(pkg+"/", prefix) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,14 +11,17 @@ import (
|
||||
|
||||
func Test_isCoveredOne(t *testing.T) {
|
||||
try := func(p string, exp bool) {
|
||||
result := isCoveredOne(p, "foo/bar")
|
||||
must.Eq(t, exp, result)
|
||||
t.Run(p, func(t *testing.T) {
|
||||
result := isCoveredOne(p, "foo/bar")
|
||||
must.Eq(t, exp, result)
|
||||
})
|
||||
}
|
||||
try("baz", false)
|
||||
try("foo", false)
|
||||
try("foo/bar/baz", false)
|
||||
try("foo/bar", true)
|
||||
try("foo/bar/...", true)
|
||||
try("foo/b/...", false)
|
||||
try("foo/...", true)
|
||||
try("abc/...", false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user