ci: Update Makefile with new targets for testing

This updates the test-ci target to startup the test database container
first, wait for it to be ready, and then start running the tests.

It also creates some new targets for local devs. Prior to running any
tests either via `make test` or `go test`, the database should be
started with:

    make test-database-up

It can take a few seconds for the database to fully initialize, the
status can be checked with:

    docker logs -f boundary-sql-tests

This database can be stopped and destroyed with:

    make test-database-down

In general it should only need to be restarted when new migrations are
added. But it might also be necessary to restart if some tests fail in
an unexpected way and fail to do cleanup steps.
This commit is contained in:
Timothy Messier committed 2021-09-09 13:42:01 -04:00
1 parent 75388f727a
commit ecdcf72e0e
5 files changed
+136 -11

No files matched your search

+17 -5
View File
@@ -7,7 +7,7 @@ version: 2
jobs:
test-sql-13-alpine:
machine:
image: ubuntu-1604:201903-01
image: ubuntu-2004:202107-02
steps:
- checkout
- run:
@@ -249,7 +249,7 @@ jobs:
- .buildcache/packages/store
test-sql-11-alpine:
machine:
image: ubuntu-1604:201903-01
image: ubuntu-2004:202107-02
steps:
- checkout
- run:
@@ -887,7 +887,7 @@ jobs:
- .buildcache/packages/store
test-sql-12-alpine:
machine:
image: ubuntu-1604:201903-01
image: ubuntu-2004:202107-02
steps:
- checkout
- run:
@@ -969,14 +969,26 @@ jobs:
- .buildcache/packages/store
build:
machine:
image: ubuntu-1604:201903-01
image: ubuntu-2004:202107-02
resource_class: large
steps:
- checkout
- run:
command: |
which pg_isready || sudo apt-get update && sudo apt-get install -y postgresql-client
make DOCKER_ARGS='-d' -C testing/dbtest/docker database-up
until pg_isready -h 127.0.0.1; do docker container inspect boundary-sql-tests &> /dev/null || exit -1; sleep 1; done
name: Initialize Test Database
- run:
command: |
make test-ci
name: Run Acceptance Tests
no_output_timeout: 15m
- run:
command: |
make -C testing/dbtest/docker clean
name: Cleanup
when: always
- run:
command: |
echo 'export SLACK_BUILD_STATUS="fail"' >> $BASH_ENV
@@ -1467,7 +1479,7 @@ jobs:
- .buildcache/packages/store
test-sql-latest:
machine:
image: ubuntu-1604:201903-01
image: ubuntu-2004:202107-02
steps:
- checkout
- run:
+13 -1
View File
@@ -1,13 +1,25 @@
resource_class: large
machine:
image: 'ubuntu-1604:201903-01'
image: 'ubuntu-2004:202107-02'
working_directory: ~/boundary
steps:
- checkout
- run:
name: "Initialize Test Database"
command: |
which pg_isready || sudo apt-get update && sudo apt-get install -y postgresql-client
make DOCKER_ARGS='-d' -C testing/dbtest/docker database-up
until pg_isready -h 127.0.0.1; do docker container inspect boundary-sql-tests &> /dev/null || exit -1; sleep 1; done
- run:
name: "Run Acceptance Tests"
no_output_timeout: 15m
command: |
make test-ci
- run:
name: "Cleanup"
when: always
command: |
make -C testing/dbtest/docker clean
- slack/status:
fail_only: true
only_for_branches: master
+1 -1
View File
@@ -1,5 +1,5 @@
machine:
image: 'ubuntu-1604:201903-01'
image: 'ubuntu-2004:202107-02'
working_directory: ~/boundary
parameters:
postgres-version: