new try with docker compose

This commit is contained in:
Moriz Wahl 2021-10-18 23:42:47 +02:00
parent 10b65487ee
commit 4be256575f
3 changed files with 11 additions and 37 deletions

View File

@ -353,7 +353,7 @@ jobs:
unit_test_backend: unit_test_backend:
name: Unit tests - Backend name: Unit tests - Backend
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [build_test_backend] needs: [build_test_backend, build_test_database_up]
steps: steps:
########################################################################## ##########################################################################
# CHECKOUT CODE ########################################################## # CHECKOUT CODE ##########################################################
@ -363,6 +363,13 @@ jobs:
########################################################################## ##########################################################################
# DOWNLOAD DOCKER IMAGES ################################################# # DOWNLOAD DOCKER IMAGES #################################################
########################################################################## ##########################################################################
- name: Download Docker Image (Database)
uses: actions/download-artifact@v2
with:
name: docker-database-test_up
path: /tmp
- name: Load Docker Image
run: docker load < /tmp/database_up.tar
- name: Download Docker Image (Backend) - name: Download Docker Image (Backend)
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
with: with:
@ -373,10 +380,10 @@ jobs:
########################################################################## ##########################################################################
# UNIT TESTS BACKEND ##################################################### # UNIT TESTS BACKEND #####################################################
########################################################################## ##########################################################################
- name: backend database | docker-compose - name: backend | docker-compose
run: docker-compose -f docker-compose.yml up --detach mariadb run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps database backend
- name: backend Unit tests | up - name: backend Unit tests | up
run: docker-compose -f docker-compose.yml -f docker-compose.test.yml run -T backend yarn run test run: docker-compose exec -T backend yarn run test
########################################################################## ##########################################################################
# COVERAGE CHECK BACKEND ################################################# # COVERAGE CHECK BACKEND #################################################
########################################################################## ##########################################################################

View File

@ -6,7 +6,6 @@ import isAuthorized from './directive/isAuthorized'
const schema = async (): Promise<GraphQLSchema> => { const schema = async (): Promise<GraphQLSchema> => {
return buildSchema({ return buildSchema({
// ?!.*\.test\.js$
resolvers: [path.join(__dirname, 'resolver', `!(*.test).{js,ts}`)], resolvers: [path.join(__dirname, 'resolver', `!(*.test).{js,ts}`)],
authChecker: isAuthorized, authChecker: isAuthorized,
}) })

View File

@ -1,32 +0,0 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { ApolloServer } from 'apollo-server-express'
import express from 'express'
import cors from './server/cors'
// import context from './server/context'
import plugins from './server/plugins'
import CONFIG from './config'
// graphql
import schema from './graphql/schema'
const createTestServer = async (): Promise<any> => {
// Express Server
const server = express()
// cors
server.use(cors)
// Apollo Server
const apollo = new ApolloServer({
schema: await schema(),
playground: CONFIG.GRAPHIQL,
// context,
plugins,
})
apollo.applyMiddleware({ app: server })
return apollo
}
export default createTestServer