Esempio n. 1
0
 def test_nattr_by_prefix(self):
     with self.driver.session("smoke/test_nattr") as session:
         a_guid = helpers.make(session)
         helpers.kattr_put(session, a_guid, "foobar", helpers.string_value("foobar"))
         helpers.kattr_put(session, a_guid, "foobaz", helpers.string_value("foobar"))
         helpers.kattr_put(session, a_guid, "zoobar", helpers.string_value("foobar"))
         answer = session.execute_fetch("attr kls %s \"foo*\"" % (a_guid,))
         if ("foobar" == answer[0][1][1][0]):
             self.assertEqual([["n-attr", [a_guid, ["foobar", "foobaz"]]]], answer)
         else:
             self.assertEqual([["n-attr", [a_guid, ["foobaz", "foobar"]]]], answer)
Esempio n. 2
0
 def test_kattr_with_ttl(self):
     with self.driver.session("smoke/test_kattr") as session:
         ttl    = 5
         a_guid = helpers.make(session)
         helpers.kattr_put(session, a_guid, "foobar", helpers.string_value("foobar"), ttl)
         self.assertEqual("foobar", session.execute_fetch("attr get %s \"foobar\"" % (a_guid,))[0][1][-1])
         helpers.sleep(ttl * 2)
         self.assertIsNone(session.execute_fetch("attr get %s \"foobar\"" % (a_guid,))[0][1][-1])
Esempio n. 3
0
 def test_kattr_types(self):
     with self.driver.session("smoke/test_kattr") as session:
         a_guid = helpers.make(session)
         for (attr_name, attr_txvalue, attr_rxvalue) in [("string", helpers.string_value("value"), "value"),
                                                         ("int32", helpers.int32_value(1), 1),
                                                         ("int64", helpers.int64_value(1), 1),
                                                         ("uint32", helpers.uint32_value(1), 1),
                                                         ("uint64", helpers.uint64_value(1), 1),
                                                         ("double", helpers.double_value(1), 1.0)]:
             helpers.kattr_put(session, a_guid, attr_name, attr_txvalue)
             self.assertEqual([["k-attr", [a_guid, attr_name, attr_rxvalue]]], session.execute_fetch("attr get %s \"%s\"" % (a_guid, attr_name)))