Skip to content

Commit

Permalink
Merge pull request #64 from hellofresh/hotfix/ci-tests
Browse files Browse the repository at this point in the history
Fixed tests in the PR workflow
  • Loading branch information
vgarvardt authored Sep 14, 2021
2 parents d780290 + b3a78f1 commit 1cda65c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ jobs:
go-version: ^1.17
- name: Check out code
uses: actions/checkout@v2
- name: Run tests
run: go test -cover ./... -coverprofile=coverage.txt -covermode=atomic
- name: Run unit tests
run: make test-unit
- name: Run examples tests
run: make test-examples
- name: Run integration tests
run: make test-integration
env:
POSTGRES_DSN: postgres://goengine:goengine@localhost:${{ job.services.postgres.ports[5432] }}/goengine?sslmode=disable
11 changes: 9 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
version: '2'
version: '3'

services:
postgres:
image: postgres:10.3
ports:
- '8043:5432'
- '8043:5432'
tmpfs:
- /var/lib/postgresql
environment:
LC_ALL: C.UTF-8
POSTGRES_DB: goengine
POSTGRES_USER: goengine
POSTGRES_PASSWORD: goengine
healthcheck:
test: [ "CMD", "pg_isready" ]
interval: 10s
timeout: 5s
retries: 5
2 changes: 1 addition & 1 deletion extension/amqp/listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func TestListener_Listen(t *testing.T) {
interval := consumeCalls[i].Sub(consumeCalls[i-1])

if expectedInterval > interval || interval > (expectedInterval+time.Millisecond*2) {
assert.Fail(t, fmt.Sprintf("Invalid interval after consume %d (got %s expected between %s and %s)", i, interval, expectedInterval, (expectedInterval+time.Millisecond)))
assert.Fail(t, fmt.Sprintf("Invalid interval after consume %d (got %s expected between %s and %s)", i, interval, expectedInterval, expectedInterval+time.Millisecond))
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/internal/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func postgresDSN(t *testing.T) string {
parsedDSN += " application_name=" + postgressAppName
}

parsedDSN = regexp.MustCompile(`dbname=((?:(\\ )|[^ ])+)`).
parsedDSN = regexp.MustCompile(`dbname='((?:(\\ )|[^ ])+)'`).
ReplaceAllString(parsedDSN, fmt.Sprintf("dbname=${1}-%d", time.Now().UnixNano()))

return parsedDSN
Expand Down

0 comments on commit 1cda65c

Please sign in to comment.