示例#1
0
def test_blob_value():
    """
	Test BLOB values.
	"""
    lib.backup_and_restore(
        lambda context: put_values(lib.SET, "key", BLOB_VALUES), None,
        lambda context: check_values(lib.SET, "key", BLOB_VALUES))
示例#2
0
def test_string_value():
    """
	Test string values.
	"""
    lib.backup_and_restore(
        lambda context: put_values(lib.SET, "key", STRING_VALUES), None,
        lambda context: check_values(lib.SET, "key", STRING_VALUES))
def test_bin_name():
    """
	Test bin names.
	"""
    lib.backup_and_restore(
        lambda context: put_bins(lib.SET, "key", BIN_NAMES, u"foobar"), None,
        lambda context: check_bins(lib.SET, "key", BIN_NAMES, u"foobar"))
def test_string_key_stored():
    """
	Test string keys, store the user key.
	"""
    lib.backup_and_restore(
        lambda context: put_keys(lib.SET, STRING_KEYS, u"foobar", True), None,
        lambda context: check_keys(lib.SET, STRING_KEYS, u"foobar", True))
def test_blob_key_stored():
    """
	Test BLOB keys, store the user key.
	"""
    lib.backup_and_restore(
        lambda context: put_keys(lib.SET, BLOB_KEYS, u"foobar", True), None,
        lambda context: check_keys(lib.SET, BLOB_KEYS, u"foobar", True))
示例#6
0
def test_geo_index():
    """
	Tests geo indexes across all set names, index names, and index paths.
	"""
    lib.backup_and_restore(
        lambda context: create_indexes(lib.create_geo_index), None,
        lambda context: check_indexes(lib.check_geo_index, (0.0, 0.0)))
def test_integer_key_stored():
    """
	Test integer keys, store the user key.
	"""
    lib.backup_and_restore(
        lambda context: put_keys(lib.SET, INTEGER_KEYS, u"foobar", True), None,
        lambda context: check_keys(lib.SET, INTEGER_KEYS, u"foobar", True))
示例#8
0
def test_set_name():
    """
	Test set names.
	"""
    lib.backup_and_restore(
        lambda context: put_sets(SET_NAMES, "key", u"value", u"value"), None,
        lambda context: check_sets(SET_NAMES, "key", u"value", u"value"))
示例#9
0
def test_integer_value():
    """
	Test integer values.
	"""
    lib.backup_and_restore(
        lambda context: put_values(lib.SET, "key", INTEGER_VALUES), None,
        lambda context: check_values(lib.SET, "key", INTEGER_VALUES))
示例#10
0
def test_no_policy():
    """
	Tests restore without any policy options.
	"""
    lib.backup_and_restore(lambda context: fill_bins(),
                           lambda context: prepare_bins(),
                           lambda context: check_bins_no_policy(), None, None)
示例#11
0
def test_string_index():
    """
	Tests string indexes across all set names, index names, and index paths.
	"""
    lib.backup_and_restore(
        lambda context: create_indexes(lib.create_string_index), None,
        lambda context: check_indexes(lib.check_simple_index, u"foobar"))
示例#12
0
def test_geo_value():
    """
	Test geo values.
	"""
    lib.backup_and_restore(
        lambda context: put_values(lib.SET, "key", GEO_VALUES), None,
        lambda context: check_values(lib.SET, "key", GEO_VALUES))
示例#13
0
def test_double_value():
    """
	Test double values.
	"""
    lib.backup_and_restore(
        lambda context: put_values(lib.SET, "key", DOUBLE_VALUES), None,
        lambda context: check_values(lib.SET, "key", DOUBLE_VALUES))
示例#14
0
def test_integer_index():
    """
	Tests integer indexes across all set names, index names, and index paths.
	"""
    lib.backup_and_restore(
        lambda context: create_indexes(lib.create_integer_index), None,
        lambda context: check_indexes(lib.check_simple_index, 12345))
示例#15
0
def test_no_gen():
    """
	Tests restore with --no-generation.
	"""
    lib.backup_and_restore(lambda context: fill_bins(),
                           lambda context: prepare_bins(),
                           lambda context: check_bins_no_gen(), None,
                           ["--no-generation"])
示例#16
0
def test_unique():
    """
	Tests restore with --unique.
	"""
    lib.backup_and_restore(lambda context: fill_bins(),
                           lambda context: prepare_bins(),
                           lambda context: check_bins_unique(), None,
                           ["--unique"])
示例#17
0
def test_list_value():
    """
	Test list values. As they are BLOBs, we don't need that much variation
	here.
	"""
    lib.backup_and_restore(
        lambda context: put_values(lib.SET, "key", LIST_VALUES), None,
        lambda context: check_values(lib.SET, "key", LIST_VALUES))
