@@ -25,9 +25,12 @@ import (
25
25
26
26
"github.com/stretchr/testify/require"
27
27
apps "k8s.io/api/apps/v1"
28
+ core "k8s.io/api/core/v1"
28
29
"k8s.io/apimachinery/pkg/types"
29
30
30
31
schedulerApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
32
+ schedulerPodApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/pod"
33
+ schedulerPodResourcesApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/pod/resources"
31
34
"github.com/arangodb/kube-arangodb/pkg/operatorV2/operation"
32
35
"github.com/arangodb/kube-arangodb/pkg/util"
33
36
"github.com/arangodb/kube-arangodb/pkg/util/tests"
@@ -202,10 +205,24 @@ func Test_Handler_Profile(t *testing.T) {
202
205
handler := newFakeHandler ()
203
206
204
207
// Arrange
205
- profile := tests .NewMetaObject [* schedulerApi.ArangoProfile ](t , tests .FakeNamespace , "test" , tests .MarkArangoProfileAsReady )
208
+ profile := tests .NewMetaObject [* schedulerApi.ArangoProfile ](t , tests .FakeNamespace , "test" , func (t * testing.T , obj * schedulerApi.ArangoProfile ) {
209
+ obj .Spec .Template = & schedulerApi.ProfileTemplate {
210
+ Pod : & schedulerPodApi.Pod {
211
+ Volumes : & schedulerPodResourcesApi.Volumes {
212
+ Volumes : []core.Volume {
213
+ {
214
+ Name : "test" ,
215
+ VolumeSource : core.VolumeSource {},
216
+ },
217
+ },
218
+ },
219
+ },
220
+ }
221
+ }, tests .MarkArangoProfileAsReady )
206
222
extension := tests .NewMetaObject [* schedulerApi.ArangoSchedulerDeployment ](t , tests .FakeNamespace , "test" ,
207
223
func (t * testing.T , obj * schedulerApi.ArangoSchedulerDeployment ) {
208
224
obj .Spec .Profiles = []string {profile .GetName ()}
225
+ obj .Spec .DeploymentSpec .Replicas = util.NewType [int32 ](10 )
209
226
})
210
227
deployment := tests .NewMetaObject [* apps.Deployment ](t , tests .FakeNamespace , "test" )
211
228
@@ -222,6 +239,11 @@ func Test_Handler_Profile(t *testing.T) {
222
239
tests .RefreshObjects (t , handler .kubeClient , handler .client , & deployment )
223
240
require .NotNil (t , deployment )
224
241
242
+ require .NotNil (t , deployment .Spec .Replicas )
243
+ require .EqualValues (t , 10 , * deployment .Spec .Replicas )
244
+
225
245
require .Len (t , extension .Status .Profiles , 1 )
226
246
require .Equal (t , profile .GetName (), extension .Status .Profiles [0 ])
247
+ require .Len (t , deployment .Spec .Template .Spec .Volumes , 1 )
248
+ require .EqualValues (t , "test" , deployment .Spec .Template .Spec .Volumes [0 ].Name )
227
249
}
0 commit comments