-
-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: setup tests using docker compose
- Loading branch information
1 parent
3542934
commit 4c8df5e
Showing
5 changed files
with
161 additions
and
134 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
DB=pg | ||
DB_NAME=lucid | ||
|
||
MYSQL_HOST=0.0.0.0 | ||
MYSQL_HOST=mysql | ||
MYSQL_PORT=3306 | ||
MYSQL_USER=virk | ||
MYSQL_PASSWORD=password | ||
|
||
PG_HOST=0.0.0.0 | ||
PG_HOST=pg | ||
PG_PORT=5432 | ||
PG_USER=virk | ||
PG_PASSWORD=password |
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,18 @@ | ||
FROM node:10.15.3-alpine as build-deps | ||
|
||
RUN apk update && apk upgrade && \ | ||
apk add --update git && \ | ||
apk add --update openssh && \ | ||
apk add --update bash && \ | ||
apk add --update wget | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY package*.json ./ | ||
RUN npm install | ||
|
||
RUN wget https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh -O /wait-for-it.sh | ||
RUN chmod +x /wait-for-it.sh | ||
|
||
COPY . . | ||
RUN npm run build |
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 |
---|---|---|
@@ -1,141 +1,141 @@ | ||
import * as Knex from 'knex' | ||
// // import { join } from 'path' | ||
import { DatabaseQueryBuilderContract } from '@ioc:Adonis/Addons/DatabaseQueryBuilder' | ||
|
||
const knex = Knex({ | ||
client: 'pg', | ||
connection: { | ||
host: '0.0.0.0', | ||
user: 'virk', | ||
password: '', | ||
database: 'directory-service', | ||
}, | ||
pool: { | ||
min: 0, | ||
max: 5, | ||
idleTimeoutMillis: 30000, | ||
}, | ||
useNullAsDefault: true, | ||
}) | ||
|
||
knex() | ||
.from('foo') | ||
.havingIn('f', ['a']) | ||
|
||
// // let i = 0; | ||
// knex['_context'].client.pool.on('destroySuccess', _eventId => { | ||
// // i++ | ||
// console.log( | ||
// knex['_context'].client.pool.numUsed(), | ||
// knex['_context'].client.pool.numFree(), | ||
// knex['_context'].client.pool.numPendingAcquires(), | ||
// ) | ||
|
||
// // if (i === 3) { | ||
// // knex['_context'].client.pool.destroy() | ||
// // } | ||
// }); | ||
|
||
// knex['_context'].client.pool.on('poolDestroySuccess', _resource => { | ||
// console.log('poolDestroySuccess>>>') | ||
// }); | ||
|
||
// // setInterval(() => { | ||
// // console.log('ping') | ||
// // }, 1000) | ||
|
||
// // type User = { | ||
// // id: number, | ||
// // } | ||
|
||
// // console.log(knex.raw(['10']).toQuery()) | ||
|
||
// // knex.schema.createTable('users', (table) => { | ||
// // table.increments('id') | ||
// // table.string('username') | ||
// // table.integer('age') | ||
// // table.timestamps() | ||
// // }).then(() => console.log('created')) | ||
|
||
// // knex.table('users').insert([ | ||
// // { username: 'virk', age: 29 }, { username: 'nikk', age: 28 }, { username: 'prasan', age: 29 }, | ||
// // ]).then(console.log) | ||
|
||
// Promise.all([ | ||
// knex | ||
// .select('*') | ||
// .from('users') | ||
// .debug(true) | ||
// .then((result) => { | ||
// console.log(result) | ||
// }), | ||
// knex | ||
// .select('*') | ||
// .from('users') | ||
// .debug(true) | ||
// .then((result) => { | ||
// console.log(result) | ||
// }), | ||
// knex | ||
// .select('*') | ||
// .from('users') | ||
// .debug(true) | ||
// .then((result) => { | ||
// console.log(result) | ||
// }), | ||
// knex | ||
// .select('*') | ||
// .from('users') | ||
// .debug(true) | ||
// .then((result) => { | ||
// console.log(result) | ||
// }), | ||
// knex | ||
// .select('*') | ||
// .from('users') | ||
// .debug(true) | ||
// .then((result) => { | ||
// console.log(result) | ||
// }), | ||
// ]).then(() => { | ||
// import * as Knex from 'knex' | ||
// // // import { join } from 'path' | ||
// import { DatabaseQueryBuilderContract } from '@ioc:Adonis/Addons/DatabaseQueryBuilder' | ||
|
||
// const knex = Knex({ | ||
// client: 'pg', | ||
// connection: { | ||
// host: '0.0.0.0', | ||
// user: 'virk', | ||
// password: '', | ||
// database: 'directory-service', | ||
// }, | ||
// pool: { | ||
// min: 0, | ||
// max: 5, | ||
// idleTimeoutMillis: 30000, | ||
// }, | ||
// useNullAsDefault: true, | ||
// }) | ||
|
||
// // knex.transaction().then((trx) => { | ||
// knex() | ||
// .from('foo') | ||
// .havingIn('f', ['a']) | ||
|
||
// // // let i = 0; | ||
// // knex['_context'].client.pool.on('destroySuccess', _eventId => { | ||
// // // i++ | ||
// // console.log( | ||
// // knex['_context'].client.pool.numUsed(), | ||
// // knex['_context'].client.pool.numFree(), | ||
// // knex['_context'].client.pool.numPendingAcquires(), | ||
// // ) | ||
|
||
// // // if (i === 3) { | ||
// // // knex['_context'].client.pool.destroy() | ||
// // // } | ||
// // }); | ||
|
||
// // knex['_context'].client.pool.on('poolDestroySuccess', _resource => { | ||
// // console.log('poolDestroySuccess>>>') | ||
// // }); | ||
|
||
// // // setInterval(() => { | ||
// // // console.log('ping') | ||
// // // }, 1000) | ||
|
||
// // // type User = { | ||
// // // id: number, | ||
// // // } | ||
|
||
// // // console.log(knex.raw(['10']).toQuery()) | ||
|
||
// // // knex.schema.createTable('users', (table) => { | ||
// // // table.increments('id') | ||
// // // table.string('username') | ||
// // // table.integer('age') | ||
// // // table.timestamps() | ||
// // // }).then(() => console.log('created')) | ||
|
||
// // // knex.table('users').insert([ | ||
// // // { username: 'virk', age: 29 }, { username: 'nikk', age: 28 }, { username: 'prasan', age: 29 }, | ||
// // // ]).then(console.log) | ||
|
||
// // Promise.all([ | ||
// // knex | ||
// // .select('*') | ||
// // .from('users') | ||
// // .debug(true) | ||
// // .then((result) => { | ||
// // console.log(result) | ||
// // }), | ||
// // knex | ||
// // .select('*') | ||
// // .from('users') | ||
// // .debug(true) | ||
// // .then((result) => { | ||
// // console.log(result) | ||
// // }), | ||
// // knex | ||
// // .select('*') | ||
// // .from('users') | ||
// // .debug(true) | ||
// // .then((result) => { | ||
// // console.log(result) | ||
// // }), | ||
// // knex | ||
// // .select('*') | ||
// // .from('users') | ||
// // .debug(true) | ||
// // .then((result) => { | ||
// // console.log(result) | ||
// // }), | ||
// // knex | ||
// // .select('*') | ||
// // .from('users') | ||
// // .debug(true) | ||
// // .then((result) => { | ||
// // console.log(result) | ||
// // }), | ||
// // ]).then(() => { | ||
// // }) | ||
|
||
// // console.log(query.toSQL()) | ||
// // // knex.transaction().then((trx) => { | ||
// // // }) | ||
|
||
// // type FilteredKeys<T> = { [P in keyof T]: T[P] extends Function ? never : P }[keyof T] | ||
// // // console.log(query.toSQL()) | ||
|
||
// // type GetRefs<T extends typeof BaseModel> = T['refs'] extends object ? { | ||
// // [P in keyof T['refs']]: InstanceType<T>[P] | ||
// // } : { | ||
// // [P in FilteredKeys<InstanceType<T>>]: InstanceType<T>[P] | ||
// // } | ||
// // // type FilteredKeys<T> = { [P in keyof T]: T[P] extends Function ? never : P }[keyof T] | ||
|
||
// // class BaseModel { | ||
// // public static refs: unknown | ||
// // // type GetRefs<T extends typeof BaseModel> = T['refs'] extends object ? { | ||
// // // [P in keyof T['refs']]: InstanceType<T>[P] | ||
// // // } : { | ||
// // // [P in FilteredKeys<InstanceType<T>>]: InstanceType<T>[P] | ||
// // // } | ||
|
||
// // public static query<T extends typeof BaseModel> ( | ||
// // this: T, | ||
// // ): DatabaseQueryBuilderContract<GetRefs<T>, InstanceType<T>> { | ||
// // return {} as DatabaseQueryBuilderContract<GetRefs<T>, InstanceType<T>> | ||
// // } | ||
// // } | ||
// // // class BaseModel { | ||
// // // public static refs: unknown | ||
|
||
// // class User extends BaseModel { | ||
// // public username: string | ||
// // public age: number | ||
// // // public static query<T extends typeof BaseModel> ( | ||
// // // this: T, | ||
// // // ): DatabaseQueryBuilderContract<GetRefs<T>, InstanceType<T>> { | ||
// // // return {} as DatabaseQueryBuilderContract<GetRefs<T>, InstanceType<T>> | ||
// // // } | ||
// // // } | ||
|
||
// // public castToInt (): number { | ||
// // return 22 | ||
// // } | ||
// // } | ||
// // // class User extends BaseModel { | ||
// // // public username: string | ||
// // // public age: number | ||
|
||
// // class Post extends BaseModel { | ||
// // } | ||
// // // public castToInt (): number { | ||
// // // return 22 | ||
// // // } | ||
// // // } | ||
|
||
const foo: DatabaseQueryBuilderContract<{ username: string, age: number, email: string }> = {} | ||
foo.whereIn(['username', 'age', 'email'], [ | ||
['foo', 22, 'a'], ['bar', 22, 'a'], ['virk', 22, 'a'], | ||
]) | ||
// // // class Post extends BaseModel { | ||
// // // } | ||
|
||
// const foo: DatabaseQueryBuilderContract<{ username: string, age: number, email: string }> = {} | ||
// foo.whereIn(['username', 'age', 'email'], [ | ||
// ['foo', 22, 'a'], ['bar', 22, 'a'], ['virk', 22, 'a'], | ||
// ]) |
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