From e9e4944550b9caba4b088ef10f1070c711b1d63e Mon Sep 17 00:00:00 2001
From: Sergey Dolin <dsame@github.com>
Date: Fri, 16 Jun 2023 14:17:41 +0200
Subject: [PATCH] imporve e2e tests

---
 .github/workflows/e2e-cache.yml  | 50 +-------------------------------
 __tests__/prepare-subprojects.sh | 48 ++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 49 deletions(-)
 create mode 100755 __tests__/prepare-subprojects.sh

diff --git a/.github/workflows/e2e-cache.yml b/.github/workflows/e2e-cache.yml
index 0d0da14c..901ed87c 100644
--- a/.github/workflows/e2e-cache.yml
+++ b/.github/workflows/e2e-cache.yml
@@ -146,55 +146,7 @@ jobs:
       - uses: actions/checkout@v3
 
       - name: prepare sub-projects
-        env:
-          YARN_ENABLE_IMMUTABLE_INSTALLS: false
-        run: |
-          rm package.json
-          rm package-lock.json
-          echo "create yarn2 project in the sub2"
-          mkdir sub2
-          cd sub2
-          cat <<EOT >package.json
-          {
-            "name": "subproject",
-            "dependencies": {
-              "random": "^3.0.6",
-              "uuid": "^9.0.0"
-            }
-          }
-          EOT
-          yarn set version 2.4.3
-          yarn install
-
-          echo "create yarn3 project in the sub3"
-          cd ..
-          mkdir sub3
-          cd sub3
-          cat <<EOT >package.json
-          {
-            "name": "subproject",
-            "dependencies": {
-              "random": "^3.0.6",
-              "uuid": "^9.0.0"
-            }
-          }
-          EOT
-          yarn set version 3.5.1
-          yarn install
-
-          echo "create yarn1 project in the root"
-          cd ..
-          cat <<EOT >package.json
-          {
-            "name": "subproject",
-            "dependencies": {
-              "random": "^3.0.6",
-              "uuid": "^9.0.0"
-            }
-          }
-          EOT
-          yarn set version 1.22.19
-          yarn install
+        run: __tests__/prepare-subprojects.sh
 
       # expect
       #  - no errors
diff --git a/__tests__/prepare-subprojects.sh b/__tests__/prepare-subprojects.sh
new file mode 100755
index 00000000..447cc531
--- /dev/null
+++ b/__tests__/prepare-subprojects.sh
@@ -0,0 +1,48 @@
+#!/bin/sh -e
+export YARN_ENABLE_IMMUTABLE_INSTALLS=false
+rm package.json
+rm package-lock.json
+echo "create yarn2 project in the sub2"
+mkdir sub2
+cd sub2
+cat <<EOT >package.json
+{
+  "name": "subproject",
+  "dependencies": {
+    "random": "^3.0.6",
+    "uuid": "^9.0.0"
+  }
+}
+EOT
+yarn set version 2.4.3
+yarn install
+
+echo "create yarn3 project in the sub3"
+cd ..
+mkdir sub3
+cd sub3
+cat <<EOT >package.json
+{
+  "name": "subproject",
+  "dependencies": {
+    "random": "^3.0.6",
+    "uuid": "^9.0.0"
+  }
+}
+EOT
+yarn set version 3.5.1
+yarn install
+
+echo "create yarn1 project in the root"
+cd ..
+cat <<EOT >package.json
+{
+  "name": "subproject",
+  "dependencies": {
+    "random": "^3.0.6",
+    "uuid": "^9.0.0"
+  }
+}
+EOT
+yarn set version 1.22.19
+yarn install
\ No newline at end of file