@@ -42,7 +42,7 @@ func TestCreateDeployment(t *testing.T) {
4242 }
4343}
4444
45- func TestCreateDeploymentWithTolerations (t * testing.T ) {
45+ func TestCreateDeploymentWithTolerationsAndNodeSelector (t * testing.T ) {
4646 os .Setenv ("POD_NAMESPACE" , "test-namespace" )
4747 os .Setenv ("IMAGE_REGISTRY" , "test-registry" )
4848 os .Setenv ("IMAGE_REPOSITORY" , "test-repo" )
@@ -55,6 +55,9 @@ func TestCreateDeploymentWithTolerations(t *testing.T) {
5555 Spec : overcommit.OvercommitClassSpec {
5656 Labels : map [string ]string {"key" : "value" },
5757 Annotations : map [string ]string {"annotation-key" : "annotation-value" },
58+ NodeSelector : map [string ]string {
59+ "disktype" : "ssd" ,
60+ },
5861 Tolerations : []corev1.Toleration {
5962 {
6063 Key : "key1" ,
@@ -81,6 +84,9 @@ func TestCreateDeploymentWithTolerations(t *testing.T) {
8184 if deployment .Spec .Template .Spec .Tolerations [0 ].Key != "key1" {
8285 t .Errorf ("Expected toleration key 'key1', got '%s'" , deployment .Spec .Template .Spec .Tolerations [0 ].Key )
8386 }
87+ if val , ok := deployment .Spec .Template .Spec .NodeSelector ["disktype" ]; ! ok || val != "ssd" {
88+ t .Errorf ("Expected node selector 'disktype: ssd', got '%v'" , deployment .Spec .Template .Spec .NodeSelector )
89+ }
8490}
8591
8692func TestCreateService (t * testing.T ) {
0 commit comments