Skip to content

Commit

Permalink
Test: add ci for different redis version
Browse files Browse the repository at this point in the history
  • Loading branch information
yangbodong22011 committed Jun 25, 2023
1 parent f7a1c63 commit fb9802a
Show file tree
Hide file tree
Showing 8 changed files with 247 additions and 1 deletion.
35 changes: 35 additions & 0 deletions .github/workflows/4.0.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 4.0.0

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test-with-redis-4-0-0:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: clone and build redis
run: |
sudo apt-get install git
git clone https://github.com/redis/redis
cd redis
git checkout 4.0
make -j
- name: start redis
run: |
./redis/src/redis-server &
- name: set up python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: install requirements
run: pip install -r requirements.txt

- name: run test
run: python redis_compatibility_test.py --testfile cts.json --specific-version 4.0.0 --show-failed
35 changes: 35 additions & 0 deletions .github/workflows/5.0.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 5.0.0

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test-with-redis-5-0-0:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: clone and build redis
run: |
sudo apt-get install git
git clone https://github.com/redis/redis
cd redis
git checkout 5.0
make -j
- name: start redis
run: |
./redis/src/redis-server &
- name: set up python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: install requirements
run: pip install -r requirements.txt

- name: run test
run: python redis_compatibility_test.py --testfile cts.json --specific-version 5.0.0 --show-failed
35 changes: 35 additions & 0 deletions .github/workflows/6.0.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 6.0.0

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test-with-redis-6-0-0:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: clone and build redis
run: |
sudo apt-get install git
git clone https://github.com/redis/redis
cd redis
git checkout 6.0
make -j
- name: start redis
run: |
./redis/src/redis-server &
- name: set up python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: install requirements
run: pip install -r requirements.txt

- name: run test
run: python redis_compatibility_test.py --testfile cts.json --specific-version 6.0.0 --show-failed
35 changes: 35 additions & 0 deletions .github/workflows/6.2.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 6.2.0

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test-with-redis-6-2-0:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: clone and build redis
run: |
sudo apt-get install git
git clone https://github.com/redis/redis
cd redis
git checkout 6.2
make -j
- name: start redis
run: |
./redis/src/redis-server &
- name: set up python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: install requirements
run: pip install -r requirements.txt

- name: run test
run: python redis_compatibility_test.py --testfile cts.json --specific-version 6.2.0 --show-failed
35 changes: 35 additions & 0 deletions .github/workflows/7.0.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 7.0.0

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test-with-redis-7-0-0:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: clone and build redis
run: |
sudo apt-get install git
git clone https://github.com/redis/redis
cd redis
git checkout 7.0
make -j
- name: start redis
run: |
./redis/src/redis-server &
- name: set up python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: install requirements
run: pip install -r requirements.txt

- name: run test
run: python redis_compatibility_test.py --testfile cts.json --specific-version 7.0.0 --show-failed
35 changes: 35 additions & 0 deletions .github/workflows/7.2.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 7.2.0

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test-with-redis-7-2-0:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: clone and build redis
run: |
sudo apt-get install git
git clone https://github.com/redis/redis
cd redis
git checkout 7.2
make -j
- name: start redis
run: |
./redis/src/redis-server &
- name: set up python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: install requirements
run: pip install -r requirements.txt

- name: run test
run: python redis_compatibility_test.py --testfile cts.json --specific-version 7.2.0 --show-failed
34 changes: 34 additions & 0 deletions .github/workflows/unstable.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: unstable

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test-with-redis-unstable:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: clone and build redis
run: |
sudo apt-get install git
git clone https://github.com/redis/redis
cd redis
make -j
- name: start redis
run: |
./redis/src/redis-server &
- name: set up python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: install requirements
run: pip install -r requirements.txt

- name: run test
run: python redis_compatibility_test.py --testfile cts.json --show-failed
4 changes: 3 additions & 1 deletion redis_compatibility_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@ def report_result():
if args.show_failed and len(failed) != 0:
print(f"This is failed tests for {args.specific_version}:")
print(failed)
exit(-1)
else:
for v, t in sorted(g_results.items()):
print(f"version: {v}, total tests: {t.total}, passed: {t.passed}, "
f"rate: {repr(t.passed / t.total * 100)}%")
if args.show_failed and len(t.failed) != 0:
print(f"This is failed tests for {v}:")
print(t.failed)
exit(-1)


def is_equal(left, right):
Expand Down Expand Up @@ -192,7 +194,7 @@ def parse_args():
parser.add_argument("--password", help="the redis password", default="")
parser.add_argument("--testfile", help="the redis compatibility test cases", required=True)
parser.add_argument("--specific-version", dest="specific_version", help="the redis version",
choices=['1.0.0', '2.8.0', '4.0.0', '5.0.0', '6.0.0', '6.2.0', '7.0.0'])
choices=['1.0.0', '2.8.0', '3.2.0', '4.0.0', '5.0.0', '6.0.0', '6.2.0', '7.0.0', '7.2.0'])
parser.add_argument("--show-failed", dest="show_failed", help="show details of failed tests", default=False,
action="store_true")
parser.add_argument("--cluster", help="server is a node of the Redis cluster", default=False, action="store_true")
Expand Down

0 comments on commit fb9802a

Please sign in to comment.