@@ -708,7 +708,7 @@ def test_create_cluster_with_non_existent_cluster_template_name(self):
708
708
709
709
def test_create_cluster_with_cluster_template_name (self ):
710
710
modelname = self .cluster_template .name
711
- bdict = apiutils .cluster_post_data (cluster_template_id = modelname )
711
+ bdict = apiutils .cluster_post_data (name = modelname )
712
712
response = self .post_json ('/clusters' , bdict , expect_errors = True )
713
713
self .assertEqual ('application/json' , response .content_type )
714
714
self .assertEqual (202 , response .status_int )
@@ -767,6 +767,40 @@ def test_create_cluster_with_no_master_count(self):
767
767
self .assertEqual ('application/json' , response .content_type )
768
768
self .assertEqual (202 , response .status_int )
769
769
770
+ def test_create_cluster_with_even_master_count_oldmicroversion (self ):
771
+ bdict = apiutils .cluster_post_data ()
772
+ bdict ['master_count' ] = 2
773
+ response = self .post_json (
774
+ '/clusters' ,
775
+ bdict ,
776
+ expect_errors = True ,
777
+ headers = {"Openstack-Api-Version" : "container-infra 1.9" }
778
+ )
779
+ self .assertEqual ('application/json' , response .content_type )
780
+ self .assertEqual (400 , response .status_int )
781
+ self .assertTrue (response .json ['errors' ])
782
+
783
+ def test_create_cluster_with_even_master_count (self ):
784
+ bdict = apiutils .cluster_post_data ()
785
+ bdict ['master_count' ] = 2
786
+ response = self .post_json (
787
+ '/clusters' ,
788
+ bdict ,
789
+ expect_errors = True ,
790
+ headers = {"Openstack-Api-Version" : "container-infra 1.10" }
791
+ )
792
+ self .assertEqual ('application/json' , response .content_type )
793
+ self .assertEqual (400 , response .status_int )
794
+ self .assertTrue (response .json ['errors' ])
795
+
796
+ def test_create_cluster_with_negative_master_count (self ):
797
+ bdict = apiutils .cluster_post_data ()
798
+ bdict ['master_count' ] = - 1
799
+ response = self .post_json ('/clusters' , bdict , expect_errors = True )
800
+ self .assertEqual ('application/json' , response .content_type )
801
+ self .assertEqual (400 , response .status_int )
802
+ self .assertTrue (response .json ['errors' ])
803
+
770
804
def test_create_cluster_with_invalid_name (self ):
771
805
invalid_names = ['x' * 243 , '123456' , '123456test_cluster' ,
772
806
'-test_cluster' , '.test_cluster' , '_test_cluster' , '' ]
@@ -874,7 +908,7 @@ def test_create_cluster_with_multi_images_same_name(self):
874
908
self .assertTrue (self .mock_valid_os_res .called )
875
909
self .assertEqual (409 , response .status_int )
876
910
877
- def test_create_cluster_with_on_os_distro_image (self ):
911
+ def test_create_cluster_with_no_os_distro_image (self ):
878
912
bdict = apiutils .cluster_post_data ()
879
913
self .mock_valid_os_res .side_effect = \
880
914
exception .OSDistroFieldNotFound ('img' )
0 commit comments