@@ -708,7 +708,7 @@ def test_create_cluster_with_non_existent_cluster_template_name(self):
708708
709709 def test_create_cluster_with_cluster_template_name (self ):
710710 modelname = self .cluster_template .name
711- bdict = apiutils .cluster_post_data (cluster_template_id = modelname )
711+ bdict = apiutils .cluster_post_data (name = modelname )
712712 response = self .post_json ('/clusters' , bdict , expect_errors = True )
713713 self .assertEqual ('application/json' , response .content_type )
714714 self .assertEqual (202 , response .status_int )
@@ -767,6 +767,40 @@ def test_create_cluster_with_no_master_count(self):
767767 self .assertEqual ('application/json' , response .content_type )
768768 self .assertEqual (202 , response .status_int )
769769
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+
770804 def test_create_cluster_with_invalid_name (self ):
771805 invalid_names = ['x' * 243 , '123456' , '123456test_cluster' ,
772806 '-test_cluster' , '.test_cluster' , '_test_cluster' , '' ]
@@ -874,7 +908,7 @@ def test_create_cluster_with_multi_images_same_name(self):
874908 self .assertTrue (self .mock_valid_os_res .called )
875909 self .assertEqual (409 , response .status_int )
876910
877- def test_create_cluster_with_on_os_distro_image (self ):
911+ def test_create_cluster_with_no_os_distro_image (self ):
878912 bdict = apiutils .cluster_post_data ()
879913 self .mock_valid_os_res .side_effect = \
880914 exception .OSDistroFieldNotFound ('img' )
0 commit comments