コード例 #1
0
def check_bins_unique():
	"""
	Verifies restore with --unique.
	"""
	record = lib.read_record(lib.SET, "key-1")[2]
	lib.validate_record("key-1", record, [u"bin-1", u"bin-2"], [u"value-1b", u"value-2b"])
	record = lib.read_record(lib.SET, "key-2")[2]
	lib.validate_record("key-2", record, [u"bin-1", u"bin-2"], [u"value-1b", u"value-2b"])
コード例 #2
0
def check_bins_replace_no_gen():
	"""
	Verifies restore with --replace and --no-generation.
	"""
	record = lib.read_record(lib.SET, "key-1")[2]
	lib.validate_record("key-1", record, [u"bin-1"], [u"value-1a"])
	record = lib.read_record(lib.SET, "key-2")[2]
	lib.validate_record("key-2", record, [u"bin-1"], [u"value-1a"])
コード例 #3
0
def check_bins_no_policy():
	"""
	Verifies restore without any policy options.
	"""
	record = lib.read_record(lib.SET, "key-1")[2]
	lib.validate_record("key-1", record, [u"bin-1", u"bin-2"], [u"value-1a", u"value-2b"])
	record = lib.read_record(lib.SET, "key-2")[2]
	lib.validate_record("key-2", record, [u"bin-1", u"bin-2"], [u"value-1b", u"value-2b"])
コード例 #4
0
def check_ttl(key, expected_ttl):
	"""
	Ensures that the given key has the given TTL.
	"""
	meta_key, meta_ttl, record = lib.read_record(lib.SET, key)
	lib.validate_record(key, record, [u"value"], [u"value"])
	lib.validate_meta(key, meta_key, meta_ttl, False, expected_ttl)
コード例 #5
0
def check_bins(set_name, key, bin_names, value):
	"""
	Ensures that the given key has the given bins with the given value.
	"""
	meta_key, meta_ttl, record = lib.read_record(set_name, key)
	values = [value] * len(bin_names)
	lib.validate_record(key, record, bin_names, values)
	lib.validate_meta(key, meta_key, meta_ttl)
コード例 #6
0
def check_values(set_name, key, values):
	"""
	Ensures that the given key has bins "bin-0" ... "bin-<n>" with the n given values.
	"""
	meta_key, meta_ttl, record = lib.read_record(set_name, key)
	bin_names = [u"bin-" + str(index) for index in xrange(len(values))]
	lib.validate_record(key, record, bin_names, values)
	lib.validate_meta(key, meta_key, meta_ttl)
コード例 #7
0
def check_values(set_name, key, values):
	"""
	Ensures that the given key has bins "bin-0" ... "bin-<n>" with the n given values.
	"""
	meta_key, meta_ttl, record = lib.read_record(set_name, key)
	bin_names = [u"bin-" + str(index) for index in xrange(len(values))]
	lib.validate_record(key, record, bin_names, values)
	lib.validate_meta(key, meta_key, meta_ttl)
コード例 #8
0
def check_bins(set_name, key, bin_names, value):
    """
	Ensures that the given key has the given bins with the given value.
	"""
    meta_key, meta_ttl, record = lib.read_record(set_name, key)
    values = [value] * len(bin_names)
    lib.validate_record(key, record, bin_names, values)
    lib.validate_meta(key, meta_key, meta_ttl)
コード例 #9
0
def check_sets(set_names, key, bin_name, value):
	"""
	Ensures that the given key has the given bin with the given value
	across all given sets.
	"""
	for set_name in set_names:
		meta_key, meta_ttl, record = lib.read_record(set_name, key)
		lib.validate_record(key, record, [bin_name], [value])
		lib.validate_meta(key, meta_key, meta_ttl)
コード例 #10
0
def check_sets(set_names, key, bin_name, value):
    """
	Ensures that the given key has the given bin with the given value
	across all given sets.
	"""
    for set_name in set_names:
        meta_key, meta_ttl, record = lib.read_record(set_name, key)
        lib.validate_record(key, record, [bin_name], [value])
        lib.validate_meta(key, meta_key, meta_ttl)
コード例 #11
0
def check_set(exists, set_name):
	"""
	Verifies that the given set does or doesn't exist.
	"""
	if exists:
		assert lib.test_record(set_name, KEY), "Record %s:%s does not exist" % (set_name, KEY)
		return [lib.read_record(set_name, KEY)]
	else:
		assert not lib.test_record(set_name, KEY), "Unexpected record %s:%s" % (set_name, KEY)
		return []