Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.
Open
Show file tree
Hide file tree
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 Aug 27, 2019
eb31529
add test/e2e/README.md
fahrinh Aug 27, 2019
d941d3b
.vscode/settings.json for E2E testing in python
fahrinh Aug 27, 2019
ca8bc2c
E2E Testing WIP
fahrinh Aug 27, 2019
199b739
Makefile: e2e-test target
fahrinh Aug 27, 2019
edc8e75
Add remiro Dockerfile
fahrinh Aug 27, 2019
913319d
Fix E2E Makefile
fahrinh Aug 27, 2019
0394759
WIP
fahrinh Aug 27, 2019
8885198
E2E Readme: Using redis-py as Redis client
fahrinh Aug 28, 2019
f03e2d7
Merge from master
fahrinh Aug 28, 2019
14da994
README: Fix linting error
fahrinh Aug 28, 2019
abad317
WIP #1
fahrinh Aug 28, 2019
06f3113
WIP #2
fahrinh Aug 29, 2019
1507a4b
WIP #3 working for simple case
fahrinh Aug 30, 2019
f4000e6
WIP #4
fahrinh Aug 31, 2019
628e479
WIP #5
fahrinh Sep 2, 2019
450bf19
WIP #6
fahrinh Sep 4, 2019
1be7e41
WIP #7
fahrinh Sep 4, 2019
bc351fc
Merge from master
fahrinh Sep 4, 2019
80a7815
[e2e] Dockerfile: change go build arg
fahrinh Sep 4, 2019
2e0af88
WIP #8
fahrinh Sep 4, 2019
65e9e7a
Fix bool comparison
fahrinh Sep 4, 2019
6db7838
Fix simple test case
fahrinh Sep 4, 2019
460b24f
Fix return redis client call resp; Fix simple test case
fahrinh Sep 5, 2019
213bc2d
Move redis_client_call function
fahrinh Sep 5, 2019
194ba0c
Clean up containers if exception thrown; Native redis call args using…
fahrinh Sep 5, 2019
386ff66
Add .dockerignore to ignore test/ and .git/ when building remiro image
fahrinh Sep 5, 2019
4c272b7
Fix test 001
fahrinh Sep 5, 2019
68b3f23
Tidy up
fahrinh Sep 5, 2019
7e60547
Move test cases to scenario.py; Ignore pycache dir;
fahrinh Sep 6, 2019
3c65034
clean-docker.sh: clean volumes and networks
fahrinh Sep 6, 2019
6c7608c
Merge given_config into REMIRO_CONFIG_DEFAULT
fahrinh Sep 6, 2019
ce7ff41
Fix again, attempt to update given_config with default config
fahrinh Sep 6, 2019
abfef40
Tidy up log output
fahrinh Sep 6, 2019
4b690d7
Using f-strings to format strings
fahrinh Sep 6, 2019
b3b652c
e2e scenario: ut002 - ut005
fahrinh Sep 6, 2019
84a6f79
Change test id, follow naming convention in unit test
fahrinh Sep 6, 2019
a1fbc36
e2e scenario: ut_HandleGET_006
fahrinh Sep 6, 2019
9297c55
e2e scenario: ut_HandleSET_001
fahrinh Sep 6, 2019
8eddb80
e2e scenario: ut_HandleSET_003
fahrinh Sep 6, 2019
de02f51
e2e scenario: ut_HandlePING_001
fahrinh Sep 6, 2019
f32c8db
Handle redis call exception
fahrinh Sep 6, 2019
0a041d3
e2e scenario: ut_HandleDefault
fahrinh Sep 6, 2019
2d7f249
Merge from master
fahrinh Sep 9, 2019
742c748
travis.yml: setup e2e-test
fahrinh Sep 9, 2019
3a9c410
Fix reference issue of given_config
fahrinh Sep 9, 2019
ba1c084
[e2e] support password in config
fahrinh Sep 9, 2019
0ba6f2e
Give a hint if an exception is thrown
fahrinh Sep 9, 2019
b287624
e2e scenario: HandleAUTH
fahrinh Sep 9, 2019
c7b1185
[e2e] README: add description of E2E test case scenario
fahrinh Sep 9, 2019
af36fb9
Merge branch 'master' into test/e2e
fahrinh Sep 9, 2019
3c6d971
Tidy up
fahrinh Sep 10, 2019
8c6b933
clean-docker.sh: forced pruning (do not prompt for confirmation)
fahrinh Sep 11, 2019
5bde833
Refactor: TestCase class represents a test case
fahrinh Sep 11, 2019
dd28926
Merge branch 'master' into test/e2e
fahrinh Sep 11, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test/**
.git/**
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ remiro
config.toml

# Ignore test coverage reports
coverage.txt
coverage.txt

# Ignore E2E Testing stuff
test/e2e/remiro-e2e-env
test/e2e/__pycache__
36 changes: 25 additions & 11 deletions .travis.yml
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
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
Copy link
Contributor

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?

"python.pythonPath": "${workspaceFolder}/test/e2e/remiro-e2e-env/bin/python",
"python.formatting.provider": "black"
}
11 changes: 11 additions & 0 deletions Dockerfile
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"]
13 changes: 13 additions & 0 deletions test/e2e/Makefile
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
40 changes: 40 additions & 0 deletions test/e2e/README.md
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
12 changes: 12 additions & 0 deletions test/e2e/clean-docker.sh
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

7 changes: 7 additions & 0 deletions test/e2e/docker-redis-rdb-tools/Dockerfile
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" ]
Loading