def test_tattr_with_ttl(self): with self.driver.session("smoke/test_tattr") as session: ttl = 5 a_guid = helpers.make(session) helpers.tattr_put(session, a_guid, "cpuidle", 0, helpers.int32_value(1), ttl) self.assertEqual([[0.0, 1]], session.execute_fetch("attr get %s \"cpuidle\" [0:1]" % (a_guid,))[0][1][-1]) helpers.sleep(ttl * 2) self.assertEqual([], session.execute_fetch("attr get %s \"cpuidle\" [0:1]" % (a_guid,))[0][1][-1])
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)))