about summary refs log tree commit diff
path: root/.circleci
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-01-30 23:50:08 +0100
committerGitHub <noreply@github.com>2022-01-30 23:50:08 +0100
commita0e06c3c3e75da17326404dbdc4c38a6aab6b0bf (patch)
tree026dcb5c47e0d12a2fe486c1bbb2992a10e7319f /.circleci
parentc6b291afc3f6afe9b1c5df5808e9a5b40a4e06ce (diff)
Add more advanced migration tests (#17393)
- populate the database with some data when testing migrations
- try both one-step and two-step migrations (`SKIP_POST_DEPLOYMENT_MIGRATIONS`)
Diffstat (limited to '.circleci')
-rw-r--r--.circleci/config.yml39
1 files changed, 38 insertions, 1 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index e3e4f83d9..751ca95b1 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -122,8 +122,42 @@ jobs:
           command: ./bin/rails db:create
           name: Create database
       - run:
+          command: ./bin/rails db:migrate VERSION=20171010025614
+          name: Run migrations up to v2.0.0
+      - run:
+          command: ./bin/rails tests:migrations:populate_v2
+          name: Populate database with test data
+      - run:
           command: ./bin/rails db:migrate
-          name: Run migrations
+          name: Run all remaining migrations
+
+  test-two-step-migrations:
+    executor:
+      name: default
+      ruby-version: '3.0'
+    steps:
+      - checkout
+      - install-system-dependencies
+      - install-ruby-dependencies:
+          ruby-version: '3.0'
+      - wait-db
+      - run:
+          command: ./bin/rails db:create
+          name: Create database
+      - run:
+          command: ./bin/rails db:migrate VERSION=20171010025614
+          name: Run migrations up to v2.0.0
+      - run:
+          command: ./bin/rails tests:migrations:populate_v2
+          name: Populate database with test data
+      - run:
+          command: ./bin/rails db:migrate
+          name: Run all pre-deployment migrations
+          evironment:
+            SKIP_POST_DEPLOYMENT_MIGRATIONS: true
+      - run:
+          command: ./bin/rails db:migrate
+          name: Run all post-deployment remaining migrations
 
 workflows:
   version: 2
@@ -142,6 +176,9 @@ workflows:
       - test-migrations:
           requires:
             - build
+      - test-two-step-migrations:
+          requires:
+            - build
       - node/run:
           cache-version: v1
           name: test-webui