示例#18
0
def test_blob_key_stored_compact():
    """
	Test BLOB keys, store the user key, pass --compact to backup.
	"""
    lib.backup_and_restore(
        lambda context: put_keys(lib.SET, BLOB_KEYS, u"foobar", True), None,
        lambda context: check_keys(lib.SET, BLOB_KEYS, u"foobar", True),
        ["--compact"])
示例#19
0
def test_blob_value_compact():
    """
	Test BLOB values, pass --compact to backup.
	"""
    lib.backup_and_restore(
        lambda context: put_values(lib.SET, "key", BLOB_VALUES), None,
        lambda context: check_values(lib.SET, "key", BLOB_VALUES),
        ["--compact"])
def test_geo_index():
	"""
	Tests geo indexes across all set names, index names, and index paths.
	"""
	lib.backup_and_restore(
		lambda context: create_indexes(lib.create_geo_index),
		None,
		lambda context: check_indexes(lib.check_geo_index, (0.0, 0.0))
	)
示例#21
0
def test_no_ttl():
	"""
	Test without a TTL.
	"""
	lib.backup_and_restore(
		lambda context: put_ttl(0, None),
		None,
		lambda context: check_ttl(0, None)
	)
def test_string_index():
	"""
	Tests string indexes across all set names, index names, and index paths.
	"""
	lib.backup_and_restore(
		lambda context: create_indexes(lib.create_string_index),
		None,
		lambda context: check_indexes(lib.check_simple_index, u"foobar")
	)
示例#23
0
def test_udf_file():
	"""
	Test UDF files.
	"""
	lib.backup_and_restore(
		lambda context: put_udf_files(context, COMMENTS),
		None,
		check_udf_files
	)
def test_integer_index():
	"""
	Tests integer indexes across all set names, index names, and index paths.
	"""
	lib.backup_and_restore(
		lambda context: create_indexes(lib.create_integer_index),
		None,
		lambda context: check_indexes(lib.check_simple_index, 12345)
	)
示例#25
0
def test_ttl():
	"""
	Test TTL without a delay.
	"""
	lib.backup_and_restore(
		lambda context: put_ttl(1, 100),
		None,
		lambda context: check_ttl(1, (90, 100))
	)
def test_bin_name():
	"""
	Test bin names.
	"""
	lib.backup_and_restore(
		lambda context: put_bins(lib.SET, "key", BIN_NAMES, u"foobar"),
		None,
		lambda context: check_bins(lib.SET, "key", BIN_NAMES, u"foobar")
	)
示例#27
0
def test_integer_key_stored():
	"""
	Test integer keys, store the user key.
	"""
	lib.backup_and_restore(
		lambda context: put_keys(lib.SET, INTEGER_KEYS, u"foobar", True),
		None,
		lambda context: check_keys(lib.SET, INTEGER_KEYS, u"foobar", True)
	)
示例#28
0
def test_string_key_stored():
	"""
	Test string keys, store the user key.
	"""
	lib.backup_and_restore(
		lambda context: put_keys(lib.SET, STRING_KEYS, u"foobar", True),
		None,
		lambda context: check_keys(lib.SET, STRING_KEYS, u"foobar", True)
	)
def test_set_name():
	"""
	Test set names.
	"""
	lib.backup_and_restore(
		lambda context: put_sets(SET_NAMES, "key", u"value", u"value"),
		None,
		lambda context: check_sets(SET_NAMES, "key", u"value", u"value")
	)
示例#30
0
def test_blob_key_stored():
	"""
	Test BLOB keys, store the user key.
	"""
	lib.backup_and_restore(
		lambda context: put_keys(lib.SET, BLOB_KEYS, u"foobar", True),
		None,
		lambda context: check_keys(lib.SET, BLOB_KEYS, u"foobar", True)
	)
def test_string_value():
	"""
	Test string values.
	"""
	lib.backup_and_restore(
		lambda context: put_values(lib.SET, "key", STRING_VALUES),
		None,
		lambda context: check_values(lib.SET, "key", STRING_VALUES)
	)
def test_double_value():
	"""
	Test double values.
	"""
	lib.backup_and_restore(
		lambda context: put_values(lib.SET, "key", DOUBLE_VALUES),
		None,
		lambda context: check_values(lib.SET, "key", DOUBLE_VALUES)
	)
def test_geo_value():
	"""
	Test geo values.
	"""
	lib.backup_and_restore(
		lambda context: put_values(lib.SET, "key", GEO_VALUES),
		None,
		lambda context: check_values(lib.SET, "key", GEO_VALUES)
	)
def test_integer_value():
	"""
	Test integer values.
	"""
	lib.backup_and_restore(
		lambda context: put_values(lib.SET, "key", INTEGER_VALUES),
		None,
		lambda context: check_values(lib.SET, "key", INTEGER_VALUES)
	)
