Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Commit

Permalink
Move E2E tests to separate 'medea-e2e' crate (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilslv authored Jul 12, 2021
1 parent 47ebf12 commit 85cb7c4
Show file tree
Hide file tree
Showing 55 changed files with 465 additions and 120 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
!jason/demo/chart/medea-demo/conf/
!jason/demo/index.html

# E2E tests sources and manifest.
!e2e/Cargo.toml
!e2e/src/

# Makefile may be used in Dockerfiles.
!.env
!Makefile
28 changes: 20 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 1 addition & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ members = [
"crates/medea-coturn-telnet-client",
"crates/medea-macro",
"crates/medea-reactive",
"e2e",
"jason",
"mock/control-api",
"proto/client-api",
Expand Down Expand Up @@ -95,30 +96,17 @@ actix-codec = "0.4"
actix-http-test = "=3.0.0-beta.4"
actix-rt = "2.2"
actix-service = "2.0"
async-recursion = "0.3"
awc = "=3.0.0-beta.7"
cucumber_rust = { version = "0.8", features = ["macros"] }
derive_builder = "0.10"
fantoccini = "0.17"
function_name = "0.2"
hyper = { version = "0.14", features = ["server"] }
lazy_static = "1.4"
medea-control-api-mock = { path = "mock/control-api" }
mockall = "0.10"
once_cell = "1.5"
reqwest = { version = "0.11", features = ["json"] }
serial_test = "0.5"
tempfile = "3.1"
tokio = { version = "1.5", features = ["fs", "macros", "rt-multi-thread"] }
tokio-stream = "0.1"
tokio-util = "0.6"
uuid = { version = "0.8", features = ["v4"] }
webdriver = "0.43"

[[test]]
name = "e2e"
path = "tests/e2e/main.rs"
harness = false # allows Cucumber to print output instead of libtest

[[test]]
name = "integration"
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ COPY proto/control-api/src/grpc/api.proto \
proto/control-api/src/grpc/api*.rs \
/app/proto/control-api/src/grpc/
COPY jason/Cargo.toml /app/jason/
COPY e2e/Cargo.toml /app/e2e/
COPY Cargo.toml Cargo.lock /app/
WORKDIR /app/
RUN mkdir -p crates/medea-macro/src/ && touch crates/medea-macro/src/lib.rs \
Expand All @@ -49,6 +50,7 @@ RUN mkdir -p crates/medea-macro/src/ && touch crates/medea-macro/src/lib.rs \
&& mkdir -p proto/client-api/src/ && touch proto/client-api/src/lib.rs \
&& mkdir -p proto/control-api/src/ && touch proto/control-api/src/lib.rs \
&& mkdir -p jason/src/ && touch jason/src/lib.rs \
&& mkdir -p e2e/src/ && touch e2e/src/lib.rs \
&& mkdir -p src/ && touch src/lib.rs

# Build dependencies only.
Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,8 @@ endif
dockerized=$(dockerized) tag=$(tag) debug=$(debug)
@make wait.port port=4444
endif
cargo test --test e2e $(if $(call eq,$(only),),,-- -e '$(only)')
cargo test -p medea-e2e --test e2e \
$(if $(call eq,$(only),),,-- -e '$(only)')
ifeq ($(up),yes)
@make docker.down.e2e
endif
Expand Down Expand Up @@ -770,7 +771,7 @@ docker.down.demo:

docker.down.e2e: down.control
@make docker.down.medea dockerized=no
docker-compose -f tests/e2e/docker-compose.yml down --rmi=local -v
docker-compose -f e2e/docker-compose.yml down --rmi=local -v


# Stop Medea media server in Docker Compose environment
Expand Down Expand Up @@ -961,13 +962,13 @@ docker-up-e2e-env = RUST_BACKTRACE=1 \
docker.up.e2e: docker.down.e2e
@make build.jason debug=$(debug) dockerized=no
env $(docker-up-e2e-env) \
docker-compose -f tests/e2e/docker-compose$(if $(call eq,$(dockerized),yes),,.host).yml \
docker-compose -f e2e/docker-compose$(if $(call eq,$(dockerized),yes),,.host).yml \
up $(if $(call eq,$(dockerized),yes),\
$(if $(call eq,$(background),yes),-d,--abort-on-container-exit),-d)
ifeq ($(background),yes)
ifeq ($(log),yes)
env $(docker-up-e2e-env) \
docker-compose -f tests/e2e/docker-compose$(if $(call eq,$(dockerized),yes),,.host).yml \
docker-compose -f e2e/docker-compose$(if $(call eq,$(dockerized),yes),,.host).yml \
logs -f &
endif
endif
Expand Down
File renamed without changes.
32 changes: 32 additions & 0 deletions e2e/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[package]
name = "medea-e2e"
version = "0.0.0"
edition = "2018"
resolver = "2"
description = "E2E tests for Medea media server"
authors = ["Instrumentisto Team <[email protected]>"]
publish = false

[dependencies]
derive_more = "0.99"
fantoccini = "0.17"
futures = "0.3"
once_cell = "1.0"
serde = "1.0"
serde_json = "1.0"
tokio = { version = "1.0", features = ["rt-multi-thread"] }
uuid = { version = "0.8", features = ["v4"] }
webdriver = "0.43"

[dev-dependencies]
async-recursion = "0.3"
async-trait = "0.1"
cucumber_rust = { version = "0.8", features = ["macros"] }
medea-control-api-mock = { path = "../mock/control-api" }
reqwest = { version = "0.11", features = ["json"] }
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }

[[test]]
name = "e2e"
path = "tests/main.rs"
harness = false # Allows Cucumber to print output instead of libtest.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./index.html:/usr/share/nginx/html/index.html:ro
- ../../jason/pkg/:/usr/share/nginx/html/pkg/:ro
- ../jason/pkg/:/usr/share/nginx/html/pkg/:ro
network_mode: host
coturn:
container_name: ${COMPOSE_PROJECT_NAME}-coturn
Expand All @@ -18,8 +18,8 @@ services:
command:
- --log-file=stdout
volumes:
- ../../_dev/coturn/turnserver.conf:/etc/coturn/turnserver.conf:ro
- ../../.cache/coturn/data/:/var/lib/coturn/
- ../_dev/coturn/turnserver.conf:/etc/coturn/turnserver.conf:ro
- ../.cache/coturn/data/:/var/lib/coturn/
network_mode: host
coturn-db:
container_name: ${COMPOSE_PROJECT_NAME}-coturn-db
Expand All @@ -28,7 +28,7 @@ services:
#ports:
# - "6379:6379" # coturn redis
volumes:
- ../../_dev/coturn/redis.conf:/etc/redis.conf:ro
- ../_dev/coturn/redis.conf:/etc/redis.conf:ro
network_mode: host
webdriver:
container_name: ${COMPOSE_PROJECT_NAME}-webdriver
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/docker-compose.yml → e2e/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./index.html:/usr/share/nginx/html/index.html:ro
- ../../jason/pkg/:/usr/share/nginx/html/pkg/:ro
- ../jason/pkg/:/usr/share/nginx/html/pkg/:ro
medea:
container_name: ${COMPOSE_PROJECT_NAME}-medea
image: ${COMPOSE_IMAGE_NAME}:${COMPOSE_IMAGE_VER}
Expand All @@ -30,15 +30,15 @@ services:
command:
- --log-file=stdout
volumes:
- ../../_dev/coturn/turnserver.conf:/etc/coturn/turnserver.conf:ro
- ../../.cache/coturn/data/:/var/lib/coturn/
- ../_dev/coturn/turnserver.conf:/etc/coturn/turnserver.conf:ro
- ../.cache/coturn/data/:/var/lib/coturn/
network_mode: service:frontend
coturn-db:
container_name: ${COMPOSE_PROJECT_NAME}-coturn-db
image: redis:alpine
command: ["redis-server", "/etc/redis.conf"]
volumes:
- ../../_dev/coturn/redis.conf:/etc/redis.conf:ro
- ../_dev/coturn/redis.conf:/etc/redis.conf:ro
network_mode: service:frontend
control-api-mock:
container_name: ${COMPOSE_PROJECT_NAME}-control-api-mock
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 85cb7c4

Please sign in to comment.