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:
@@ -1121,7 +1121,14 @@ func TestIdentity(t *testing.T) {
|
||||
must.NotNil(t, job.TaskGroups[0].Tasks[0].Identity)
|
||||
must.True(t, job.TaskGroups[0].Tasks[0].Identity.Env)
|
||||
must.True(t, job.TaskGroups[0].Tasks[0].Identity.File)
|
||||
|
||||
must.Len(t, 1, job.TaskGroups[0].Tasks[0].Identities)
|
||||
must.Eq(t, "foo", job.TaskGroups[0].Tasks[0].Identities[0].Name)
|
||||
must.Eq(t, []string{"bar"}, job.TaskGroups[0].Tasks[0].Identities[0].Audience)
|
||||
altID := job.TaskGroups[0].Tasks[0].Identities[0]
|
||||
must.Eq(t, "foo", altID.Name)
|
||||
must.Eq(t, []string{"bar"}, altID.Audience)
|
||||
must.True(t, altID.File)
|
||||
must.False(t, altID.Env)
|
||||
must.Eq(t, "signal", altID.ChangeMode)
|
||||
must.Eq(t, "sighup", altID.ChangeSignal)
|
||||
must.Eq(t, 2*time.Hour, altID.TTL)
|
||||
}
|
||||
|
||||
@@ -29,8 +29,12 @@ job "identitycompat" {
|
||||
# ensure parsing handles both the default and alternate identities
|
||||
# properly.
|
||||
identity {
|
||||
name = "foo"
|
||||
aud = ["bar"]
|
||||
name = "foo"
|
||||
aud = ["bar"]
|
||||
file = true
|
||||
ttl = "2h"
|
||||
change_mode = "signal"
|
||||
change_signal = "sighup"
|
||||
}
|
||||
|
||||
resources {
|
||||
|
||||
Reference in New Issue
Block a user