From 9a1fef50a0cf0cafcb058595d3528ba3d66eb7b1 Mon Sep 17 00:00:00 2001 From: Pavel Schoffer Date: Wed, 10 Aug 2022 11:40:41 +0200 Subject: [PATCH 1/5] e2e test --- .github/workflows/tests.yml | 15 +++++++++------ __tests__/e2e_test.bat | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 __tests__/e2e_test.bat diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f50d77049..0dcf6cef3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -31,11 +31,14 @@ jobs: run: npm ci working-directory: vip - - name: Unit Tests - working-directory: vip - run: npm run jest - + # - name: Unit Tests + # working-directory: vip + # run: npm run jest + + # - name: Build it + # working-directory: vip + # run: npm run pack + - name: Test Command line working-directory: vip - run: | - node ./dist/bin/vip app + run: ./__tests__/e2e_test.bat diff --git a/__tests__/e2e_test.bat b/__tests__/e2e_test.bat new file mode 100644 index 000000000..621904fab --- /dev/null +++ b/__tests__/e2e_test.bat @@ -0,0 +1,32 @@ + +call npm pack + +echo "== Installing vip" + +FOR /R "." %%f IN ( *.tgz) DO ( + call npm i -g %%f +) + +echo "== Running e2e tests" + +call vip --help + +rem dev-env tests + +echo "== Creating dev-env" + +call vip dev-env create --client-code image --title Test --multisite false --php 8.0 --wordpress 6.0 --mu-plugins image -e false -p false -x false + +if NOT %errorlevel% == 0 ( + echo "== Failed to create dev-env" + exit 1 +) + +echo "== Starting dev-env" + +call vip dev-env start + +if NOT %errorlevel% == 0 ( + echo "== Dev-env failed to start" + exit 1 +) \ No newline at end of file From 8367285992aa7e7ae1df7ff9570e12a5affdbd90 Mon Sep 17 00:00:00 2001 From: Pavel Schoffer Date: Thu, 11 Aug 2022 14:20:37 +0200 Subject: [PATCH 2/5] skip wp check --- __tests__/e2e_test.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests__/e2e_test.bat b/__tests__/e2e_test.bat index 621904fab..3ea7c38e7 100644 --- a/__tests__/e2e_test.bat +++ b/__tests__/e2e_test.bat @@ -24,7 +24,7 @@ if NOT %errorlevel% == 0 ( echo "== Starting dev-env" -call vip dev-env start +call vip dev-env start --skip-wp-versions-check if NOT %errorlevel% == 0 ( echo "== Dev-env failed to start" From 273f1ceb1f6abd2163d07793dcfa2882f2db2168 Mon Sep 17 00:00:00 2001 From: Pavel Schoffer Date: Thu, 11 Aug 2022 14:46:23 +0200 Subject: [PATCH 3/5] test --- .github/workflows/tests.yml | 84 ++++++++++++++++++++----------------- __tests__/e2e_test.bat | 65 +++++++++++++++++++--------- 2 files changed, 91 insertions(+), 58 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0dcf6cef3..9297e8cc7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,44 +1,52 @@ -name: Run VIP-cli tests +name: Run linux based image on: pull_request -env: - NODE_OPTIONS: --unhandled-rejections=warn - jobs: - Run_windows_tests: - name: Run Windows Tests + Try_pull_image: + name: Try pull Image runs-on: windows-latest steps: - # To prevent issues with fixtures on Windows tests - - name: Set git to use LF - run: | - git config --global core.autocrlf false - git config --global core.eol lf - - - name: Check out repository code - uses: actions/checkout@v2 - with: - submodules: true - path: vip - - - name: Setup Node - uses: actions/setup-node@v2 - with: - node-version: 'lts/*' - - - name: Install dependencies - run: npm ci - working-directory: vip - - # - name: Unit Tests - # working-directory: vip - # run: npm run jest - - # - name: Build it - # working-directory: vip - # run: npm run pack - - - name: Test Command line - working-directory: vip - run: ./__tests__/e2e_test.bat + - name: Image pull step + run: docker pull ubuntu + +# name: Run VIP-cli tests +# on: +# pull_request + +# env: +# NODE_OPTIONS: --unhandled-rejections=warn + +# jobs: +# Run_windows_tests: +# name: Run Windows Tests +# runs-on: windows-latest +# steps: +# # To prevent issues with fixtures on Windows tests +# - name: Set git to use LF +# run: | +# git config --global core.autocrlf false +# git config --global core.eol lf + +# - name: Check out repository code +# uses: actions/checkout@v2 +# with: +# submodules: true +# path: vip + +# - name: Setup Node +# uses: actions/setup-node@v2 +# with: +# node-version: 'lts/*' + +# # - name: Install dependencies +# # run: npm ci +# # working-directory: vip + +# # - name: Unit Tests +# # working-directory: vip +# # run: npm run jest + +# - name: Test Command line +# working-directory: vip +# run: ./__tests__/e2e_test.bat diff --git a/__tests__/e2e_test.bat b/__tests__/e2e_test.bat index 3ea7c38e7..59bf4e669 100644 --- a/__tests__/e2e_test.bat +++ b/__tests__/e2e_test.bat @@ -1,32 +1,57 @@ -call npm pack +@REM call DockerCli -SwitchLinuxEngine +call docker version +call where docker +@REM call dir "C:\Program Files\Docker" +call where docker-compose -echo "== Installing vip" +@REM call dir \s DockerCli.exe +C: +call dir \s DockerCli.exe +@REM call dir "C:\ProgramData\Chocolatey" -FOR /R "." %%f IN ( *.tgz) DO ( - call npm i -g %%f -) +@REM call cat "C:\ProgramData\Docker\config\daemon.json" -echo "== Running e2e tests" +@REM call Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart +call Install-Module -Name DockerMsftProvider -Repository PSGallery -Force +call Get-PackageProvider -ListAvailableget-packagesource -ProviderName DockerMsftProvider -call vip --help +call wsl -l -o -rem dev-env tests +call wsl --status -echo "== Creating dev-env" +call systeminfo -call vip dev-env create --client-code image --title Test --multisite false --php 8.0 --wordpress 6.0 --mu-plugins image -e false -p false -x false +call docker pull ubuntu -if NOT %errorlevel% == 0 ( - echo "== Failed to create dev-env" - exit 1 -) +@REM call npm pack -echo "== Starting dev-env" +@REM echo "== Installing vip" -call vip dev-env start --skip-wp-versions-check +@REM FOR /R "." %%f IN ( *.tgz) DO ( +@REM call npm i -g %%f +@REM ) -if NOT %errorlevel% == 0 ( - echo "== Dev-env failed to start" - exit 1 -) \ No newline at end of file +@REM echo "== Running e2e tests" + +@REM call vip --help + +@REM rem dev-env tests + +@REM echo "== Creating dev-env" + +@REM call vip dev-env create --client-code image --title Test --multisite false --php 8.0 --wordpress 6.0 --mu-plugins image -e false -p false -x false + +@REM if NOT %errorlevel% == 0 ( +@REM echo "== Failed to create dev-env" +@REM exit 1 +@REM ) + +@REM echo "== Starting dev-env" + +@REM call vip dev-env start --skip-wp-versions-check + +@REM if NOT %errorlevel% == 0 ( +@REM echo "== Dev-env failed to start" +@REM exit 1 +@REM ) \ No newline at end of file From 9aedbbe91f3a605abfa8e79b0755ee945d84e968 Mon Sep 17 00:00:00 2001 From: Pavel Schoffer Date: Fri, 12 Aug 2022 12:11:30 +0200 Subject: [PATCH 4/5] reduce scope --- .github/workflows/tests.yml | 80 ++++++++++++++++--------------------- __tests__/e2e_test.bat | 63 +++++++---------------------- 2 files changed, 48 insertions(+), 95 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9297e8cc7..ff973f6e9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,52 +1,40 @@ -name: Run linux based image +name: Run VIP-cli tests on: pull_request +env: + NODE_OPTIONS: --unhandled-rejections=warn + jobs: - Try_pull_image: - name: Try pull Image + Run_windows_tests: + name: Run Windows Tests runs-on: windows-latest steps: - - name: Image pull step - run: docker pull ubuntu - -# name: Run VIP-cli tests -# on: -# pull_request - -# env: -# NODE_OPTIONS: --unhandled-rejections=warn - -# jobs: -# Run_windows_tests: -# name: Run Windows Tests -# runs-on: windows-latest -# steps: -# # To prevent issues with fixtures on Windows tests -# - name: Set git to use LF -# run: | -# git config --global core.autocrlf false -# git config --global core.eol lf - -# - name: Check out repository code -# uses: actions/checkout@v2 -# with: -# submodules: true -# path: vip - -# - name: Setup Node -# uses: actions/setup-node@v2 -# with: -# node-version: 'lts/*' - -# # - name: Install dependencies -# # run: npm ci -# # working-directory: vip - -# # - name: Unit Tests -# # working-directory: vip -# # run: npm run jest - -# - name: Test Command line -# working-directory: vip -# run: ./__tests__/e2e_test.bat + # To prevent issues with fixtures on Windows tests + - name: Set git to use LF + run: | + git config --global core.autocrlf false + git config --global core.eol lf + + - name: Check out repository code + uses: actions/checkout@v2 + with: + submodules: true + path: vip + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: 'lts/*' + + - name: Install dependencies + run: npm ci + working-directory: vip + + - name: Unit Tests + working-directory: vip + run: npm run jest + + - name: Test Command line + working-directory: vip + run: ./__tests__/e2e_test.bat diff --git a/__tests__/e2e_test.bat b/__tests__/e2e_test.bat index 59bf4e669..a132c5301 100644 --- a/__tests__/e2e_test.bat +++ b/__tests__/e2e_test.bat @@ -1,57 +1,22 @@ +call npm pack -@REM call DockerCli -SwitchLinuxEngine -call docker version -call where docker -@REM call dir "C:\Program Files\Docker" -call where docker-compose +echo "== Installing vip" -@REM call dir \s DockerCli.exe -C: -call dir \s DockerCli.exe -@REM call dir "C:\ProgramData\Chocolatey" +FOR /R "." %%f IN ( *.tgz) DO ( + call npm i -g %%f +) -@REM call cat "C:\ProgramData\Docker\config\daemon.json" +echo "== Running e2e tests" -@REM call Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart -call Install-Module -Name DockerMsftProvider -Repository PSGallery -Force -call Get-PackageProvider -ListAvailableget-packagesource -ProviderName DockerMsftProvider +call vip --help -call wsl -l -o +rem dev-env tests -call wsl --status +echo "== Creating dev-env" -call systeminfo +call vip dev-env create --client-code image --title Test --multisite false --php 8.0 --wordpress 6.0 --mu-plugins image -e false -p false -x false -call docker pull ubuntu - -@REM call npm pack - -@REM echo "== Installing vip" - -@REM FOR /R "." %%f IN ( *.tgz) DO ( -@REM call npm i -g %%f -@REM ) - -@REM echo "== Running e2e tests" - -@REM call vip --help - -@REM rem dev-env tests - -@REM echo "== Creating dev-env" - -@REM call vip dev-env create --client-code image --title Test --multisite false --php 8.0 --wordpress 6.0 --mu-plugins image -e false -p false -x false - -@REM if NOT %errorlevel% == 0 ( -@REM echo "== Failed to create dev-env" -@REM exit 1 -@REM ) - -@REM echo "== Starting dev-env" - -@REM call vip dev-env start --skip-wp-versions-check - -@REM if NOT %errorlevel% == 0 ( -@REM echo "== Dev-env failed to start" -@REM exit 1 -@REM ) \ No newline at end of file +if NOT %errorlevel% == 0 ( + echo "== Failed to create dev-env" + exit 1 +) From 9c884aec4fb639579c230dd18afe0750060077f8 Mon Sep 17 00:00:00 2001 From: Pavel Schoffer Date: Mon, 15 Aug 2022 14:06:06 +0200 Subject: [PATCH 5/5] check config created --- __tests__/e2e_test.bat | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/__tests__/e2e_test.bat b/__tests__/e2e_test.bat index a132c5301..d98518063 100644 --- a/__tests__/e2e_test.bat +++ b/__tests__/e2e_test.bat @@ -20,3 +20,15 @@ if NOT %errorlevel% == 0 ( echo "== Failed to create dev-env" exit 1 ) + +call ls -al C:\Users\runneradmin\.local\share\vip\dev-environment\vip-local +if NOT %errorlevel% == 0 ( + echo "== local environment folder not found" + exit 1 +) + +call cat C:\Users\runneradmin\.local\share\vip\dev-environment\vip-local\.lando.yml +if NOT %errorlevel% == 0 ( + echo "== local environment lando config not found" + exit 1 +)