[dev] Enable all DB tests during CI

This commit is contained in:
Gero Posmyk-Leinemann 2021-06-02 14:06:45 +00:00 committed by Gero Posmyk-Leinemann
parent 578b7bd392
commit e541251a7d
9 changed files with 68 additions and 10 deletions

View File

@ -7,6 +7,10 @@ defaultArgs:
localAppVersion: unknown
defaultVariant:
srcs:
exclude:
# Make sure we don't include node_modules/**/*.ts by accident
- "**/node_modules/**"
config:
go:
lintCommand: ["golangci-lint", "run", "--disable", "govet,errcheck,typecheck,staticcheck", "--allow-parallel-runners"]

View File

@ -28,7 +28,7 @@ packages:
- name: dbtest
type: yarn
srcs:
- "src/**/*.ts"
- "**/*.ts"
- package.json
- mocha.opts
deps:
@ -37,7 +37,7 @@ packages:
- components/gitpod-protocol:lib
config:
packaging: library
yarnLock: ../../../yarn.lock
yarnLock: ${coreYarnLockBase}/../yarn.lock
tsconfig: tsconfig.json
commands:
test: ["yarn", "db-test"]

View File

@ -10,8 +10,8 @@
"rebuild": "yarn build:clean",
"build:watch": "watch 'yarn build' .",
"watch": "leeway exec --package .:app --transitive-dependencies --filter-type yarn --components --parallel -- tsc -w --preserveWatchOutput",
"db-test": "r(){ export DB_ENCRYPTION_KEYS='[{\"name\":\"general\",\"version\":1,\"primary\":true,\"material\":\"5vRrp0H4oRgdkPnX1qQcS54Q0xggr6iyho42IQ1rO+c=\"}]';export DB_PORT=23306;export DB_USER=root;export DB_PASSWORD=test; yarn db-test-run;}; r",
"db-test-run": "mocha --opts mocha.opts '**/*.spec.db.ts'",
"db-test": "r(){ . $(leeway run components/gitpod-db:db-test-env); yarn db-test-run;}; r",
"db-test-run": "mocha --opts mocha.opts '**/*.spec.db.ts' --exclude './node_modules/**'",
"clean": "yarn run rimraf lib",
"clean:node": "yarn run rimraf node_modules",
"purge": "yarn clean && yarn clean:node && yarn run rimraf yarn.lock",

View File

@ -24,6 +24,7 @@ packages:
deps:
- components/gitpod-db:lib
- components/gitpod-protocol:lib
- :dbtest
config:
packaging: library
yarnLock: ${coreYarnLockBase}/../yarn.lock
@ -39,6 +40,23 @@ packages:
image:
- ${imageRepoBase}/payment-endpoint:${version}
- ${imageRepoBase}/payment-endpoint:${__pkg_version}
- name: dbtest
type: yarn
srcs:
- "**/*.ts"
- package.json
- mocha.opts
deps:
- components/gitpod-db:dbtest-init
- components/gitpod-db:lib
- components/gitpod-protocol:lib
config:
packaging: library
yarnLock: ${coreYarnLockBase}/../yarn.lock
tsconfig: tsconfig.json
commands:
test: ["yarn", "db-test"]
build: ["npx", "tsc"]
scripts:
- name: telepresence
script: |-

View File

