Esempio n. 1
0
 def test_host_in_cluster(self):
     cls = cook_cluster()
     provider, hp = cook_provider()
     h1 = add_host(hp, provider, 'h10')
     limits = {"source": {"type": "builtin", "name": "host_in_cluster"}}
     self.assertEqual(get_variant(cls, None, limits), [])
     add_host_to_cluster(cls, h1)
     self.assertEqual(get_variant(cls, None, limits), ['h10'])
Esempio n. 2
0
 def test_host_in_cluster_service(self):
     cls = cook_cluster()
     service = cook_service(cls)
     comp1 = cook_component(cls, service, 'Server')
     provider, hp = cook_provider()
     h1 = add_host(hp, provider, 'h10')
     h2 = add_host(hp, provider, 'h11')
     limits = {"source": {"type": "builtin", "name": "host_in_cluster"}}
     self.assertEqual(get_variant(cls, None, limits), [])
     add_host_to_cluster(cls, h1)
     add_host_to_cluster(cls, h2)
     self.assertEqual(get_variant(cls, None, limits), ['h10', 'h11'])
     limits['source']['args'] = {'service': 'QWE'}
     self.assertEqual(get_variant(cls, None, limits), [])
     self.add_hc(cluster=cls, service=service, component=comp1, host=h2)
     self.assertEqual(get_variant(cls, None, limits), [])
     limits['source']['args']['service'] = 'UBER'
     self.assertEqual(get_variant(cls, None, limits), ['h11'])
Esempio n. 3
0
 def test_host_in_cluster_no_host(self):
     cls = cook_cluster()
     limits = {"source": {"type": "builtin", "name": "host_in_cluster"}}
     self.assertEqual(get_variant(cls, None, limits), [])
Esempio n. 4
0
 def test_inline(self):
     limits = {"source": {"type": "inline", "value": [1, 2, 3]}}
     self.assertEqual(get_variant(None, None, limits), [1, 2, 3])