From d0e64dff2bca850d6ef597ec79a0b168b707a671 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 12 Jan 2024 10:49:02 +0100 Subject: [PATCH] refs #5739 feat: try run test back and front --- Jenkinsfile | 21 +++++++++++---------- back/Dockerfile | 3 ++- docker-compose.test.yml | 23 ++++++++++++----------- front/Dockerfile.test | 3 ++- package.json | 2 +- runTestBack.sh | 9 +++++---- runTestFront.sh | 8 ++++---- 7 files changed, 37 insertions(+), 32 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fdb1fe8b2..95b2d4118 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -39,7 +39,8 @@ pipeline { NODE_ENV = "" } steps { - sh "docker-compose -p salix-testing -f docker-compose.test.yml build --force-rm back db" + sh "docker-compose -p testing-${env.STACK_NAME} -f docker-compose.test.yml build --no-cache --force-rm db" + sh "docker-compose -p testing-${env.STACK_NAME} -f docker-compose.test.yml build --force-rm back front" } } stage('Test') { @@ -52,19 +53,19 @@ pipeline { TZ = 'Europe/Madrid' } parallel { - // stage('Frontend') { - // steps { - // sh "docker-compose -p salix-testing -f docker-compose.test.yml run --rm front" - // } - // } + stage('Frontend') { + steps { + sh "docker-compose -p testing-${env.STACK_NAME} -f docker-compose.test.yml run --rm front" + } + } stage('Backend') { steps { - sh "docker-compose -p salix-testing -f docker-compose.test.yml run --rm back" + sh "docker-compose -p testing-${env.STACK_NAME} -f docker-compose.test.yml run --rm back" } } } } - stage('ClearTest') { + stage('ClearTesting') { when { not { anyOf { branch 'test' branch 'master' @@ -74,8 +75,8 @@ pipeline { TZ = 'Europe/Madrid' } steps { - sh "docker-compose -p salix-testing -f docker-compose.test.yml down" - sh "docker-compose -p salix-testing -f docker-compose.test.yml rm" + sh "docker-compose -p testing-${env.STACK_NAME} -f docker-compose.test.yml down" + sh "docker-compose -p testing-${env.STACK_NAME} -f docker-compose.test.yml rm" // sh "docker-compose -p salix-testing -f docker-compose.test.yml run --rm front" } } diff --git a/back/Dockerfile b/back/Dockerfile index 66ab32ebc..87abe87c0 100644 --- a/back/Dockerfile +++ b/back/Dockerfile @@ -56,5 +56,6 @@ COPY modules modules COPY print print COPY storage storage + # CMD ["npx", "gulp", "backOnly"] -CMD ["node", "back/tests.js", "ci"] +# CMD ["node", "back/tests.js", "ci"] diff --git a/docker-compose.test.yml b/docker-compose.test.yml index b3387c00b..753359afe 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -23,7 +23,7 @@ services: front: image: front restart: always - command: ["npx", "jest", "--ci --maxWorkers=2"] + command: ["npx", "jest", "--ci", "--maxWorkers=2"] build: context: . dockerfile: front/Dockerfile.test @@ -32,6 +32,7 @@ services: back: image: back restart: always + command: ["node", "back/tests.js", "ci"] build: context: . dockerfile: back/Dockerfile @@ -40,16 +41,16 @@ services: - NODE_ENV depends_on: - db - e2e: - image: e2e - restart: always - build: - context: . - dockerfile: e2e/Dockerfile - environment: - - NODE_ENV - depends_on: - - front + # e2e: + # image: e2e + # restart: always + # build: + # context: . + # dockerfile: e2e/Dockerfile + # environment: + # - NODE_ENV + # depends_on: + # - front # networks: # stack-network: diff --git a/front/Dockerfile.test b/front/Dockerfile.test index 40067c846..5255b5237 100644 --- a/front/Dockerfile.test +++ b/front/Dockerfile.test @@ -3,13 +3,14 @@ EXPOSE 5000 WORKDIR /salix COPY front front -RUN npm i -g jest +# RUN npm i -g jest RUN cd front && npm install --ci COPY modules modules COPY dist dist COPY jest-front.js ./ COPY jest.front.config.js ./ +COPY babel.config.js ./ COPY fileMock.js ./ COPY /front/gulpfile.js ./ diff --git a/package.json b/package.json index 1634019a9..5a8c11d92 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "test:back": "sh runTestBack.sh", "test:e2e": "node e2e/helpers/tests.js", "test:front": "sh runTestFront.sh", - "test:front:ci": "jest --ci --maxWorkers=2", + "test:front:ci": "npx jest --ci --maxWorkers=2", "back": "nodemon --inspect -w modules ./node_modules/gulp/bin/gulp.js back", "lint": "eslint ./ --cache --ignore-pattern .gitignore", "docker": "docker build --progress=plain -t salix-db ./db", diff --git a/runTestBack.sh b/runTestBack.sh index 1c05e60d6..786627ccd 100644 --- a/runTestBack.sh +++ b/runTestBack.sh @@ -1,4 +1,5 @@ -docker-compose -p salix-test -f docker-compose.test.yml build --force-rm back db -docker-compose -p salix-test -f docker-compose.test.yml run --rm back -docker-compose -p salix-test -f docker-compose.test.yml down -docker-compose -p salix-test -f docker-compose.test.yml rm +# docker-compose -p salix-testing -f docker-compose.test.yml build --no-cache --force-rm db +docker-compose -p salix-testing -f docker-compose.test.yml build --force-rm back +docker-compose -p salix-testing -f docker-compose.test.yml run --rm back +docker-compose -p salix-testing -f docker-compose.test.yml down +docker-compose -p salix-testing -f docker-compose.test.yml rm diff --git a/runTestFront.sh b/runTestFront.sh index 7dad37a78..d2ceb3ff9 100644 --- a/runTestFront.sh +++ b/runTestFront.sh @@ -1,4 +1,4 @@ -docker-compose -p salix-test -f docker-compose.test.yml build --force-rm front -docker-compose -p salix-test -f docker-compose.test.yml run --rm front -docker-compose -p salix-test -f docker-compose.test.yml down -docker-compose -p salix-test -f docker-compose.test.yml rm +docker-compose -p salix-testing -f docker-compose.test.yml build --force-rm front +docker-compose -p salix-testing -f docker-compose.test.yml run --rm front +docker-compose -p salix-testing -f docker-compose.test.yml down +docker-compose -p salix-testing -f docker-compose.test.yml rm