Skip to content

Commit

Permalink
ci: debug e2e test redis setting
Browse files Browse the repository at this point in the history
  • Loading branch information
gobeam committed Mar 19, 2022
1 parent a73ffa8 commit 57a0ce1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ jobs:
POSTGRES_PASSWORD: truthypwd
ports:
- 5432:5432

redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379

steps:
- uses: actions/checkout@v2
Expand Down
19 changes: 4 additions & 15 deletions test/factories/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,27 +114,16 @@ export class AppFactory {
}

const setupRedis = async () => {
const redis = new Redis({});
const redis = new Redis({
host: process.env.REDIS_HOST || 'localhost',
port: parseInt(process.env.REDIS_PORT) || 6379
});
await redis.flushall();
return redis;
};

const setupTestDatabase = async () => {
const database = `test_${uuid4()}`;
console.log('🚀 ~ file: app.ts ~ line 124 ~ setupTestDatabase ~ database', {
type: dbConfig.type,
host: process.env.DB_HOST || dbConfig.host,
port: parseInt(process.env.DB_PORT) || dbConfig.port,
database: process.env.DB_DATABASE_NAME || dbConfig.database,
username: process.env.DB_USERNAME || dbConfig.username,
password: process.env.DB_PASSWORD || dbConfig.password,
logging: false,
synchronize: false,
migrationsRun: true,
migrationsTableName: 'migrations',
migrations: [__dirname + '/../../src/database/migrations/**/*{.ts,.js}'],
entities: [__dirname + '/../../src/**/*.entity{.ts,.js}']
});
const manager = new ConnectionManager().create({
type: dbConfig.type,
host: process.env.DB_HOST || dbConfig.host,
Expand Down

0 comments on commit 57a0ce1

Please sign in to comment.