refs #5739 feat: start docker test front and e2e
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2024-01-08 15:47:47 +01:00
parent 593b58134e
commit 61fa3a62db
7 changed files with 36 additions and 10 deletions

View File

@ -23,7 +23,7 @@ services:
front: front:
image: front image: front
restart: always restart: always
command: ["npm", "run", "test:front:ci"] command: ["npx", "jest", "--ci --maxWorkers=2"]
build: build:
context: . context: .
dockerfile: front/Dockerfile.test dockerfile: front/Dockerfile.test
@ -40,8 +40,18 @@ services:
- NODE_ENV - NODE_ENV
depends_on: depends_on:
- db - db
e2e:
image: e2e
restart: always
build:
context: .
dockerfile: e2e/Dockerfile
environment:
- NODE_ENV
depends_on:
- front
networks: # networks:
stack-network: # stack-network:
driver: host # driver: host

6
e2e/Dockerfile Normal file
View File

@ -0,0 +1,6 @@
FROM front
WORKDIR /salix
COPY e2e e2e
CMD ["node", "e2e/helpers/tests.js"]

View File

@ -1,3 +1,3 @@
module.exports = { module.exports = {
url: 'http://localhost:5000' url: 'http://back:5000'
}; };

View File

@ -4,7 +4,7 @@ require('regenerator-runtime/runtime');
require('vn-loopback/server/boot/date')(); require('vn-loopback/server/boot/date')();
const axios = require('axios'); const axios = require('axios');
const Docker = require('../../db/docker.js'); // const Docker = require('../../db/docker.js');
const e2eConfig = require('./config.js'); const e2eConfig = require('./config.js');
const log = require('fancy-log'); const log = require('fancy-log');
@ -18,9 +18,9 @@ async function test() {
if (process.argv[2] === 'show') if (process.argv[2] === 'show')
process.env.E2E_SHOW = true; process.env.E2E_SHOW = true;
const container = new Docker('salix-db'); // const container = new Docker('salix-db');
await container.run(); // await container.run();
const Jasmine = require('jasmine'); const Jasmine = require('jasmine');
const jasmine = new Jasmine(); const jasmine = new Jasmine();
@ -56,7 +56,7 @@ async function test() {
} }
async function backendStatus() { async function backendStatus() {
log('Awaiting backend connection...'); log('Awaiting backend connection2...');
const milliseconds = 1000; const milliseconds = 1000;
const maxAttempts = 10; const maxAttempts = 10;

View File

@ -1,5 +1,6 @@
FROM back FROM back
EXPOSE 5000 EXPOSE 5000
WORKDIR /salix
COPY front front COPY front front
RUN npm i -g jest RUN npm i -g jest
@ -13,6 +14,7 @@ COPY fileMock.js ./
COPY /front/gulpfile.js ./ COPY /front/gulpfile.js ./
COPY /front/webpack.config.js ./ COPY /front/webpack.config.js ./
COPY /front/salix ./front/salix
COPY /front/core ./front/core
CMD ["npx", "gulp", "front"] CMD ["npx", "gulp", "front"]

7
runTestE2E.sh Normal file
View File

@ -0,0 +1,7 @@
docker-compose -p salix-test -f docker-compose.test.yml build --force-rm db
docker-compose -p salix-test -f docker-compose.test.yml build --force-rm back
docker-compose -p salix-test -f docker-compose.test.yml build --force-rm front
docker-compose -p salix-test -f docker-compose.test.yml build --force-rm e2e
docker-compose -p salix-test -f docker-compose.test.yml run e2e #--rm
# docker-compose -p salix-test -f docker-compose.test.yml down
# docker-compose -p salix-test -f docker-compose.test.yml rm

View File

@ -1,3 +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 run --rm front
docker-compose -p salix-test -f docker-compose.test.yml down 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-test -f docker-compose.test.yml rm