@@ -60,45 +60,67 @@ def test_invalid_service(conn, module_args, base_cluster):
6060 service_role_config_group_info .main ()
6161
6262
63- def test_invalid_cluster (conn , module_args , base_cluster , zk_auto ):
63+ def test_invalid_cluster (conn , module_args , base_cluster ):
6464 module_args (
6565 {
6666 ** conn ,
6767 "cluster" : "BOOM" ,
68- "service" : zk_auto . name ,
68+ "service" : "ShouldNotReach" ,
6969 }
7070 )
7171
7272 with pytest .raises (AnsibleFailJson , match = "Cluster does not exist: BOOM" ):
7373 service_role_config_group_info .main ()
7474
7575
76- def test_view_all_role_config_groups (conn , module_args , base_cluster , zk_auto ):
76+ def test_all_role_config_groups (conn , module_args , base_cluster , zk_auto ):
77+ module_args (
78+ {
79+ ** conn ,
80+ "cluster" : base_cluster .name ,
81+ "service" : zk_auto .name ,
82+ }
83+ )
84+
85+ with pytest .raises (AnsibleExitJson ) as e :
86+ service_role_config_group_info .main ()
87+
88+ # Should be only one BASE for the SERVER
89+ assert len (e .value .role_config_groups ) == 1
90+ assert e .value .role_config_groups [0 ]["base" ] == True
91+
92+
93+ def test_type_role_config_group (conn , module_args , base_cluster , zk_auto ):
7794 module_args (
7895 {
7996 ** conn ,
8097 "cluster" : base_cluster .name ,
8198 "service" : zk_auto .name ,
99+ "type" : "SERVER" ,
82100 }
83101 )
84102
85103 with pytest .raises (AnsibleExitJson ) as e :
86104 service_role_config_group_info .main ()
87105
88- assert len (e .value .role_config_groups ) > 0
106+ # Should be only one BASE for the SERVER
107+ assert len (e .value .role_config_groups ) == 1
108+ assert e .value .role_config_groups [0 ]["base" ] == True
89109
90110
91- def test_view_service_role (conn , module_args , base_cluster , zk_auto ):
111+ def test_name_role_config_group (conn , module_args , base_cluster , zk_auto ):
92112 module_args (
93113 {
94114 ** conn ,
95115 "cluster" : base_cluster .name ,
96116 "service" : zk_auto .name ,
97- "name" : "hdfs-GATEWAY -BASE" ,
117+ "name" : "zookeeper-SERVER -BASE" ,
98118 }
99119 )
100120
101121 with pytest .raises (AnsibleExitJson ) as e :
102122 service_role_config_group_info .main ()
103123
124+ # Should be only one BASE for the SERVER
104125 assert len (e .value .role_config_groups ) == 1
126+ assert e .value .role_config_groups [0 ]["base" ] == True
0 commit comments