def test_blob_value():
	"""
	Test BLOB values.
	"""
	lib.backup_and_restore(
		lambda context: put_values(lib.SET, "key", BLOB_VALUES),
		None,
		lambda context: check_values(lib.SET, "key", BLOB_VALUES)
	)
示例#36
0
def test_blob_key_stored_compact():
	"""
	Test BLOB keys, store the user key, pass --compact to backup.
	"""
	lib.backup_and_restore(
		lambda context: put_keys(lib.SET, BLOB_KEYS, u"foobar", True),
		None,
		lambda context: check_keys(lib.SET, BLOB_KEYS, u"foobar", True),
		["--compact"]
	)
示例#37
0
def test_ttl_delay_10():
	"""
	Test TTL with a 10 second delay.
	"""
	lib.backup_and_restore(
		lambda context: put_ttl(2, 100),
		None,
		lambda context: check_ttl(2, (80, 90)),
		restore_delay=10
	)
def test_list_value():
	"""
	Test list values. As they are BLOBs, we don't need that much variation
	here.
	"""
	lib.backup_and_restore(
		lambda context: put_values(lib.SET, "key", LIST_VALUES),
		None,
		lambda context: check_values(lib.SET, "key", LIST_VALUES)
	)
def test_blob_value_compact():
	"""
	Test BLOB values, pass --compact to backup.
	"""
	lib.backup_and_restore(
		lambda context: put_values(lib.SET, "key", BLOB_VALUES),
		None,
		lambda context: check_values(lib.SET, "key", BLOB_VALUES),
		["--compact"]
	)
示例#40
0
def test_ldt_replace_no_gen():
	"""
	Tests LDT restore with --replace and --no-generation.
	"""
	lib.backup_and_restore(
		lambda context: fill_ldt_bins(),
		lambda context: prepare_ldt_bins(),
		lambda context: check_ldt_bins_replace_no_gen(),
		None,
		["--replace", "--no-generation"]
	)
def test_no_policy():
	"""
	Tests restore without any policy options.
	"""
	lib.backup_and_restore(
		lambda context: fill_bins(),
		lambda context: prepare_bins(),
		lambda context: check_bins_no_policy(),
		None,
		None
	)
def test_restore_bin_list():
	"""
	Tests the --bin-list restore option.
	"""
	lib.backup_and_restore(
		put_data,
		None,
		lambda context: check_data(context, True, True, True, False, True, True, True),
		None,
		["--bin-list", BIN_NAME_1]
	)
示例#43
0
def test_ldt_no_gen_keep_ldt():
	"""
	Tests LDT restore with --no-generation and --keep-ldt.
	"""
	lib.backup_and_restore(
		lambda context: fill_ldt_bins(),
		lambda context: prepare_ldt_bins(),
		lambda context: check_ldt_bins_no_gen_keep_ldt(),
		None,
		["--no-generation", "--keep-ldt"]
	)
def test_restore_no_udfs():
	"""
	Tests the --no-udfs restore option.
	"""
	lib.backup_and_restore(
		put_data,
		None,
		lambda context: check_data(context, True, True, True, True, True, True, False),
		None,
		["--no-udfs"]
	)
def test_backup_set():
	"""
	Tests the --set backup option.
	"""
	lib.backup_and_restore(
		put_data,
		None,
		lambda context: check_data(context, True, False, True, True, True, False, True),
		["--set", SET_NAME_1],
		None
	)
示例#46
0
def test_ttl_expired():
	"""
	Make sure that expired records are not restored. Works, because we prevent
	asd from expiring records (low-water-pct set to 10).
	"""
	lib.backup_and_restore(
		lambda context: put_ttl(3, 5),
		None,
		lambda context: check_expired(3),
		restore_delay=10
	)
def test_backup_no_indexes():
	"""
	Tests the --no-indexes backup option.
	"""
	lib.backup_and_restore(
		put_data,
		None,
		lambda context: check_data(context, True, True, True, True, False, False, True),
		["--no-indexes"],
		None
	)
def test_no_gen():
	"""
	Tests restore with --no-generation.
	"""
	lib.backup_and_restore(
		lambda context: fill_bins(),
		lambda context: prepare_bins(),
		lambda context: check_bins_no_gen(),
		None,
		["--no-generation"]
	)
def test_no_filter():
	"""
	Tests backup and restore without any filters.
	"""
	lib.backup_and_restore(
		put_data,
		None,
		lambda context: check_data(context, True, True, True, True, True, True, True),
		None,
		None
	)
def test_replace():
	"""
	Tests restore with --replace.
	"""
	lib.backup_and_restore(
		lambda context: fill_bins(),
		lambda context: prepare_bins(),
		lambda context: check_bins_replace(),
		None,
		["--replace"]
	)