Skip to content

Commit

Permalink
do not duplicate integration test code
Browse files Browse the repository at this point in the history
  • Loading branch information
SteffenDE committed May 21, 2024
1 parent ce569dd commit 3e47e80
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 37 deletions.
21 changes: 2 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,5 @@ jobs:
- 1433:1433
steps:
- uses: actions/checkout@v2.3.1
- name: Install Dependencies
run: |
mix local.rebar --force
mix local.hex --force
apk add --no-progress --update git socat make gcc libc-dev
- name: Set up local proxies
run: |
socat TCP-LISTEN:5432,fork TCP-CONNECT:postgres:5432&
socat TCP-LISTEN:3306,fork TCP-CONNECT:mysql:3306&
socat TCP-LISTEN:1433,fork TCP-CONNECT:mssql:1433&
- name: Run installer tests
run: mix test
working-directory: installer
- name: Install dependencies
run: mix deps.get
working-directory: integration_test
- name: Run integration tests
run: mix test --include database
working-directory: integration_test
- name: Run test script
run: ./integration_test/test.sh
22 changes: 4 additions & 18 deletions integration_test/docker.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env sh -e

ELIXIR="1.16.2"
ERLANG="26.2.5"
SUFFIX="alpine-3.19.1"
ELIXIR="${ELIXIR:-1.16.2}"
ERLANG="${ERLANG:-26.2.5}"
SUFFIX="${SUFFIX:-alpine-3.19.1}"

# Get the directory of the script
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
Expand All @@ -28,20 +28,6 @@ $COMPOSE_CMD up -d
# Run test commands (adapt from .github/workflows/ci.yml if necessary)
docker run --rm --network=integration_test_default \
-w $PARENT_DIR -v $PARENT_DIR:$PARENT_DIR \
-it hexpm/elixir:$ELIXIR-erlang-$ERLANG-$SUFFIX sh -c '
mix local.rebar --force
mix local.hex --force
apk add --no-progress --update git socat make gcc libc-dev
socat TCP-LISTEN:5432,fork TCP-CONNECT:postgres:5432&
socat TCP-LISTEN:3306,fork TCP-CONNECT:mysql:3306&
socat TCP-LISTEN:1433,fork TCP-CONNECT:mssql:1433&
echo "Running installer tests"
cd installer
mix test
echo "Running integration tests"
cd ../integration_test
mix deps.get
mix test --include database
'
-it hexpm/elixir:$ELIXIR-erlang-$ERLANG-$SUFFIX sh integration_test/test.sh

$COMPOSE_CMD down
22 changes: 22 additions & 0 deletions integration_test/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh -e

mix local.rebar --force
mix local.hex --force

# Install Dependencies
apk add --no-progress --update git socat make gcc libc-dev

# Set up local proxies
socat TCP-LISTEN:5432,fork TCP-CONNECT:postgres:5432&
socat TCP-LISTEN:3306,fork TCP-CONNECT:mysql:3306&
socat TCP-LISTEN:1433,fork TCP-CONNECT:mssql:1433&

# Run installer tests
echo "Running installer tests"
cd installer
mix test

echo "Running integration tests"
cd ../integration_test
mix deps.get
mix test --include database

0 comments on commit 3e47e80

Please sign in to comment.