Skip to content

Commit d018935

Browse files
committed
chore: test for Identities in TestSidecarTask_Equal
TODO: Also cover VolumeMounts
1 parent 25dbfe1 commit d018935

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

nomad/structs/services_test.go

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -727,12 +727,23 @@ func TestSidecarTask_Equal(t *testing.T) {
727727
ci.Parallel(t)
728728

729729
original := &SidecarTask{
730-
Name: "sidecar-task-1",
731-
Driver: "docker",
732-
User: "nobody",
733-
Config: map[string]interface{}{"foo": 1},
734-
Env: map[string]string{"color": "blue"},
735-
Resources: &Resources{MemoryMB: 300},
730+
Name: "sidecar-task-1",
731+
Driver: "docker",
732+
User: "nobody",
733+
Config: map[string]interface{}{"foo": 1},
734+
Env: map[string]string{"color": "blue"},
735+
Resources: &Resources{MemoryMB: 300},
736+
Identities: []*WorkloadIdentity{{
737+
Name: "myname",
738+
Audience: []string{"fooaud", "baraud"},
739+
ChangeMode: "signal",
740+
ChangeSignal: "restart",
741+
Env: true,
742+
File: true,
743+
Filepath: "/local/tasktoken",
744+
ServiceName: "foosidecar",
745+
TTL: 1337 * time.Minute,
746+
}},
736747
Meta: map[string]string{"index": "1"},
737748
KillTimeout: pointer.Of(2 * time.Second),
738749
LogConfig: &LogConfig{
@@ -781,6 +792,10 @@ func TestSidecarTask_Equal(t *testing.T) {
781792
try(t, func(s *st) { s.Resources = &Resources{MemoryMB: 200} })
782793
})
783794

795+
t.Run("mod identities", func(t *testing.T) {
796+
try(t, func(s *st) { s.Identities = []*WorkloadIdentity{{Name: "mynewname"}} })
797+
})
798+
784799
t.Run("mod meta", func(t *testing.T) {
785800
try(t, func(s *st) { s.Meta = map[string]string{"index": "2"} })
786801
})

0 commit comments

Comments
 (0)