This repository was archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
E2E Testing #12
Open
fahrinh
wants to merge
55
commits into
master
Choose a base branch
from
test/e2e
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
E2E Testing #12
Changes from all commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
a4c7516
gitignore: ignore e2e virtual env
fahrinh eb31529
add test/e2e/README.md
fahrinh d941d3b
.vscode/settings.json for E2E testing in python
fahrinh ca8bc2c
E2E Testing WIP
fahrinh 199b739
Makefile: e2e-test target
fahrinh edc8e75
Add remiro Dockerfile
fahrinh 913319d
Fix E2E Makefile
fahrinh 0394759
WIP
fahrinh 8885198
E2E Readme: Using redis-py as Redis client
fahrinh f03e2d7
Merge from master
fahrinh 14da994
README: Fix linting error
fahrinh abad317
WIP #1
fahrinh 06f3113
WIP #2
fahrinh 1507a4b
WIP #3 working for simple case
fahrinh f4000e6
WIP #4
fahrinh 628e479
WIP #5
fahrinh 450bf19
WIP #6
fahrinh 1be7e41
WIP #7
fahrinh bc351fc
Merge from master
fahrinh 80a7815
[e2e] Dockerfile: change go build arg
fahrinh 2e0af88
WIP #8
fahrinh 65e9e7a
Fix bool comparison
fahrinh 6db7838
Fix simple test case
fahrinh 460b24f
Fix return redis client call resp; Fix simple test case
fahrinh 213bc2d
Move redis_client_call function
fahrinh 194ba0c
Clean up containers if exception thrown; Native redis call args using…
fahrinh 386ff66
Add .dockerignore to ignore test/ and .git/ when building remiro image
fahrinh 4c272b7
Fix test 001
fahrinh 68b3f23
Tidy up
fahrinh 7e60547
Move test cases to scenario.py; Ignore pycache dir;
fahrinh 3c65034
clean-docker.sh: clean volumes and networks
fahrinh 6c7608c
Merge given_config into REMIRO_CONFIG_DEFAULT
fahrinh ce7ff41
Fix again, attempt to update given_config with default config
fahrinh abfef40
Tidy up log output
fahrinh 4b690d7
Using f-strings to format strings
fahrinh b3b652c
e2e scenario: ut002 - ut005
fahrinh 84a6f79
Change test id, follow naming convention in unit test
fahrinh a1fbc36
e2e scenario: ut_HandleGET_006
fahrinh 9297c55
e2e scenario: ut_HandleSET_001
fahrinh 8eddb80
e2e scenario: ut_HandleSET_003
fahrinh de02f51
e2e scenario: ut_HandlePING_001
fahrinh f32c8db
Handle redis call exception
fahrinh 0a041d3
e2e scenario: ut_HandleDefault
fahrinh 2d7f249
Merge from master
fahrinh 742c748
travis.yml: setup e2e-test
fahrinh 3a9c410
Fix reference issue of given_config
fahrinh ba1c084
[e2e] support password in config
fahrinh 0ba6f2e
Give a hint if an exception is thrown
fahrinh b287624
e2e scenario: HandleAUTH
fahrinh c7b1185
[e2e] README: add description of E2E test case scenario
fahrinh af36fb9
Merge branch 'master' into test/e2e
fahrinh 3c6d971
Tidy up
fahrinh 8c6b933
clean-docker.sh: forced pruning (do not prompt for confirmation)
fahrinh 5bde833
Refactor: TestCase class represents a test case
fahrinh dd28926
Merge branch 'master' into test/e2e
fahrinh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
test/** | ||
.git/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,29 @@ | ||
language: go | ||
services: | ||
- docker | ||
|
||
go: | ||
- 1.12.x | ||
matrix: | ||
include: | ||
- language: go | ||
|
||
env: | ||
- GO111MODULE=on | ||
go: | ||
- 1.12.x | ||
|
||
script: | ||
- make lint-prepare | ||
- make lint | ||
- make test | ||
env: | ||
- GO111MODULE=on | ||
|
||
after_success: | ||
- bash <(curl -s https://codecov.io/bash) | ||
script: | ||
- make lint-prepare | ||
- make lint | ||
- make test | ||
|
||
after_success: | ||
- bash <(curl -s https://codecov.io/bash) | ||
|
||
- language: python | ||
|
||
python: | ||
- "3.6" | ||
|
||
script: | ||
- cd test/e2e | ||
- make e2e-test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"python.pythonPath": "${workspaceFolder}/test/e2e/remiro-e2e-env/bin/python", | ||
"python.formatting.provider": "black" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM golang:1.12 | ||
|
||
ENV GO111MODULE=on | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
RUN go build -o remiro | ||
|
||
ENTRYPOINT ["/app/remiro"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.PHONY: setup-virtual-env | ||
setup-virtual-env: | ||
python3 -m venv remiro-e2e-env | ||
source remiro-e2e-env/bin/activate; \ | ||
python --version; \ | ||
pip install -r requirements.txt; | ||
|
||
.PHONY: e2e-test | ||
e2e-test: setup-virtual-env | ||
source remiro-e2e-env/bin/activate; \ | ||
python e2e.py; | ||
|
||
.DEFAULT_GOAL := e2e-test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Remiro End-to-End Testing | ||
|
||
## Test Methodology | ||
|
||
`e2e.py` builds and spins up new 6 Docker containers for each test cases: | ||
|
||
- `remiro` : testing subject | ||
- `redis-src`: source Redis server | ||
- `redis-dst`: destination Redis server | ||
- `redis-src-expected`: expected source Redis server | ||
- `redis-dst-expected`: expected destination Redis server | ||
- `redis-rdb-tools`: a tool to compare two dump files of Redis data (.rdb) (<https://github.com/sripathikrishnan/redis-rdb-tools>) | ||
|
||
then, `e2e.py` does following tasks while running a test case : | ||
|
||
- populate setup data to `redis-src` and `redis-dst` | ||
- populate expected data to `redis-src-expected` and `redis-dst-expected` | ||
- run a test to `remiro` by using Redis Python client [redis-py](https://github.com/andymccurdy/redis-py) | ||
- run `SAVE` command for each Redis server containers to get Redis data dump files: `dump-redis-src.rdb`, `dump-redis-dst.rdb`, `dump-redis-src-expected.rdb`, `dump-redis-dst-expected.rdb` | ||
- by using `redis-rdb-tools`, compare: | ||
1. `dump-redis-src.rdb` & `dump-redis-src-expected.rdb` | ||
2. `dump-redis-dst.rdb` & `dump-redis-dst-expected.rdb` | ||
|
||
## Test Case Scenario | ||
|
||
Each test case is defined in `scenario.py` with the following format: | ||
|
||
- `id`: (required) id of the test case | ||
- `name`: (required) name / description of the test case | ||
- `test` | ||
- `given_data`: (required) | ||
- `src`: list of Redis commands to populate initial data in `redis-src` server | ||
- `dst`: list of Redis commands to populate initial data in `redis-dst` server | ||
- `when_req_then_data`: list of Redis request commands and its expected responses | ||
- `req`: a Redis command with its arguments. It consists of `"<redis_cmd>": ("<arg1>", "<arg2>", "<etc>")` | ||
- `resp`: (optional) expected response | ||
- `respError`: (optional) `True`: if an exception is expected | ||
- `then_data`: (required) | ||
- `src`: list of Redis commands to populate expected data in `redis-src-expected` server | ||
- `dst`: list of Redis commands to populate expected data in `redis-dst-expected` server |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
docker container prune -f | ||
docker rm $(docker container ls -f name="redis" -q) --force | ||
docker rm $(docker container ls -f name="remiro" -q) --force | ||
docker network rm $(docker network ls -f name="e2e" -q) | ||
docker volume rm $(docker volume ls -f name="e2e" -q) | ||
docker image prune -f | ||
# docker rmi $(docker images "remiro*" -q) --force | ||
# docker rmi $(docker images "redis-rdb-tools*" -q) --force | ||
docker rmi hello-world -f | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM python:3.5-alpine | ||
|
||
RUN apk add gcc musl-dev | ||
|
||
RUN pip install --no-cache-dir rdbtools python-lzf | ||
|
||
CMD [ "/bin/sh" ] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this settings essential for the build? If not, can it be gitignored?