Exemplo n.º 1
0
 def test_make_parse_nodekey(self):
     """Test make and parse_nodekey."""
     key = make_nodekey(VOLUME_UUID, NODE_UUID)
     self.assertEqual(key, b'%s:%s' % (VOLUME_KEY, NODE_KEY))
     volume_id, node_id = parse_nodekey(key)
     self.assertEqual(volume_id, VOLUME_UUID)
     self.assertEqual(node_id, NODE_UUID)
Exemplo n.º 2
0
 def test_parse_nodekey_unicode(self):
     """parse_nodekey() accepts unicode strings."""
     volume_id, node_id = parse_nodekey(u"%s:%s" % (VOLUME_KEY, NODE_KEY))
     self.assertEqual(volume_id, VOLUME_UUID)
     self.assertEqual(node_id, NODE_UUID)
Exemplo n.º 3
0
 def test_parse_nodekey_with_volume_id(self):
     """parse_nodekey() handles an encoded volume ID and node ID."""
     volume_id, node_id = parse_nodekey("%s:%s" % (VOLUME_KEY, NODE_KEY))
     self.assertEqual(volume_id, VOLUME_UUID)
     self.assertEqual(node_id, NODE_UUID)
Exemplo n.º 4
0
 def test_parse_nodekey(self):
     """parse_nodekey() handles a plain encoded node ID."""
     volume_id, node_id = parse_nodekey(NODE_KEY)
     self.assertEqual(volume_id, None)
     self.assertEqual(node_id, NODE_UUID)
Exemplo n.º 5
0
 def test_parse_nodekey_empty_volume_id(self):
     """parse_nodekey() accepts an empty volume ID component."""
     volume_id, node_id = parse_nodekey(":%s" % NODE_KEY)
     self.assertEqual(volume_id, None)
     self.assertEqual(node_id, NODE_UUID)
Exemplo n.º 6
0
 def get_node_with_key(self, key):
     """Using a nodekey, get the node from the appropriate volume."""
     vol_id, node_id = utils.parse_nodekey(key)
     return self.volume(vol_id).get_node(node_id)