Remove RDB compatibility test and data (#27)
This commit is contained in:
parent
788a53a462
commit
09612c9ba5
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -4,7 +4,7 @@ on: [push, pull_request]
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-ubuntu-latest:
|
build-ubuntu-latest:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-22.04
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
#### How to create rdb file for a new ReJSON release?
|
|
||||||
|
|
||||||
e.g., testing RDB compatibility with rejson 2.2.0.
|
|
||||||
|
|
||||||
1. Run docker image redis-stack:
|
|
||||||
```text
|
|
||||||
docker run -d -p 6379:6379 --name rejson redislabs/rejson:2.2.0
|
|
||||||
```
|
|
||||||
2. Load store.json and create a key named "store":
|
|
||||||
```text
|
|
||||||
python3 utils/load_1file_hostport.py tst/integration/data/store.json store
|
|
||||||
```
|
|
||||||
3. Save rdb:
|
|
||||||
```text
|
|
||||||
valkey-cli save
|
|
||||||
```
|
|
||||||
4. Copy out the RDB file:
|
|
||||||
```text
|
|
||||||
docker cp $(docker ps -q):/data/dump.rdb tst/integration/rdb_rejson/rejson-<version>.rdb
|
|
||||||
```
|
|
||||||
5. run test_json_rdb_import.py:
|
|
||||||
```text
|
|
||||||
TEST_PATTERN=test_import_rejson_rdbs make test
|
|
||||||
```
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -34,31 +34,3 @@ class TestRdb(JsonTestCase):
|
|||||||
assert True == client.execute_command('save')
|
assert True == client.execute_command('save')
|
||||||
client.execute_command('FLUSHDB')
|
client.execute_command('FLUSHDB')
|
||||||
assert b'OK' == client.execute_command('DEBUG', 'RELOAD', 'NOSAVE')
|
assert b'OK' == client.execute_command('DEBUG', 'RELOAD', 'NOSAVE')
|
||||||
|
|
||||||
def test_import_rejson_rdbs(self):
|
|
||||||
'''
|
|
||||||
Verify we can load RDBs generated from ReJSON.
|
|
||||||
Each RDB file contains JSON key "store" (data/store.json).
|
|
||||||
'''
|
|
||||||
self.load_rdbs_from_dir('rdb_rejson')
|
|
||||||
|
|
||||||
def load_rdbs_from_dir(self, dir):
|
|
||||||
src_dir = os.getenv('SOURCE_DIR')
|
|
||||||
rdb_dir = f"{src_dir}/tst/integration/{dir}"
|
|
||||||
assert os.path.exists(rdb_dir)
|
|
||||||
for (dirpath, dirnames, filenames) in os.walk(rdb_dir):
|
|
||||||
for filename in filenames:
|
|
||||||
if pathlib.Path(filename).suffix == '.rdb':
|
|
||||||
file_path = os.path.join(dirpath, filename)
|
|
||||||
self.load_rdb_file(file_path, filename)
|
|
||||||
|
|
||||||
def load_rdb_file(self, rdb_path, rdb_name):
|
|
||||||
new_path = os.path.join(self.testdir, rdb_name)
|
|
||||||
os.system(f"cp -f {rdb_path} {new_path}")
|
|
||||||
logging.info(f"Loading RDB file {new_path}")
|
|
||||||
self.client.execute_command(f"config set dbfilename {rdb_name}")
|
|
||||||
self.client.execute_command("debug reload nosave")
|
|
||||||
self.verify_keys_in_rejson_rdb()
|
|
||||||
|
|
||||||
def verify_keys_in_rejson_rdb(self):
|
|
||||||
assert b'["The World Almanac and Book of Facts 2021"]' == self.client.execute_command('json.get', 'store', '$..books[?(@.price>10&&@.price<22&&@.isbn)].title')
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user