@@ -88,6 +88,190 @@ func TestEnsurePod_ArangoDB_Core(t *testing.T) {
8888 },
8989 },
9090 },
91+ {
92+ Name : "Agent Pod with numactl" ,
93+ ArangoDeployment : & api.ArangoDeployment {
94+ Spec : api.DeploymentSpec {
95+ Image : util.NewType [string ](testImage ),
96+ Authentication : noAuthentication ,
97+ TLS : noTLS ,
98+ ImagePullPolicy : util.NewType [core.PullPolicy ](core .PullAlways ),
99+
100+ Agents : api.ServerGroupSpec {
101+ Numactl : & api.ServerGroupSpecNumactl {
102+ Enabled : util .NewType (true ),
103+ },
104+ },
105+ },
106+ },
107+ Helper : func (t * testing.T , deployment * Deployment , testCase * testCaseStruct ) {
108+ deployment .currentObjectStatus = & api.DeploymentStatus {
109+ Members : api.DeploymentStatusMembers {
110+ Agents : api.MemberStatusList {
111+ firstAgentStatus ,
112+ },
113+ },
114+ Images : createTestImages (false ),
115+ }
116+ testCase .createTestPodData (deployment , api .ServerGroupAgents , firstAgentStatus )
117+ },
118+ ExpectedEvent : "member agent is created" ,
119+ ExpectedPod : core.Pod {
120+ Spec : core.PodSpec {
121+ Volumes : []core.Volume {
122+ k8sutil .CreateVolumeEmptyDir (shared .ArangodVolumeName ),
123+ },
124+ Containers : []core.Container {
125+ {
126+ Name : shared .ServerContainerName ,
127+ Image : testImage ,
128+ Command : util.List [string ]{api .ServerGroupSpecNumactlPathDefault }.
129+ Append (createTestCommandForAgent (firstAgentStatus .ID , false , false , false )... ).
130+ List (),
131+ Ports : createTestPorts (api .ServerGroupAgents ),
132+ VolumeMounts : []core.VolumeMount {
133+ k8sutil .ArangodVolumeMount (),
134+ },
135+ Resources : emptyResources ,
136+ LivenessProbe : createTestLivenessProbe (httpProbe , false , "" , shared .ServerPortName ),
137+ ImagePullPolicy : core .PullAlways ,
138+ SecurityContext : securityContext .NewSecurityContext (),
139+ },
140+ },
141+ RestartPolicy : core .RestartPolicyNever ,
142+ TerminationGracePeriodSeconds : & defaultAgentTerminationTimeout ,
143+ Hostname : testDeploymentName + "-" + api .ServerGroupAgentsString + "-" + firstAgentStatus .ID ,
144+ Subdomain : testDeploymentName + "-int" ,
145+ Affinity : k8sutil .CreateAffinity (testDeploymentName , api .ServerGroupAgentsString ,
146+ false , "" ),
147+ },
148+ },
149+ },
150+ {
151+ Name : "Agent Pod with numactl with opts and override" ,
152+ ArangoDeployment : & api.ArangoDeployment {
153+ Spec : api.DeploymentSpec {
154+ Image : util.NewType [string ](testImage ),
155+ Authentication : noAuthentication ,
156+ TLS : noTLS ,
157+ ImagePullPolicy : util.NewType [core.PullPolicy ](core .PullAlways ),
158+
159+ Agents : api.ServerGroupSpec {
160+ Numactl : & api.ServerGroupSpecNumactl {
161+ Enabled : util .NewType (true ),
162+ Args : []string {
163+ "--example=all" ,
164+ },
165+ Path : util .NewType ("numactl-random-version" ),
166+ },
167+ },
168+ },
169+ },
170+ Helper : func (t * testing.T , deployment * Deployment , testCase * testCaseStruct ) {
171+ deployment .currentObjectStatus = & api.DeploymentStatus {
172+ Members : api.DeploymentStatusMembers {
173+ Agents : api.MemberStatusList {
174+ firstAgentStatus ,
175+ },
176+ },
177+ Images : createTestImages (false ),
178+ }
179+ testCase .createTestPodData (deployment , api .ServerGroupAgents , firstAgentStatus )
180+ },
181+ ExpectedEvent : "member agent is created" ,
182+ ExpectedPod : core.Pod {
183+ Spec : core.PodSpec {
184+ Volumes : []core.Volume {
185+ k8sutil .CreateVolumeEmptyDir (shared .ArangodVolumeName ),
186+ },
187+ Containers : []core.Container {
188+ {
189+ Name : shared .ServerContainerName ,
190+ Image : testImage ,
191+ Command : util.List [string ]{"numactl-random-version" , "--example=all" }.
192+ Append (createTestCommandForAgent (firstAgentStatus .ID , false , false , false )... ).
193+ List (),
194+ Ports : createTestPorts (api .ServerGroupAgents ),
195+ VolumeMounts : []core.VolumeMount {
196+ k8sutil .ArangodVolumeMount (),
197+ },
198+ Resources : emptyResources ,
199+ LivenessProbe : createTestLivenessProbe (httpProbe , false , "" , shared .ServerPortName ),
200+ ImagePullPolicy : core .PullAlways ,
201+ SecurityContext : securityContext .NewSecurityContext (),
202+ },
203+ },
204+ RestartPolicy : core .RestartPolicyNever ,
205+ TerminationGracePeriodSeconds : & defaultAgentTerminationTimeout ,
206+ Hostname : testDeploymentName + "-" + api .ServerGroupAgentsString + "-" + firstAgentStatus .ID ,
207+ Subdomain : testDeploymentName + "-int" ,
208+ Affinity : k8sutil .CreateAffinity (testDeploymentName , api .ServerGroupAgentsString ,
209+ false , "" ),
210+ },
211+ },
212+ },
213+ {
214+ Name : "Agent Pod with numactl with opts" ,
215+ ArangoDeployment : & api.ArangoDeployment {
216+ Spec : api.DeploymentSpec {
217+ Image : util.NewType [string ](testImage ),
218+ Authentication : noAuthentication ,
219+ TLS : noTLS ,
220+ ImagePullPolicy : util.NewType [core.PullPolicy ](core .PullAlways ),
221+
222+ Agents : api.ServerGroupSpec {
223+ Numactl : & api.ServerGroupSpecNumactl {
224+ Enabled : util .NewType (true ),
225+ Args : []string {
226+ "--example=all" ,
227+ },
228+ },
229+ },
230+ },
231+ },
232+ Helper : func (t * testing.T , deployment * Deployment , testCase * testCaseStruct ) {
233+ deployment .currentObjectStatus = & api.DeploymentStatus {
234+ Members : api.DeploymentStatusMembers {
235+ Agents : api.MemberStatusList {
236+ firstAgentStatus ,
237+ },
238+ },
239+ Images : createTestImages (false ),
240+ }
241+ testCase .createTestPodData (deployment , api .ServerGroupAgents , firstAgentStatus )
242+ },
243+ ExpectedEvent : "member agent is created" ,
244+ ExpectedPod : core.Pod {
245+ Spec : core.PodSpec {
246+ Volumes : []core.Volume {
247+ k8sutil .CreateVolumeEmptyDir (shared .ArangodVolumeName ),
248+ },
249+ Containers : []core.Container {
250+ {
251+ Name : shared .ServerContainerName ,
252+ Image : testImage ,
253+ Command : util.List [string ]{api .ServerGroupSpecNumactlPathDefault , "--example=all" }.
254+ Append (createTestCommandForAgent (firstAgentStatus .ID , false , false , false )... ).
255+ List (),
256+ Ports : createTestPorts (api .ServerGroupAgents ),
257+ VolumeMounts : []core.VolumeMount {
258+ k8sutil .ArangodVolumeMount (),
259+ },
260+ Resources : emptyResources ,
261+ LivenessProbe : createTestLivenessProbe (httpProbe , false , "" , shared .ServerPortName ),
262+ ImagePullPolicy : core .PullAlways ,
263+ SecurityContext : securityContext .NewSecurityContext (),
264+ },
265+ },
266+ RestartPolicy : core .RestartPolicyNever ,
267+ TerminationGracePeriodSeconds : & defaultAgentTerminationTimeout ,
268+ Hostname : testDeploymentName + "-" + api .ServerGroupAgentsString + "-" + firstAgentStatus .ID ,
269+ Subdomain : testDeploymentName + "-int" ,
270+ Affinity : k8sutil .CreateAffinity (testDeploymentName , api .ServerGroupAgentsString ,
271+ false , "" ),
272+ },
273+ },
274+ },
91275 {
92276 Name : "Agent Pod with image pull policy" ,
93277 ArangoDeployment : & api.ArangoDeployment {
0 commit comments