From af1c518f7cb4d99f8783b56e17a361d8ccea6f00 Mon Sep 17 00:00:00 2001
From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com>
Date: Mon, 31 Jan 2022 10:47:05 +0100
Subject: [PATCH 1/9] feat: add es dev for unit testing in pipelines

---
 .gitlab-ci.yml                                            | 4 +++-
 src/structures/services/structures-search.service.spec.ts | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4ef6f7f43..10bf83c67 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -41,7 +41,9 @@ test:
     - export GHOST_HOST_AND_PORT=http://localhost:2368
     - export GHOST_ADMIN_API_KEY=60142bc9e33940000156bccc:6217742e2671e322612e89cac9bab61fcd01822709fe5d8f5e6a5b3e54d5e6bb
     - export SALT=$TEST_SALT
-    - export ELASTICSEARCH_NODE=http://localhost:9200
+    - export ELASTICSEARCH_NODE=https://resin-dev.grandlyon.com/es
+    - export ELASTICSEARCH_NODE=elastic
+    - export ELASTICSEARCH_PASSWORD=${ELASTICSEARCH_DEV_PASSWORD}
   script:
     - npm i
     - npm run test:cov
diff --git a/src/structures/services/structures-search.service.spec.ts b/src/structures/services/structures-search.service.spec.ts
index 7719eb3ff..89939d999 100644
--- a/src/structures/services/structures-search.service.spec.ts
+++ b/src/structures/services/structures-search.service.spec.ts
@@ -8,7 +8,7 @@ import { StructuresSearchService } from './structures-search.service';
 import { StructuresService } from './structures.service';
 describe('StructuresSearchService', () => {
   let service: StructuresSearchService;
-  const isLocal = false; // mettre à true pour lancer les tests ES en local
+  const isLocal = true; // mettre à true pour lancer les tests ES en local
   const itif = (condition) => (condition ? it : it.skip);
 
   beforeEach(async () => {
-- 
GitLab


From 702f73ae289b659f1282e51f163a7097ae0cebb2 Mon Sep 17 00:00:00 2001
From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com>
Date: Mon, 31 Jan 2022 10:52:30 +0100
Subject: [PATCH 2/9] test

---
 .gitlab-ci.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 10bf83c67..c45f2f6ed 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -45,6 +45,7 @@ test:
     - export ELASTICSEARCH_NODE=elastic
     - export ELASTICSEARCH_PASSWORD=${ELASTICSEARCH_DEV_PASSWORD}
   script:
+    - curl https://resin-dev.grandlyon.com/es
     - npm i
     - npm run test:cov
   coverage: /All files[^|]*\|[^|]*\s+([\d\.]+)/
-- 
GitLab


From ce862f51411fbe2898af342eaae85143a7109ed8 Mon Sep 17 00:00:00 2001
From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com>
Date: Mon, 31 Jan 2022 10:59:46 +0100
Subject: [PATCH 3/9] test

---
 .gitlab-ci.yml | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c45f2f6ed..99fcb17f6 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -36,16 +36,13 @@ deploy_dev:
 
 test:
   stage: test
-  image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/node:14.15.4
+  image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:18.09
   before_script:
     - export GHOST_HOST_AND_PORT=http://localhost:2368
     - export GHOST_ADMIN_API_KEY=60142bc9e33940000156bccc:6217742e2671e322612e89cac9bab61fcd01822709fe5d8f5e6a5b3e54d5e6bb
     - export SALT=$TEST_SALT
-    - export ELASTICSEARCH_NODE=https://resin-dev.grandlyon.com/es
-    - export ELASTICSEARCH_NODE=elastic
-    - export ELASTICSEARCH_PASSWORD=${ELASTICSEARCH_DEV_PASSWORD}
+    - export ELASTICSEARCH_NODE=http://localhost:9200
   script:
-    - curl https://resin-dev.grandlyon.com/es
     - npm i
     - npm run test:cov
   coverage: /All files[^|]*\|[^|]*\s+([\d\.]+)/
-- 
GitLab


From b6169f266abd74a44732ab33a473b52944eede3c Mon Sep 17 00:00:00 2001
From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com>
Date: Mon, 31 Jan 2022 11:49:42 +0100
Subject: [PATCH 4/9] test

---
 .gitlab-ci.yml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 99fcb17f6..35c38e799 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -36,12 +36,14 @@ deploy_dev:
 
 test:
   stage: test
-  image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:18.09
+  image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/node:14.15.4
   before_script:
     - export GHOST_HOST_AND_PORT=http://localhost:2368
     - export GHOST_ADMIN_API_KEY=60142bc9e33940000156bccc:6217742e2671e322612e89cac9bab61fcd01822709fe5d8f5e6a5b3e54d5e6bb
     - export SALT=$TEST_SALT
-    - export ELASTICSEARCH_NODE=http://localhost:9200
+    - export ELASTICSEARCH_NODE=https://resin-dev.grandlyon.com/es
+    - export ELASTICSEARCH_NODE=elastic
+    - export ELASTICSEARCH_PASSWORD=$ELASTICSEARCH_DEV_PASSWORD
   script:
     - npm i
     - npm run test:cov
-- 
GitLab


From fc5b658c079cd3cdf4fcb938d377f73a1d5b5cbf Mon Sep 17 00:00:00 2001
From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com>
Date: Mon, 31 Jan 2022 11:52:01 +0100
Subject: [PATCH 5/9] test

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 35c38e799..5fc08d3a9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -41,7 +41,7 @@ test:
     - export GHOST_HOST_AND_PORT=http://localhost:2368
     - export GHOST_ADMIN_API_KEY=60142bc9e33940000156bccc:6217742e2671e322612e89cac9bab61fcd01822709fe5d8f5e6a5b3e54d5e6bb
     - export SALT=$TEST_SALT
-    - export ELASTICSEARCH_NODE=https://resin-dev.grandlyon.com/es
+    - export ELASTICSEARCH_NODE=https://localhost:9200
     - export ELASTICSEARCH_NODE=elastic
     - export ELASTICSEARCH_PASSWORD=$ELASTICSEARCH_DEV_PASSWORD
   script:
-- 
GitLab


From 238fd115b8cf778d6264c93e8c8448f6e2c9e8e7 Mon Sep 17 00:00:00 2001
From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com>
Date: Mon, 31 Jan 2022 14:13:00 +0100
Subject: [PATCH 6/9] test

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5fc08d3a9..b3ac7ab8a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -41,7 +41,7 @@ test:
     - export GHOST_HOST_AND_PORT=http://localhost:2368
     - export GHOST_ADMIN_API_KEY=60142bc9e33940000156bccc:6217742e2671e322612e89cac9bab61fcd01822709fe5d8f5e6a5b3e54d5e6bb
     - export SALT=$TEST_SALT
-    - export ELASTICSEARCH_NODE=https://localhost:9200
+    - export ELASTICSEARCH_NODE=http://localhost:9200
     - export ELASTICSEARCH_NODE=elastic
     - export ELASTICSEARCH_PASSWORD=$ELASTICSEARCH_DEV_PASSWORD
   script:
-- 
GitLab


From b87536a63a80b18b9b36643009710851edddf7a5 Mon Sep 17 00:00:00 2001
From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com>
Date: Mon, 31 Jan 2022 14:16:32 +0100
Subject: [PATCH 7/9] fix

---
 .gitlab-ci.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b3ac7ab8a..bab3879fa 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -41,8 +41,8 @@ test:
     - export GHOST_HOST_AND_PORT=http://localhost:2368
     - export GHOST_ADMIN_API_KEY=60142bc9e33940000156bccc:6217742e2671e322612e89cac9bab61fcd01822709fe5d8f5e6a5b3e54d5e6bb
     - export SALT=$TEST_SALT
-    - export ELASTICSEARCH_NODE=http://localhost:9200
-    - export ELASTICSEARCH_NODE=elastic
+    - export ELASTICSEARCH_NODE=http://resin-dev.grandlyon.com/es
+    - export ELASTICSEARCH_USERNAME=elastic
     - export ELASTICSEARCH_PASSWORD=$ELASTICSEARCH_DEV_PASSWORD
   script:
     - npm i
-- 
GitLab


From 8cd31f11e2b863234e39061941bfb703853455ca Mon Sep 17 00:00:00 2001
From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com>
Date: Mon, 31 Jan 2022 14:19:34 +0100
Subject: [PATCH 8/9] test

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index bab3879fa..972263b86 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -41,7 +41,7 @@ test:
     - export GHOST_HOST_AND_PORT=http://localhost:2368
     - export GHOST_ADMIN_API_KEY=60142bc9e33940000156bccc:6217742e2671e322612e89cac9bab61fcd01822709fe5d8f5e6a5b3e54d5e6bb
     - export SALT=$TEST_SALT
-    - export ELASTICSEARCH_NODE=http://resin-dev.grandlyon.com/es
+    - export ELASTICSEARCH_NODE=https://resin-dev.grandlyon.com/es
     - export ELASTICSEARCH_USERNAME=elastic
     - export ELASTICSEARCH_PASSWORD=$ELASTICSEARCH_DEV_PASSWORD
   script:
-- 
GitLab


From bc5f8e25948969d6e32f85ba4dfe15e9bb86e060 Mon Sep 17 00:00:00 2001
From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com>
Date: Mon, 31 Jan 2022 14:30:10 +0100
Subject: [PATCH 9/9] test

---
 .gitlab-ci.yml | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 972263b86..a10231ea2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -37,13 +37,15 @@ deploy_dev:
 test:
   stage: test
   image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/node:14.15.4
+  services:
+    - name: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/elasticsearch:7.16.2
+      alias: elasticsearch
+      command: ['bin/elasticsearch', '-Expack.security.enabled=false', '-Ediscovery.type=single-node']
   before_script:
     - export GHOST_HOST_AND_PORT=http://localhost:2368
     - export GHOST_ADMIN_API_KEY=60142bc9e33940000156bccc:6217742e2671e322612e89cac9bab61fcd01822709fe5d8f5e6a5b3e54d5e6bb
     - export SALT=$TEST_SALT
-    - export ELASTICSEARCH_NODE=https://resin-dev.grandlyon.com/es
-    - export ELASTICSEARCH_USERNAME=elastic
-    - export ELASTICSEARCH_PASSWORD=$ELASTICSEARCH_DEV_PASSWORD
+    - export ELASTICSEARCH_NODE=http://elasticsearch:9200
   script:
     - npm i
     - npm run test:cov
-- 
GitLab