@ -50,7 +50,9 @@
"debug:local": "yarn debug",
"debug-brk": "nodemon -w ./lib --inspect-brk ./lib/main.js",
"telepresence": "leeway run .:telepresence",
"test": "mocha --opts mocha.opts './**/*.spec.ts' --exclude './node_modules/**'"
"test": "mocha --opts mocha.opts './**/*.spec.ts' --exclude './node_modules/**'",
"db-test": "r(){ . $(leeway run components/gitpod-db:db-test-env); yarn db-test-run;}; r",
"db-test-run": "mocha --opts mocha.opts '**/*.spec.db.ts' --exclude './node_modules/**'"
},
"files": [
"/lib"

View File

@ -36,7 +36,7 @@ packages:
- name: dbtest
type: yarn
srcs:
- "src/**/*.ts"
- "**/*.ts"
- package.json
- mocha.opts
deps:
@ -78,3 +78,13 @@ packages:
image:
- ${imageRepoBase}/db-migrations:${version}
- ${imageRepoBase}/db-migrations:${__pkg_version}
scripts:
- name: db-test-env
description: "Creates a file with env vars necessary for running DB tests. The file delets itself after being sourced. Usage: '. $(leeway run components/gitpod-db:db-test-env)'"
deps: []
script: |
TMP="$(mktemp)"
echo '#!/bin/bash' > $TMP
echo 'export DB_ENCRYPTION_KEYS="[{\"name\":\"general\",\"version\":1,\"primary\":true,\"material\":\"5vRrp0H4oRgdkPnX1qQcS54Q0xggr6iyho42IQ1rO+c=\"}]";export DB_HOST=127.0.0.1;export DB_PORT=23306;export DB_USER=root;export DB_PASSWORD=test;' >> $TMP
echo "rm -f $TMP" >> $TMP
echo $TMP

View File

@ -9,9 +9,8 @@
"rebuild": "yarn build:clean",
"build:watch": "watch 'yarn build' .",
"watch": "leeway exec --package .:lib --transitive-dependencies --filter-type yarn --components --parallel -- tsc -w --preserveWatchOutput",
"db-test": "r(){ export DB_ENCRYPTION_KEYS='[{\"name\":\"general\",\"version\":1,\"primary\":true,\"material\":\"5vRrp0H4oRgdkPnX1qQcS54Q0xggr6iyho42IQ1rO+c=\"}]';export DB_HOST=127.0.0.1;export DB_PORT=23306;export DB_USER=root;export DB_PASSWORD=test; yarn db-test-run; };r",
"db-test-run": "mocha --opts mocha.opts '**/*.spec.db.ts'",
"db-test-init": "r(){ export DB_ENCRYPTION_KEYS='[{\"name\":\"general\",\"version\":1,\"primary\":true,\"material\":\"5vRrp0H4oRgdkPnX1qQcS54Q0xggr6iyho42IQ1rO+c=\"}]';export DB_HOST=127.0.0.1;export DB_PORT=23306;export DB_USER=root;export DB_PASSWORD=test;find . -name \"*.sql\" | xargs cat | mysql -h $DB_HOST -P $DB_PORT -p$DB_PASSWORD -u root && yarn typeorm migrations:run; };r",
"db-test": "r(){ . $(leeway run components/gitpod-db:db-test-env); yarn db-test-run; };r",
"db-test-run": "mocha --opts mocha.opts '**/*.spec.db.ts' --exclude './node_modules/**'",
"wait-for-db": "node ./lib/wait-for-db.js",
"typeorm": "typeorm -f lib/typeorm/ormconfig",
"clean": "yarn run rimraf lib",

View File

@ -48,6 +48,7 @@ packages:
- components/image-builder-api/typescript:lib
- components/licensor/typescript:lib
- components/ws-manager-api/typescript:lib
- :dbtest
config:
packaging: library
yarnLock: ${coreYarnLockBase}/yarn.lock
@ -55,6 +56,29 @@ packages:
commands:
test: ["yarn", "test"]
build: ["npx", "tsc"]
- name: dbtest
type: yarn
srcs:
- "**/*.ts"
- package.json
- mocha.opts
deps:
- components/gitpod-db:dbtest-init
- components/gitpod-db:lib
- components/content-service-api/typescript:lib
- components/gitpod-messagebus:lib
- components/ee/payment-endpoint:lib
- components/gitpod-protocol:lib
- components/image-builder-api/typescript:lib
- components/licensor/typescript:lib
- components/ws-manager-api/typescript:lib
config:
packaging: library
yarnLock: ${coreYarnLockBase}/yarn.lock
tsconfig: tsconfig.json
commands:
test: ["yarn", "db-test"]
build: ["npx", "tsc"]
scripts:
- name: telepresence
script: |

View File

@ -18,7 +18,8 @@
"clean:node": "rimraf node_modules",
"purge": "yarn clean && yarn clean:node && yarn run rimraf yarn.lock",
"test": "mocha --opts mocha.opts './**/*.spec.ts' --exclude './node_modules/**'",
"db-test-run": "mocha --opts mocha.opts '**/*.spec.db.ts'",
"db-test": "r(){ . $(leeway run components/gitpod-db:db-test-env); yarn db-test-run; };r",
"db-test-run": "mocha --opts mocha.opts '**/*.spec.db.ts' --exclude './node_modules/**'",
"telepresence": "leeway run .:telepresence",
"graphql-codegen": "graphql-codegen --config src/ee/graphql/graphql-codegen.yml"
},