@@ -421,6 +421,7 @@ func TestExecutorReconciler_CreateDeployment(t *testing.T) {
421421 },
422422 ObjectMeta : metav1.ObjectMeta {Namespace : "default" , Name : "executor" },
423423 Spec : installv1alpha1.ExecutorSpec {
424+ Replicas : ptr.To [int32 ](2 ), // Max of 1 even if configured higher
424425 CommonSpecBase : installv1alpha1.CommonSpecBase {
425426 Labels : nil ,
426427 Image : installv1alpha1.Image {
@@ -563,3 +564,41 @@ func TestExecutorReconciler_CreateDeployment(t *testing.T) {
563564 t .Fatalf ("deployment is not the same %s" , cmp .Diff (expectedDeployment , deployment , protocmp .Transform ()))
564565 }
565566}
567+
568+ func TestExecutorReconciler_CreateDeploymentScaledDown (t * testing.T ) {
569+ t .Parallel ()
570+
571+ commonConfig := & builders.CommonApplicationConfig {
572+ HTTPPort : 8080 ,
573+ GRPCPort : 5051 ,
574+ MetricsPort : 9000 ,
575+ Profiling : builders.ProfilingConfig {
576+ Port : 1337 ,
577+ },
578+ }
579+
580+ executor := & installv1alpha1.Executor {
581+ TypeMeta : metav1.TypeMeta {
582+ Kind : "Executor" ,
583+ APIVersion : "install.armadaproject.io/v1alpha1" ,
584+ },
585+ ObjectMeta : metav1.ObjectMeta {Namespace : "default" , Name : "executor" },
586+ Spec : installv1alpha1.ExecutorSpec {
587+ Replicas : ptr.To [int32 ](0 ),
588+ CommonSpecBase : installv1alpha1.CommonSpecBase {
589+ Labels : nil ,
590+ Image : installv1alpha1.Image {
591+ Repository : "testrepo" ,
592+ Tag : "1.0.0" ,
593+ },
594+ ApplicationConfig : runtime.RawExtension {},
595+ Resources : & corev1.ResourceRequirements {},
596+ Prometheus : & installv1alpha1.PrometheusConfig {Enabled : true , ScrapeInterval : & metav1.Duration {Duration : 1 * time .Second }},
597+ },
598+ },
599+ }
600+
601+ deployment := createExecutorDeployment (executor , "executor" , commonConfig )
602+
603+ assert .Equal (t , int32 (0 ), * deployment .Spec .Replicas )
604+ }
0 commit comments