Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
alco committed Jun 4, 2024
1 parent f9d7375 commit ca1d524
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 8 deletions.
13 changes: 12 additions & 1 deletion e2e/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,22 @@ log_dev_env:
docker compose -f ${DOCKER_COMPOSE_FILE} logs --no-color --follow pg_1

start_electric_%:
${ENV} docker compose -f ${DOCKER_COMPOSE_FILE} up --no-color --no-log-prefix electric_$*
docker compose -f ${DOCKER_COMPOSE_FILE} up --no-color --no-log-prefix --abort-on-container-exit electric_$*

stop_electric_%:
docker compose -f ${DOCKER_COMPOSE_FILE} stop electric_$*

run_electric_%:
docker run --rm \
-e LOG_LEVEL=debug \
-e AUTH_JWT_ALG=HS256 \
-e AUTH_JWT_KEY=integration-tests-signing-key-example \
-e ELECTRIC_TELEMETRY=disabled \
-e PG_PROXY_PASSWORD \
-e LOGICAL_PUBLISHER_HOST=electric_$* \
--name electric_$* \
${ELECTRIC_IMAGE}

stop_dev_env:
if [ -n "`docker ps --filter name=elixir_client --format '{{.Names}}'`" ]; then \
docker ps --filter name=elixir_client --format '{{.Names}}' | xargs docker kill; \
Expand Down
1 change: 1 addition & 0 deletions e2e/services_templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
ELECTRIC_FEATURES:
init: true
stop_signal: SIGINT # use SIGINT as the more speedy alternative to SIGTERM
restart: "no"

sysbench:
image: "${SYSBENCH_IMAGE}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,33 @@
[include _shared.luxinc]

[newshell electric]
[invoke start_electric_with_env "DATABASE_URL=http://"]
[invoke run_electric_with_env "DATABASE_URL=http://"]
-

??CONFIGURATION ERROR

??DATABASE_URL has invalid URL scheme: "http"
??The following required configuration options have invalid or missing values:

??* DATABASE_URL has invalid URL scheme: "http"

??Please review the official configuration reference at
??https://electric-sql.com/docs/api/service

??••• Shutting down •••

[newshell electric_2]
[invoke run_electric 2]
??Successfully initialized Postgres connector "postgres_1"

[shell electric]
[invoke run_electric 1]
-

??Failed to establish replication connection to Postgres:
?? #{msg}
??
??Another instance of Electric appears to be connected to this database.
??Refer to https://github.com/electric-sql/electric/issues/971 for additional info.

[cleanup]
[invoke teardown]
13 changes: 8 additions & 5 deletions e2e/tests/_shared.luxinc
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,20 @@
-$fail_pattern
[endmacro]

[macro start_electric_with_env env_str]
!${env_str} make start_electric_1
-$fail_pattern
[endmacro]

[macro stop_electric n]
!make stop_electric_${n}
??Stopped
[invoke ok]
[endmacro]

[macro run_electric n]
!make run_electric_${n}
[endmacro]

[macro run_electric_with_env env_str]
!USER_ENV="${env_str}" make run_electric_1
[endmacro]

[macro teardown]
[progress stop development environment]
!make stop_dev_env
Expand Down
17 changes: 17 additions & 0 deletions e2e/tests/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@ services:
depends_on:
- pg_1

electric_2:
extends:
file: ../services_templates.yaml
service: electric
environment:
DATABASE_URL: "${DATABASE_URL:-postgresql://postgres:password@pg_1:5432/electric}"
DATABASE_REQUIRE_SSL: false
ELECTRIC_WRITE_TO_PG_MODE: "${ELECTRIC_WRITE_TO_PG_MODE:-logical_replication}"
LOGICAL_PUBLISHER_HOST: electric_1
PG_PROXY_LOG_LEVEL: info
ports:
- "5133:5133"
# proxy access
- "65432:65432"
depends_on:
- pg_1

sysbench:
extends:
file: ../services_templates.yaml
Expand Down

0 comments on commit ca1d524

Please sign in to comment.