@@ -48,20 +48,60 @@ def test_aggregate_show(self):
4848 self .assertEqual (self .NAME + "\n " , raw_output )
4949
5050 def test_aggregate_properties (self ):
51- opts = self .get_opts (['properties' ])
51+ opts = self .get_opts (['name' , ' properties' ])
5252
5353 raw_output = self .openstack (
5454 'aggregate set --property a=b --property c=d ' + self .NAME
5555 )
5656 self .assertEqual ('' , raw_output )
5757
5858 raw_output = self .openstack ('aggregate show ' + self .NAME + opts )
59- self .assertIn ("a ='b', c='d'\n " , raw_output )
59+ self .assertIn (self . NAME + " \n a ='b', c='d'\n " , raw_output )
6060
6161 raw_output = self .openstack (
6262 'aggregate unset --property a ' + self .NAME
6363 )
6464 self .assertEqual ('' , raw_output )
6565
6666 raw_output = self .openstack ('aggregate show ' + self .NAME + opts )
67- self .assertIn ("c='d'\n " , raw_output )
67+ self .assertIn (self .NAME + "\n c='d'\n " , raw_output )
68+
69+ raw_output = self .openstack (
70+ 'aggregate set --property a=b --property c=d ' + self .NAME
71+ )
72+ self .assertEqual ('' , raw_output )
73+
74+ raw_output = self .openstack (
75+ 'aggregate set --no-property ' + self .NAME
76+ )
77+ self .assertEqual ('' , raw_output )
78+
79+ raw_output = self .openstack ('aggregate show ' + self .NAME + opts )
80+ self .assertNotIn ("a='b', c='d'" , raw_output )
81+
82+ def test_aggregate_set (self ):
83+ opts = self .get_opts (["name" , "availability_zone" ])
84+
85+ raw_output = self .openstack (
86+ 'aggregate set --zone Zone_1 ' + self .NAME )
87+ self .assertEqual ("" , raw_output )
88+
89+ raw_output = self .openstack ('aggregate show ' + self .NAME + opts )
90+ self .assertEqual ("Zone_1\n " + self .NAME + "\n " , raw_output )
91+
92+ def test_aggregate_add_and_remove_host (self ):
93+ opts = self .get_opts (["hosts" , "name" ])
94+
95+ raw_output = self .openstack ('host list -f value -c "Host Name"' )
96+ host_name = raw_output .split ()[0 ]
97+
98+ self .openstack (
99+ 'aggregate add host ' + self .NAME + ' ' + host_name )
100+ raw_output = self .openstack ('aggregate show ' + self .NAME + opts )
101+ self .assertEqual ("[u'" + host_name + "']" + "\n " + self .NAME + "\n " ,
102+ raw_output )
103+
104+ self .openstack (
105+ 'aggregate remove host ' + self .NAME + ' ' + host_name )
106+ raw_output = self .openstack ('aggregate show ' + self .NAME + opts )
107+ self .assertEqual ("[]\n " + self .NAME + "\n " , raw_output )
0 commit comments