docker-compose.test.yml 3.83 KB
Newer Older
1
version: '2'
2 3 4 5 6 7

  # Ce fichier ressemble à docker-compose.yml, mais dupliqué car Docker CI
  # ne lit que ce fichier docker-compose.test.yml
  # (qui doit donc rester à la racine)
  # et il y a les variantes de port et de start

8
services:
Daniel Caillibaud's avatar
Daniel Caillibaud committed
9 10
  mailhogtest:
    image: mailhog/mailhog
11
  mongotest:
12
    image: mongo:4.0
13
  redistest:
Adrien Kiren's avatar
Adrien Kiren committed
14
    image: redis
15 16
  selenium:
    image: selenium/standalone-chrome:3.9.1-actinium
Dono's avatar
Dono committed
17

18
  biblitest.local:
Adrien Kiren's avatar
Adrien Kiren committed
19
    build: ./docker/sesatheque
Daniel Caillibaud's avatar
Daniel Caillibaud committed
20 21 22 23
    environment:
      - SESATHEQUE_CONF=testBibli
    ports:
      - 3011:3011
24 25 26
    links:
      - mongotest
      - redistest
Adrien Kiren's avatar
Adrien Kiren committed
27
    volumes:
28
      - ./docker/sesatheque/_privateConfig:/sesatheque/_private
Daniel Caillibaud's avatar
Daniel Caillibaud committed
29
      # cli loadRessouces inutile ici car sesalab poste ses fixtures via l'api
Daniel Caillibaud's avatar
Daniel Caillibaud committed
30 31
      # on lui exporte aussi un dossier de log pour les consulter plus facilement
      - ./log/bibliTest:/sesatheque/logs
Daniel Caillibaud's avatar
Daniel Caillibaud committed
32 33 34

    # On attend seulement mongo, redis est toujours plus rapide à démarrer
    command: "./scripts/wait-for-it.sh mongotest:27017 -t 30 --strict -- yarn start"
Adrien Kiren's avatar
Adrien Kiren committed
35

36
  communtest.local:
Adrien Kiren's avatar
Adrien Kiren committed
37
    build: ./docker/sesatheque
Daniel Caillibaud's avatar
Daniel Caillibaud committed
38 39 40
    environment:
      - SESATHEQUE_CONF=testCommun
    ports:
41 42 43 44 45
      - 3012:3012
    links:
      - mongotest
      - redistest
      - biblitest.local
Adrien Kiren's avatar
Adrien Kiren committed
46
    volumes:
47
      - ./docker/sesatheque/_privateConfig:/sesatheque/_private
Daniel Caillibaud's avatar
Daniel Caillibaud committed
48 49
      # on lui exporte aussi un dossier de log pour les consulter plus facilement
      - ./log/communTest:/sesatheque/logs
Daniel Caillibaud's avatar
Daniel Caillibaud committed
50
    command: "./scripts/wait-for-it.sh biblitest.local:3011 -t 30 --strict -- yarn start"
Adrien Kiren's avatar
Adrien Kiren committed
51

52
  sesalabtest.local:
Adrien Kiren's avatar
Adrien Kiren committed
53
    build: ./
Daniel Caillibaud's avatar
Daniel Caillibaud committed
54 55
    environment:
      - NODE_ENV=test
Adrien Kiren's avatar
Adrien Kiren committed
56 57
    volumes:
      - ./config:/sesalab/config
58
      - ./_private.exemple:/sesalab/_private.exemple
Daniel Caillibaud's avatar
Daniel Caillibaud committed
59
      - ./scripts:/sesalab/scripts
Adrien Kiren's avatar
Adrien Kiren committed
60 61 62
      - ./sesalab-api:/sesalab/sesalab-api
      - ./sesalab-commun:/sesalab/sesalab-commun
      - ./sesalab-eleve:/sesalab/sesalab-eleve
63
      - ./sesalab-formateur:/sesalab/sesalab-formateur
Adrien Kiren's avatar
Adrien Kiren committed
64 65 66 67
      - ./sesalab-gestion:/sesalab/sesalab-gestion
      - ./sesalab-home:/sesalab/sesalab-home
      - ./test:/sesalab/test
      - ./source:/sesalab/source
68
      - ./package.json:/sesalab/package.json
Daniel Caillibaud's avatar
Daniel Caillibaud committed
69
      - ./updates:/sesalab/updates
70
      # pour _private c'est copié dans le Dockerfile
Daniel Caillibaud's avatar
Daniel Caillibaud committed
71 72
      # logs
      - ./log/dockerTest:/sesalab/log
73

Daniel Caillibaud's avatar
Daniel Caillibaud committed
74
    ports:
75 76 77 78 79 80 81
      - 3010:3010
    links:
      - mongotest
      - redistest
      - biblitest.local
      - communtest.local
      - mailhogtest
Daniel Caillibaud's avatar
Daniel Caillibaud committed
82 83
    command: "./scripts/wait-for-it.sh communtest.local:3012 -t 30 --strict -- yarn run test:serve"

Adrien Kiren's avatar
Adrien Kiren committed
84 85
  # 'sut' est le nom du container de test automatiquement lancé par Docker CI
  # (https://docs.docker.com/docker-cloud/builds/automated-testing/)
Daniel Caillibaud's avatar
Daniel Caillibaud committed
86
  # et docker:test
Adrien Kiren's avatar
Adrien Kiren committed
87
  sut:
Daniel Caillibaud's avatar
Daniel Caillibaud committed
88 89 90
    build: ./
    environment:
      - NODE_ENV=test
91
    volumes:
92
      - ./config:/sesalab/config
93
      - ./_private.exemple:/sesalab/_private.exemple
94 95 96 97 98 99
      - ./sesalab-api:/sesalab/sesalab-api
      - ./sesalab-commun:/sesalab/sesalab-commun
      - ./sesalab-eleve:/sesalab/sesalab-eleve
      - ./sesalab-gestion:/sesalab/sesalab-gestion
      - ./sesalab-home:/sesalab/sesalab-home
      - ./test:/sesalab/test
100
      - ./source:/sesalab/source
101
      - ./package.json:/sesalab/package.json
102
      - ./_private.exemple/content:/sesalab/_private/content
Daniel Caillibaud's avatar
Daniel Caillibaud committed
103
      - ./log/dockerSut:/sesalab/log
104 105 106

      # Webdriver.io screenshots
      - ./screenshots:/sesalab/screenshots
107 108 109 110
    links:
      - selenium
      - mongotest
      - redistest
111 112
      # cette instance sut est une nouvelle instance de sesalab pour lancer les tests fonctionnels
      # elle a besoin de causer au sesalab "node" déclaré plus haut
113
      - sesalabtest.local
Daniel Caillibaud's avatar
Daniel Caillibaud committed
114
      # et elle a aussi besoin de causer à ces 2 sesatheques pour démarrer
115 116
      - biblitest.local
      - communtest.local
117 118 119
    environment:
      SELENIUM_HOST: selenium
      SELENIUM_PORT: 4444
Daniel Caillibaud's avatar
Daniel Caillibaud committed
120
    command: "./scripts/wait-for-it.sh sesalabtest.local:3010 -t 300 --strict -- npm run test:all"