-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from hellofresh/hotfix/tests
Fixed Rabbit checker and added tests
- Loading branch information
Showing
8 changed files
with
123 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package mongo | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
) | ||
|
||
const mgDSNEnv = "HEALTH_GO_MG_DSN" | ||
|
||
func TestNew(t *testing.T) { | ||
if os.Getenv(mgDSNEnv) == "" { | ||
t.SkipNow() | ||
} | ||
|
||
check := New(Config{ | ||
DSN: os.Getenv(mgDSNEnv), | ||
}) | ||
|
||
if err := check(); err != nil { | ||
t.Fatalf("MongoDB check failed: %s", err.Error()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package rabbitmq | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
) | ||
|
||
const mqDSNEnv = "HEALTH_GO_MQ_DSN" | ||
|
||
func TestNew(t *testing.T) { | ||
if os.Getenv(mqDSNEnv) == "" { | ||
t.SkipNow() | ||
} | ||
|
||
check := New(Config{ | ||
DSN: os.Getenv(mqDSNEnv), | ||
}) | ||
|
||
if err := check(); err != nil { | ||
t.Fatalf("RabbitMQ check failed: %s", err.Error()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package redis | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
) | ||
|
||
const rdDSNEnv = "HEALTH_GO_RD_DSN" | ||
|
||
func TestNew(t *testing.T) { | ||
if os.Getenv(rdDSNEnv) == "" { | ||
t.SkipNow() | ||
} | ||
|
||
check := New(Config{ | ||
DSN: os.Getenv(rdDSNEnv), | ||
}) | ||
|
||
if err := check(); err != nil { | ||
t.Fatalf("Redis check failed: %s", err.Error()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
version: '3' | ||
services: | ||
|
||
postgres: | ||
image: postgres:9.5-alpine | ||
ports: | ||
- "5432" | ||
volumes: | ||
- ./docker/postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d | ||
environment: | ||
POSTGRES_USER: test | ||
POSTGRES_PASSWORD: test | ||
POSTGRES_DB: test | ||
|
||
rabbit: | ||
image: rabbitmq:3.6-management-alpine | ||
ports: | ||
- "5672" | ||
|
||
redis: | ||
image: redis:3.2-alpine | ||
ports: | ||
- "6379" | ||
|
||
mongo: | ||
image: mongo:3 | ||
ports: | ||
- "27017" |
11 changes: 11 additions & 0 deletions
11
docker/postgres/docker-entrypoint-initdb.d/init-test-db.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL | ||
CREATE TABLE IF NOT EXISTS test ( | ||
id TEXT NOT NULL PRIMARY KEY, | ||
secret TEXT NOT NULL, | ||
extra TEXT NOT NULL, | ||
redirect_uri TEXT NOT NULL | ||
); | ||
EOSQL |