def test_cluster_minions_add_invalid_ip(self): fqdn_ip4 = GrainsManager.get_grain('node1.ceph.com', 'fqdn_ip4') GrainsManager.set_grain('node1.ceph.com', 'fqdn_ip4', ['127.0.0.1']) self.shell.run_cmdline('/Cluster/Minions add node1.ceph.com') self.assertInSysOut( "Host 'node1.ceph.com' FQDN resolves to the loopback interface IP " "address") self.assertIsNone(PillarManager.get('ceph-salt:minions:all')) GrainsManager.set_grain('node1.ceph.com', 'fqdn_ip4', fqdn_ip4)
def setUp(self): super(DeployTest, self).setUp() self.salt_env.minions = ['node1.ceph.com', 'node2.ceph.com'] GrainsManager.set_grain('node1.ceph.com', 'ceph-salt', { 'member': True, 'roles': ['mon'] }) GrainsManager.set_grain('node2.ceph.com', 'ceph-salt', { 'member': True, 'roles': ['mgr'] })
def setUp(self): super(ConfigShellTest, self).setUp() self.shell = CephBootstrapConfigShell() generate_config_shell_tree(self.shell) self.salt_env.minions = [ 'node1.ceph.com', 'node2.ceph.com', 'node3.ceph.com' ] GrainsManager.set_grain('node1.ceph.com', 'fqdn_ip4', ['10.20.39.201']) GrainsManager.set_grain('node2.ceph.com', 'fqdn_ip4', ['10.20.39.202']) GrainsManager.set_grain('node3.ceph.com', 'fqdn_ip4', ['10.20.39.203'])
def test_grains_filter_by(self): GrainsManager.set_grain('node1', 'ceph-salt', { 'member': True, 'roles': ['mon'] }) GrainsManager.set_grain('node2', 'ceph-salt', { 'member': True, 'roles': ['mgr'] }) GrainsManager.set_grain('node3', 'ceph-salt', { 'member': True, 'roles': ['storage'] }) result = GrainsManager.filter_by('ceph-salt:member') self.assertEqual(set(result), {'node1', 'node2', 'node3'})
def setUp(self): super(GrainsManagerTest, self).setUp() GrainsManager.set_grain('test', 'key', 'value')
def test_grains_del(self): GrainsManager.del_grain('test', 'key') self.assertNotInGrains('test', 'key')
def test_grains_get(self): value = GrainsManager.get_grain('test', 'key') self.assertDictEqual(value, {'test': 'value'})