From b5b6d5fdd5ebd1a2e9f221d6db99d3cf6b583951 Mon Sep 17 00:00:00 2001 From: DvirDukhan Date: Thu, 21 Sep 2023 18:24:08 +0300 Subject: [PATCH] Add tests + arm build (#1) * added .gitignore * tests * arm + test flow * added test flow * fixed runners * poetry * added curl * poetry run RLTest * python 3.8 in poetry * fixed yum matrix * fixed matrix runner in yum tests * python 3.10 * fail-fast is flase * build essential * added `--fix-missing --fix-broken` flags to Install deps * another attempt (explicit libc6 install) * reordering * install python from package manager * -y * curl * remove tls * yum * remove python-* from yum * poetry 1.5.1 for old python3 * yum updates * python3 + old poetry * un-poetry * typo * fixed requirements.txt * rltest remove version * pip3 install * call pip from python3 on yum * unable to find req file in yum * --user * --user in the right place * need to checkout first * order * python3 devel * tidy up * another attempt * attempt to include docker * cleanup * remove leftover poetry * implemented alternative layout * version bump-up * added tests alternative * update image * more cleanup * enabled back deployment * fast print system info * attempt to improve name * cleanup * return of the "if" * added ARM64 * removed ARM64 (for now) * shrink arm machine * increase a bit --------- Co-authored-by: GuyAv46 --- .github/workflows/common-container.yml | 81 ++++++++ .github/workflows/common-flow.yml | 87 ++++++++ .github/workflows/common-runner.yml | 77 +++++++ .github/workflows/makefile.yml | 101 +-------- .github/workflows/self-hosted-arm.yml | 80 +++++++ .github/workflows/tests.yml | 13 ++ .gitignore | 4 + module.c | 2 +- poetry.lock | 277 +++++++++++++++++++++++++ pyproject.toml | 15 ++ rdb/del_graph_x2.rdb | Bin 0 -> 128 bytes rdb/no_graph_x1.rdb | Bin 0 -> 128 bytes requirments.txt | 1 + test_compat.py | 25 +++ 14 files changed, 667 insertions(+), 96 deletions(-) create mode 100644 .github/workflows/common-container.yml create mode 100644 .github/workflows/common-flow.yml create mode 100644 .github/workflows/common-runner.yml create mode 100644 .github/workflows/self-hosted-arm.yml create mode 100644 .github/workflows/tests.yml create mode 100644 .gitignore create mode 100644 poetry.lock create mode 100644 pyproject.toml create mode 100644 rdb/del_graph_x2.rdb create mode 100644 rdb/no_graph_x1.rdb create mode 100644 requirments.txt create mode 100644 test_compat.py diff --git a/.github/workflows/common-container.yml b/.github/workflows/common-container.yml new file mode 100644 index 0000000..a75d178 --- /dev/null +++ b/.github/workflows/common-container.yml @@ -0,0 +1,81 @@ +name: Common flow (container) + +on: + workflow_call: + inputs: + runner: + default: 'ubuntu-latest' + type: string + container: + required: true + type: string + os-nickname: + type: string + REDIS_REF: + type: string + default: '7.2' + deploy: + type: boolean + default: false + dependencies_command: + type: string + python-setup: + type: string + + +jobs: + common-build: + runs-on: ${{ inputs.runner }} + container: ${{ inputs.container }} + steps: + - name: Install Deps + run: | + export DEBIAN_FRONTEND=noninteractive + ${{ inputs.dependencies_command }} + - uses: actions/checkout@v3 + - uses: kenchan0130/actions-system-info@master + id: system-info + - name: Clone Redis + uses: actions/checkout@v3 + with: + repository: 'redis/redis' + ref: ${{ inputs.REDIS_REF }} + path: redis + - name: Install Python + if: ${{ inputs.python-setup }} + uses: actions/setup-python@v4 + with: + python-version: ${{ inputs.python-setup }} + - name: Install Python Dependencies + run: pip3 install -r requirments.txt + - name: Install Redis Server + working-directory: redis + run: make -j `nproc` install + - name: Make + run: make + - name: test + run: RLTest --module bin/rediscompat.so + - name: Rename + if: ${{ inputs.deploy }} + run: mv ./bin/rediscompat.so + ${{ format('{0}.{1}-{2}.{3}.so', + './bin/rediscompat', + inputs.os-nickname || format('{0}-{1}', steps.system-info.outputs.name, steps.system-info.outputs.release), + runner.arch, + '1.0.0') }} + - name: Upload artifact + if: ${{ inputs.deploy }} + uses: actions/upload-artifact@v3 + with: + name: RedisStackStub + path: ./bin + retention-days: 1 + - name: Upload S3 + if: ${{ inputs.deploy }} + uses: shallwefootball/s3-upload-action@master + with: + aws_key_id: ${{ secrets.REDISLABSMODULES_ACCESS_KEY }} + aws_secret_access_key: ${{ secrets.REDISLABSMODULES_SECRET_ACCESS_KEY }} + aws_bucket: 'redismodules' + source_dir: ./bin + destination_dir: rediscompat diff --git a/.github/workflows/common-flow.yml b/.github/workflows/common-flow.yml new file mode 100644 index 0000000..754a4bc --- /dev/null +++ b/.github/workflows/common-flow.yml @@ -0,0 +1,87 @@ +name: Common CI Workflow + +on: + workflow_call: + inputs: + deploy: + type: boolean + default: false + fast-fail: + type: boolean + default: true + + +jobs: + ubuntu-build: + strategy: + fail-fast: ${{ inputs.fast-fail }} + matrix: + os: ["ubuntu:18.04", "ubuntu:20.04", "ubuntu:22.04", "debian:bullseye"] + secrets: inherit + uses: ./.github/workflows/common-container.yml + with: + container: ${{ matrix.os }} + deploy: ${{ inputs.deploy }} + dependencies_command: 'apt update && apt install make gcc build-essential python3 python3-pip curl -y' + + ubuntu-build-arm: + strategy: + fail-fast: ${{ inputs.fast-fail }} + matrix: + os: ["ubuntu:18.04", "ubuntu:20.04", "ubuntu:22.04", "debian:bullseye"] + secrets: inherit + uses: ./.github/workflows/self-hosted-arm.yml + with: + container: ${{ matrix.os }} + deploy: ${{ inputs.deploy }} + dependencies_command: 'apt update && apt install make gcc build-essential python3 python3-pip curl -y' + + yum-flavors: + strategy: + fail-fast: ${{ inputs.fast-fail }} + matrix: + include: + - os: "centos:centos7" + osnick: "centos7" + - os: "amazonlinux:2" + osnick: "amazonlinux" + - os: "rockylinux:8" + osnick: "rockylinux" + secrets: inherit + uses: ./.github/workflows/common-container.yml + with: + container: ${{ matrix.os }} + os-nickname: ${{ matrix.osnick }} + deploy: ${{ inputs.deploy }} + dependencies_command: 'yum install make gcc tar gzip curl python3 python3-devel -y' + + yum-flavors-arm: + strategy: + fail-fast: ${{ inputs.fast-fail }} + matrix: + include: + - os: "centos:centos7" + osnick: "centos7" + - os: "amazonlinux:2" + osnick: "amazonlinux" + - os: "rockylinux:8" + osnick: "rockylinux" + secrets: inherit + uses: ./.github/workflows/self-hosted-arm.yml + with: + container: ${{ matrix.os }} + os-nickname: ${{ matrix.osnick }} + deploy: ${{ inputs.deploy }} + dependencies_command: 'yum install make gcc tar gzip curl python3 python3-devel -y' + + mac-build: + strategy: + fail-fast: ${{ inputs.fast-fail }} + matrix: + runners: [macos-12] + secrets: inherit + uses: ./.github/workflows/common-runner.yml + with: + runner: ${{ matrix.runners }} + python-setup: '3.10' + deploy: ${{ inputs.deploy }} diff --git a/.github/workflows/common-runner.yml b/.github/workflows/common-runner.yml new file mode 100644 index 0000000..c92520b --- /dev/null +++ b/.github/workflows/common-runner.yml @@ -0,0 +1,77 @@ +name: Common flow (runnser) + +on: + workflow_call: + inputs: + runner: + required: true + type: string + os-nickname: + type: string + REDIS_REF: + type: string + default: '7.2' + deploy: + type: boolean + default: false + dependencies_command: + type: string + python-setup: + type: string + + +jobs: + common-build: + runs-on: ${{ inputs.runner }} + steps: + - name: Install Deps + run: | + export DEBIAN_FRONTEND=noninteractive + ${{ inputs.dependencies_command }} + - uses: actions/checkout@v3 + - uses: kenchan0130/actions-system-info@master + id: system-info + - name: Clone Redis + uses: actions/checkout@v3 + with: + repository: 'redis/redis' + ref: ${{ inputs.REDIS_REF }} + path: redis + - name: Install Python + if: ${{ inputs.python-setup }} + uses: actions/setup-python@v4 + with: + python-version: ${{ inputs.python-setup }} + - name: Install Python Dependencies + run: pip3 install -r requirments.txt + - name: Install Redis Server + working-directory: redis + run: make -j `nproc` install + - name: Make + run: make + - name: test + run: RLTest --module bin/rediscompat.so + - name: Rename + if: ${{ inputs.deploy }} + run: mv ./bin/rediscompat.so + ${{ format('{0}.{1}-{2}.{3}.so', + './bin/rediscompat', + inputs.os-nickname || format('{0}-{1}', steps.system-info.outputs.name, steps.system-info.outputs.release), + runner.arch, + '1.0.0') }} + - name: Upload artifact + if: ${{ inputs.deploy }} + uses: actions/upload-artifact@v3 + with: + name: RedisStackStub + path: ./bin + retention-days: 1 + - name: Upload S3 + if: ${{ inputs.deploy }} + uses: shallwefootball/s3-upload-action@master + with: + aws_key_id: ${{ secrets.REDISLABSMODULES_ACCESS_KEY }} + aws_secret_access_key: ${{ secrets.REDISLABSMODULES_SECRET_ACCESS_KEY }} + aws_bucket: 'redismodules' + source_dir: ./bin + destination_dir: rediscompat diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml index 6990e2b..be80edf 100644 --- a/.github/workflows/makefile.yml +++ b/.github/workflows/makefile.yml @@ -6,98 +6,9 @@ on: workflow_dispatch: jobs: - ubuntu-build: - strategy: - matrix: - os: ["ubuntu:18.04", "ubuntu:20.04", "ubuntu:22.04", "debian:bullseye"] - runs-on: ubuntu-latest - container: ${{ matrix.os }} - steps: - - name: apt update - run: apt-get update - - name: Install deps - run: apt-get install make gcc -y - - uses: actions/checkout@v3 - - uses: kenchan0130/actions-system-info@master - id: system-info - - name: Make - run: make - - name: Rename - run: mv ./bin/rediscompat.so ${{format('{0}.{1}-{2}.{3}', './bin/rediscompat', steps.system-info.outputs.name, runner.arch, '1.0.0.so') }} - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: RedisStackStub - path: ./bin - retention-days: 1 - - name: Upload S3 - uses: shallwefootball/s3-upload-action@master - with: - aws_key_id: ${{ secrets.REDISLABSMODULES_ACCESS_KEY }} - aws_secret_access_key: ${{ secrets.REDISLABSMODULES_SECRET_ACCESS_KEY }} - aws_bucket: 'redismodules' - source_dir: ./bin - destination_dir: rediscompat - - yum-flavors: - runs-on: ubuntu-latest - strategy: - matrix: - include: - - os: "centos:centos7" - osnick: "centos7" - - os: "amazonlinux:2" - osnick: "amazonlinux" - - os: "rockylinux:8" - osnick: "rockylinux" - container: ${{ matrix.os }} - steps: - - name: Install deps - run: yum install make gcc tar gzip -y - - uses: actions/checkout@v3 - - name: Make - run: make - - name: Rename - run: mv ./bin/rediscompat.so ${{format('{0}.{1}-{2}.{3}', './bin/rediscompat', matrix.osnick, runner.arch, '1.0.0.so') }} - - name: upload artifact - uses: actions/upload-artifact@v3 - with: - name: Upload artifact - path: ./bin - retention-days: 1 - - name: Upload S3 - uses: shallwefootball/s3-upload-action@master - with: - aws_key_id: ${{ secrets.REDISLABSMODULES_ACCESS_KEY }} - aws_secret_access_key: ${{ secrets.REDISLABSMODULES_SECRET_ACCESS_KEY }} - aws_bucket: 'redismodules' - source_dir: ./bin - destination_dir: rediscompat - - mac-build: - strategy: - matrix: - runners: [macos-12, ARM64] - runs-on: ${{ matrix.runners }} - steps: - - uses: actions/checkout@v3 - - uses: kenchan0130/actions-system-info@master - id: system-info - - name: Make - run: make - - name: Rename - run: mv ./bin/rediscompat.so ${{format('{0}.{1}-{2}.{3}', './bin/rediscompat', steps.system-info.outputs.name, runner.arch, '1.0.0.so') }} - - name: upload artifact - uses: actions/upload-artifact@v3 - with: - name: Upload artifact - path: ./bin - retention-days: 1 - - name: Upload S3 - uses: shallwefootball/s3-upload-action@master - with: - aws_key_id: ${{ secrets.REDISLABSMODULES_ACCESS_KEY }} - aws_secret_access_key: ${{ secrets.REDISLABSMODULES_SECRET_ACCESS_KEY }} - aws_bucket: 'redismodules' - source_dir: ./bin - destination_dir: rediscompat + run-deploy: + uses: ./.github/workflows/common-flow.yml + secrets: inherit + with: + deploy: true + fast-fail: true diff --git a/.github/workflows/self-hosted-arm.yml b/.github/workflows/self-hosted-arm.yml new file mode 100644 index 0000000..72d4e85 --- /dev/null +++ b/.github/workflows/self-hosted-arm.yml @@ -0,0 +1,80 @@ +name: self-hosted ARM flow (container) + +on: + workflow_call: + inputs: + container: + required: true + type: string + os-nickname: + type: string + REDIS_REF: + type: string + deploy: + type: boolean + default: false + dependencies_command: + type: string + +env: + AWS_IMAGE_ID: ami-0d8e10b4bd5d65c57 # Ubuntu 22.04 region AMI for ARM with Docker installed + AWS_INSTANCE_TYPE: t4g.micro + +jobs: + start-runner: + name: Start self-hosted EC2 runner + runs-on: ubuntu-latest + outputs: + label: ${{ steps.start-ec2-runner.outputs.label }} + ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} + steps: + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} + - name: Start EC2 runner + id: start-ec2-runner + uses: machulav/ec2-github-runner@v2 + with: + mode: start + github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} + ec2-image-id: ${{ env.AWS_IMAGE_ID }} + ec2-instance-type: ${{ env.AWS_INSTANCE_TYPE }} + subnet-id: ${{ secrets.AWS_EC2_SUBNET_ID }} + security-group-id: ${{ secrets.AWS_EC2_SG_ID }} + + run: + needs: start-runner # required to start the main job when the runner is ready + uses: ./.github/workflows/common-container.yml + secrets: inherit + with: + REDIS_REF: ${{ inputs.REDIS_REF }} + dependencies_command: ${{ inputs.dependencies_command }} + deploy: ${{ inputs.deploy }} + runner: ${{ needs.start-runner.outputs.label }} + container: ${{ inputs.container }} + os-nickname: ${{ inputs.os-nickname }} + + stop-runner: + name: Stop self-hosted EC2 runner + needs: + - start-runner # required to get output from the start-runner job + - run # required to wait when the main job is done + runs-on: ubuntu-latest + if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs + steps: + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} + - name: Stop EC2 runner + uses: machulav/ec2-github-runner@v2 + with: + mode: stop + github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} + label: ${{ needs.start-runner.outputs.label }} + ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..8ed5c3f --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,13 @@ +name: Tests + +on: + pull_request: + branches: [ "main" ] + +jobs: + run-tests: + uses: ./.github/workflows/common-flow.yml + secrets: inherit + with: + deploy: false + fast-fail: false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e4c5575 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +__pycache__/ +venv/ +bin/ +logs/ \ No newline at end of file diff --git a/module.c b/module.c index 938ca4d..40a30e7 100644 --- a/module.c +++ b/module.c @@ -91,7 +91,7 @@ int RedisModule_OnLoad RedisModuleString **argv, int argc ) { - if(RedisModule_Init(ctx, "RedisStackCompat", 1, REDISMODULE_APIVER_1) + if(RedisModule_Init(ctx, "RedisCompat", 1, REDISMODULE_APIVER_1) == REDISMODULE_ERR) { return REDISMODULE_ERR; } diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..d5f1d87 --- /dev/null +++ b/poetry.lock @@ -0,0 +1,277 @@ +# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. + +[[package]] +name = "async-timeout" +version = "4.0.3" +description = "Timeout context manager for asyncio programs" +optional = false +python-versions = ">=3.7" +files = [ + {file = "async-timeout-4.0.3.tar.gz", hash = "sha256:4640d96be84d82d02ed59ea2b7105a0f7b33abe8703703cd0ab0bf87c427522f"}, + {file = "async_timeout-4.0.3-py3-none-any.whl", hash = "sha256:7405140ff1230c310e51dc27b3145b9092d659ce68ff733fb0cefe3ee42be028"}, +] + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "coverage" +version = "7.3.1" +description = "Code coverage measurement for Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "coverage-7.3.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:cd0f7429ecfd1ff597389907045ff209c8fdb5b013d38cfa7c60728cb484b6e3"}, + {file = "coverage-7.3.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:966f10df9b2b2115da87f50f6a248e313c72a668248be1b9060ce935c871f276"}, + {file = "coverage-7.3.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0575c37e207bb9b98b6cf72fdaaa18ac909fb3d153083400c2d48e2e6d28bd8e"}, + {file = "coverage-7.3.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:245c5a99254e83875c7fed8b8b2536f040997a9b76ac4c1da5bff398c06e860f"}, + {file = "coverage-7.3.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4c96dd7798d83b960afc6c1feb9e5af537fc4908852ef025600374ff1a017392"}, + {file = "coverage-7.3.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:de30c1aa80f30af0f6b2058a91505ea6e36d6535d437520067f525f7df123887"}, + {file = "coverage-7.3.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:50dd1e2dd13dbbd856ffef69196781edff26c800a74f070d3b3e3389cab2600d"}, + {file = "coverage-7.3.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:b9c0c19f70d30219113b18fe07e372b244fb2a773d4afde29d5a2f7930765136"}, + {file = "coverage-7.3.1-cp310-cp310-win32.whl", hash = "sha256:770f143980cc16eb601ccfd571846e89a5fe4c03b4193f2e485268f224ab602f"}, + {file = "coverage-7.3.1-cp310-cp310-win_amd64.whl", hash = "sha256:cdd088c00c39a27cfa5329349cc763a48761fdc785879220d54eb785c8a38520"}, + {file = "coverage-7.3.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:74bb470399dc1989b535cb41f5ca7ab2af561e40def22d7e188e0a445e7639e3"}, + {file = "coverage-7.3.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:025ded371f1ca280c035d91b43252adbb04d2aea4c7105252d3cbc227f03b375"}, + {file = "coverage-7.3.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a6191b3a6ad3e09b6cfd75b45c6aeeffe7e3b0ad46b268345d159b8df8d835f9"}, + {file = "coverage-7.3.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7eb0b188f30e41ddd659a529e385470aa6782f3b412f860ce22b2491c89b8593"}, + {file = "coverage-7.3.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:75c8f0df9dfd8ff745bccff75867d63ef336e57cc22b2908ee725cc552689ec8"}, + {file = "coverage-7.3.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:7eb3cd48d54b9bd0e73026dedce44773214064be93611deab0b6a43158c3d5a0"}, + {file = "coverage-7.3.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:ac3c5b7e75acac31e490b7851595212ed951889918d398b7afa12736c85e13ce"}, + {file = "coverage-7.3.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:5b4ee7080878077af0afa7238df1b967f00dc10763f6e1b66f5cced4abebb0a3"}, + {file = "coverage-7.3.1-cp311-cp311-win32.whl", hash = "sha256:229c0dd2ccf956bf5aeede7e3131ca48b65beacde2029f0361b54bf93d36f45a"}, + {file = "coverage-7.3.1-cp311-cp311-win_amd64.whl", hash = "sha256:c6f55d38818ca9596dc9019eae19a47410d5322408140d9a0076001a3dcb938c"}, + {file = "coverage-7.3.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:5289490dd1c3bb86de4730a92261ae66ea8d44b79ed3cc26464f4c2cde581fbc"}, + {file = "coverage-7.3.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:ca833941ec701fda15414be400c3259479bfde7ae6d806b69e63b3dc423b1832"}, + {file = "coverage-7.3.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cd694e19c031733e446c8024dedd12a00cda87e1c10bd7b8539a87963685e969"}, + {file = "coverage-7.3.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:aab8e9464c00da5cb9c536150b7fbcd8850d376d1151741dd0d16dfe1ba4fd26"}, + {file = "coverage-7.3.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:87d38444efffd5b056fcc026c1e8d862191881143c3aa80bb11fcf9dca9ae204"}, + {file = "coverage-7.3.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:8a07b692129b8a14ad7a37941a3029c291254feb7a4237f245cfae2de78de037"}, + {file = "coverage-7.3.1-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:2829c65c8faaf55b868ed7af3c7477b76b1c6ebeee99a28f59a2cb5907a45760"}, + {file = "coverage-7.3.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:1f111a7d85658ea52ffad7084088277135ec5f368457275fc57f11cebb15607f"}, + {file = "coverage-7.3.1-cp312-cp312-win32.whl", hash = "sha256:c397c70cd20f6df7d2a52283857af622d5f23300c4ca8e5bd8c7a543825baa5a"}, + {file = "coverage-7.3.1-cp312-cp312-win_amd64.whl", hash = "sha256:5ae4c6da8b3d123500f9525b50bf0168023313963e0e2e814badf9000dd6ef92"}, + {file = "coverage-7.3.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:ca70466ca3a17460e8fc9cea7123c8cbef5ada4be3140a1ef8f7b63f2f37108f"}, + {file = "coverage-7.3.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:f2781fd3cabc28278dc982a352f50c81c09a1a500cc2086dc4249853ea96b981"}, + {file = "coverage-7.3.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6407424621f40205bbe6325686417e5e552f6b2dba3535dd1f90afc88a61d465"}, + {file = "coverage-7.3.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:04312b036580ec505f2b77cbbdfb15137d5efdfade09156961f5277149f5e344"}, + {file = "coverage-7.3.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ac9ad38204887349853d7c313f53a7b1c210ce138c73859e925bc4e5d8fc18e7"}, + {file = "coverage-7.3.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:53669b79f3d599da95a0afbef039ac0fadbb236532feb042c534fbb81b1a4e40"}, + {file = "coverage-7.3.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:614f1f98b84eb256e4f35e726bfe5ca82349f8dfa576faabf8a49ca09e630086"}, + {file = "coverage-7.3.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:f1a317fdf5c122ad642db8a97964733ab7c3cf6009e1a8ae8821089993f175ff"}, + {file = "coverage-7.3.1-cp38-cp38-win32.whl", hash = "sha256:defbbb51121189722420a208957e26e49809feafca6afeef325df66c39c4fdb3"}, + {file = "coverage-7.3.1-cp38-cp38-win_amd64.whl", hash = "sha256:f4f456590eefb6e1b3c9ea6328c1e9fa0f1006e7481179d749b3376fc793478e"}, + {file = "coverage-7.3.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:f12d8b11a54f32688b165fd1a788c408f927b0960984b899be7e4c190ae758f1"}, + {file = "coverage-7.3.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:f09195dda68d94a53123883de75bb97b0e35f5f6f9f3aa5bf6e496da718f0cb6"}, + {file = "coverage-7.3.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c6601a60318f9c3945be6ea0f2a80571f4299b6801716f8a6e4846892737ebe4"}, + {file = "coverage-7.3.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:07d156269718670d00a3b06db2288b48527fc5f36859425ff7cec07c6b367745"}, + {file = "coverage-7.3.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:636a8ac0b044cfeccae76a36f3b18264edcc810a76a49884b96dd744613ec0b7"}, + {file = "coverage-7.3.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:5d991e13ad2ed3aced177f524e4d670f304c8233edad3210e02c465351f785a0"}, + {file = "coverage-7.3.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:586649ada7cf139445da386ab6f8ef00e6172f11a939fc3b2b7e7c9082052fa0"}, + {file = "coverage-7.3.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:4aba512a15a3e1e4fdbfed2f5392ec221434a614cc68100ca99dcad7af29f3f8"}, + {file = "coverage-7.3.1-cp39-cp39-win32.whl", hash = "sha256:6bc6f3f4692d806831c136c5acad5ccedd0262aa44c087c46b7101c77e139140"}, + {file = "coverage-7.3.1-cp39-cp39-win_amd64.whl", hash = "sha256:553d7094cb27db58ea91332e8b5681bac107e7242c23f7629ab1316ee73c4981"}, + {file = "coverage-7.3.1-pp38.pp39.pp310-none-any.whl", hash = "sha256:220eb51f5fb38dfdb7e5d54284ca4d0cd70ddac047d750111a68ab1798945194"}, + {file = "coverage-7.3.1.tar.gz", hash = "sha256:6cb7fe1581deb67b782c153136541e20901aa312ceedaf1467dcb35255787952"}, +] + +[package.extras] +toml = ["tomli"] + +[[package]] +name = "distro" +version = "1.8.0" +description = "Distro - an OS platform information API" +optional = false +python-versions = ">=3.6" +files = [ + {file = "distro-1.8.0-py3-none-any.whl", hash = "sha256:99522ca3e365cac527b44bde033f64c6945d90eb9f769703caaec52b09bbd3ff"}, + {file = "distro-1.8.0.tar.gz", hash = "sha256:02e111d1dc6a50abb8eed6bf31c3e48ed8b0830d1ea2a1b78c61765c2513fdd8"}, +] + +[[package]] +name = "exceptiongroup" +version = "1.1.3" +description = "Backport of PEP 654 (exception groups)" +optional = false +python-versions = ">=3.7" +files = [ + {file = "exceptiongroup-1.1.3-py3-none-any.whl", hash = "sha256:343280667a4585d195ca1cf9cef84a4e178c4b6cf2274caef9859782b567d5e3"}, + {file = "exceptiongroup-1.1.3.tar.gz", hash = "sha256:097acd85d473d75af5bb98e41b61ff7fe35efe6675e4f9370ec6ec5126d160e9"}, +] + +[package.extras] +test = ["pytest (>=6)"] + +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + +[[package]] +name = "packaging" +version = "23.1" +description = "Core utilities for Python packages" +optional = false +python-versions = ">=3.7" +files = [ + {file = "packaging-23.1-py3-none-any.whl", hash = "sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61"}, + {file = "packaging-23.1.tar.gz", hash = "sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f"}, +] + +[[package]] +name = "pluggy" +version = "1.3.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pluggy-1.3.0-py3-none-any.whl", hash = "sha256:d89c696a773f8bd377d18e5ecda92b7a3793cbe66c87060a6fb58c7b6e1061f7"}, + {file = "pluggy-1.3.0.tar.gz", hash = "sha256:cf61ae8f126ac6f7c451172cf30e3e43d3ca77615509771b3a984a0730651e12"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + +[[package]] +name = "psutil" +version = "5.8.0" +description = "Cross-platform lib for process and system monitoring in Python." +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +files = [ + {file = "psutil-5.8.0-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:0066a82f7b1b37d334e68697faba68e5ad5e858279fd6351c8ca6024e8d6ba64"}, + {file = "psutil-5.8.0-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:0ae6f386d8d297177fd288be6e8d1afc05966878704dad9847719650e44fc49c"}, + {file = "psutil-5.8.0-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:12d844996d6c2b1d3881cfa6fa201fd635971869a9da945cf6756105af73d2df"}, + {file = "psutil-5.8.0-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:02b8292609b1f7fcb34173b25e48d0da8667bc85f81d7476584d889c6e0f2131"}, + {file = "psutil-5.8.0-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:6ffe81843131ee0ffa02c317186ed1e759a145267d54fdef1bc4ea5f5931ab60"}, + {file = "psutil-5.8.0-cp27-none-win32.whl", hash = "sha256:ea313bb02e5e25224e518e4352af4bf5e062755160f77e4b1767dd5ccb65f876"}, + {file = "psutil-5.8.0-cp27-none-win_amd64.whl", hash = "sha256:5da29e394bdedd9144c7331192e20c1f79283fb03b06e6abd3a8ae45ffecee65"}, + {file = "psutil-5.8.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:74fb2557d1430fff18ff0d72613c5ca30c45cdbfcddd6a5773e9fc1fe9364be8"}, + {file = "psutil-5.8.0-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:74f2d0be88db96ada78756cb3a3e1b107ce8ab79f65aa885f76d7664e56928f6"}, + {file = "psutil-5.8.0-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:99de3e8739258b3c3e8669cb9757c9a861b2a25ad0955f8e53ac662d66de61ac"}, + {file = "psutil-5.8.0-cp36-cp36m-win32.whl", hash = "sha256:36b3b6c9e2a34b7d7fbae330a85bf72c30b1c827a4366a07443fc4b6270449e2"}, + {file = "psutil-5.8.0-cp36-cp36m-win_amd64.whl", hash = "sha256:52de075468cd394ac98c66f9ca33b2f54ae1d9bff1ef6b67a212ee8f639ec06d"}, + {file = "psutil-5.8.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:c6a5fd10ce6b6344e616cf01cc5b849fa8103fbb5ba507b6b2dee4c11e84c935"}, + {file = "psutil-5.8.0-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:61f05864b42fedc0771d6d8e49c35f07efd209ade09a5afe6a5059e7bb7bf83d"}, + {file = "psutil-5.8.0-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:0dd4465a039d343925cdc29023bb6960ccf4e74a65ad53e768403746a9207023"}, + {file = "psutil-5.8.0-cp37-cp37m-win32.whl", hash = "sha256:1bff0d07e76114ec24ee32e7f7f8d0c4b0514b3fae93e3d2aaafd65d22502394"}, + {file = "psutil-5.8.0-cp37-cp37m-win_amd64.whl", hash = "sha256:fcc01e900c1d7bee2a37e5d6e4f9194760a93597c97fee89c4ae51701de03563"}, + {file = "psutil-5.8.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6223d07a1ae93f86451d0198a0c361032c4c93ebd4bf6d25e2fb3edfad9571ef"}, + {file = "psutil-5.8.0-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:d225cd8319aa1d3c85bf195c4e07d17d3cd68636b8fc97e6cf198f782f99af28"}, + {file = "psutil-5.8.0-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:28ff7c95293ae74bf1ca1a79e8805fcde005c18a122ca983abf676ea3466362b"}, + {file = "psutil-5.8.0-cp38-cp38-win32.whl", hash = "sha256:ce8b867423291cb65cfc6d9c4955ee9bfc1e21fe03bb50e177f2b957f1c2469d"}, + {file = "psutil-5.8.0-cp38-cp38-win_amd64.whl", hash = "sha256:90f31c34d25b1b3ed6c40cdd34ff122b1887a825297c017e4cbd6796dd8b672d"}, + {file = "psutil-5.8.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:6323d5d845c2785efb20aded4726636546b26d3b577aded22492908f7c1bdda7"}, + {file = "psutil-5.8.0-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:245b5509968ac0bd179287d91210cd3f37add77dad385ef238b275bad35fa1c4"}, + {file = "psutil-5.8.0-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:90d4091c2d30ddd0a03e0b97e6a33a48628469b99585e2ad6bf21f17423b112b"}, + {file = "psutil-5.8.0-cp39-cp39-win32.whl", hash = "sha256:ea372bcc129394485824ae3e3ddabe67dc0b118d262c568b4d2602a7070afdb0"}, + {file = "psutil-5.8.0-cp39-cp39-win_amd64.whl", hash = "sha256:f4634b033faf0d968bb9220dd1c793b897ab7f1189956e1aa9eae752527127d3"}, + {file = "psutil-5.8.0.tar.gz", hash = "sha256:0c9ccb99ab76025f2f0bbecf341d4656e9c1351db8cc8a03ccd62e318ab4b5c6"}, +] + +[package.extras] +test = ["enum34", "ipaddress", "mock", "pywin32", "unittest2", "wmi"] + +[[package]] +name = "pytest" +version = "7.4.2" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-7.4.2-py3-none-any.whl", hash = "sha256:1d881c6124e08ff0a1bb75ba3ec0bfd8b5354a01c194ddd5a0a870a48d99b002"}, + {file = "pytest-7.4.2.tar.gz", hash = "sha256:a766259cfab564a2ad52cb1aae1b881a75c3eb7e34ca3779697c23ed47c47069"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<2.0" +tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} + +[package.extras] +testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + +[[package]] +name = "pytest-cov" +version = "2.5.0" +description = "Pytest plugin for measuring coverage." +optional = false +python-versions = "*" +files = [ + {file = "pytest-cov-2.5.0.tar.gz", hash = "sha256:f191bf605b0d044c18fcba89fd624135c701600546ac50e51a82fd725e51409d"}, + {file = "pytest_cov-2.5.0-py2.py3-none-any.whl", hash = "sha256:267864bcab5fd16ec8655a0c74194ddaaa879a116d3e1c9d1e0cda0ec849a459"}, +] + +[package.dependencies] +coverage = ">=3.7.1" +pytest = ">=2.6.0" + +[[package]] +name = "redis" +version = "5.0.0" +description = "Python client for Redis database and key-value store" +optional = false +python-versions = ">=3.7" +files = [ + {file = "redis-5.0.0-py3-none-any.whl", hash = "sha256:06570d0b2d84d46c21defc550afbaada381af82f5b83e5b3777600e05d8e2ed0"}, + {file = "redis-5.0.0.tar.gz", hash = "sha256:5cea6c0d335c9a7332a460ed8729ceabb4d0c489c7285b0a86dbbf8a017bd120"}, +] + +[package.dependencies] +async-timeout = {version = ">=4.0.2", markers = "python_full_version <= \"3.11.2\""} + +[package.extras] +hiredis = ["hiredis (>=1.0.0)"] +ocsp = ["cryptography (>=36.0.1)", "pyopenssl (==20.0.1)", "requests (>=2.26.0)"] + +[[package]] +name = "rltest" +version = "0.7.1" +description = "Redis Modules Test Framework, allow to run tests on redis and modules on a variety of environments" +optional = false +python-versions = ">=3.7.0" +files = [ + {file = "rltest-0.7.1-py3-none-any.whl", hash = "sha256:0fdb9bd9f1bfcd6643ea244b445582e34b33b144973dba74ee8d212ecd90a614"}, + {file = "rltest-0.7.1.tar.gz", hash = "sha256:9cc0285718ab36e805f1fc5c18c1c2025d7e6d0d72110266a969603f6dc400ef"}, +] + +[package.dependencies] +distro = ">=1.5.0,<2.0.0" +psutil = "5.8.0" +pytest-cov = "2.5" +redis = ">=5.0.0b3,<6.0.0" + +[[package]] +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, +] + +[metadata] +lock-version = "2.0" +python-versions = "^3.10" +content-hash = "57a46527850b6fe85c4f9e81e4974e5dad887468008c2fbeddcd5caf80f5facd" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..216adfe --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,15 @@ +[tool.poetry] +name = "rediscompat" +version = "0.1.0" +description = "" +authors = ["DvirDukhan "] +readme = "README.md" + +[tool.poetry.dependencies] +python = "^3.8" +rltest = "0.7.1" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/rdb/del_graph_x2.rdb b/rdb/del_graph_x2.rdb new file mode 100644 index 0000000000000000000000000000000000000000..d27707fc5d80cce17484996f246ee0dc6c6058dc GIT binary patch literal 128 zcmWG?b@2=~FfcUy#aWb^l3A=PW?B<82-CM6c99$@(1*tBhB>$SBRJWPyC3=IDmels#KFjgF3 TLXuztO8j5cB-`;$PT~Rp+4(Sq literal 0 HcmV?d00001 diff --git a/rdb/no_graph_x1.rdb b/rdb/no_graph_x1.rdb new file mode 100644 index 0000000000000000000000000000000000000000..392ff2c6ddd07835ad1b785dfe755fe416c9fe13 GIT binary patch literal 128 zcmWG?b@2=~FfcUy#aWb^l3A=kt=HCO@GvnlF);jN_|3?`z*upB T5lMmxDDj`kSm#p2JjLq(LFO@P literal 0 HcmV?d00001 diff --git a/requirments.txt b/requirments.txt new file mode 100644 index 0000000..26710f8 --- /dev/null +++ b/requirments.txt @@ -0,0 +1 @@ +rltest diff --git a/test_compat.py b/test_compat.py new file mode 100644 index 0000000..7705aa5 --- /dev/null +++ b/test_compat.py @@ -0,0 +1,25 @@ +import os +from RLTest import Env + + +def symlink_rdb(rdb_filename, env): + dbDir = env.cmd('config', 'get', 'dir')[1].decode('utf-8') + rdbFilePath = os.path.join(dbDir, rdb_filename) + filePath = os.path.join("./rdb", rdb_filename) + try: + os.unlink(rdbFilePath) + except OSError: + pass + os.symlink(filePath, rdbFilePath) + +def test_nograph(env): + symlink_rdb("no_graph_x1.rdb", env) + env.stop() + env.start() + env.assertEquals("RedisCompat", env.cmd("module", "list")[0][1].decode('utf-8')) + +def test_del_graph(env): + symlink_rdb("del_graph_x2.rdb", env) + env.stop() + env.start() + env.assertEquals("RedisCompat", env.cmd("module", "list")[0][1].decode('utf-8'))