From 9fb2c640b9cabf4e6bd7870f059ee232d7efe2d7 Mon Sep 17 00:00:00 2001 From: John McLear Date: Thu, 18 Feb 2021 18:49:43 +0000 Subject: [PATCH] tests: Microsoft Windows Server CI (#4791) Due to a recent release that wasn't functioning properly this CI will help us catch the majority of Microsoft Node Quirks before they make it into a release. --- .gitattributes | 1 + .github/workflows/backend-tests.yml | 92 ++++++++++++++++++- .../backend/specs/api/importexportGetPost.js | 12 +-- 3 files changed, 91 insertions(+), 14 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..6313b56c5 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/.github/workflows/backend-tests.yml b/.github/workflows/backend-tests.yml index a9c8c602e..d87973f1c 100644 --- a/.github/workflows/backend-tests.yml +++ b/.github/workflows/backend-tests.yml @@ -4,13 +4,13 @@ name: "Backend tests" on: [push, pull_request] jobs: - withoutplugins: + withoutpluginsLinux: # run on pushes to any branch # run on PRs from external forks if: | (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id) - name: without plugins + name: Linux without plugins runs-on: ubuntu-latest steps: @@ -33,13 +33,13 @@ jobs: - name: Run the backend tests run: cd src && npm test - withplugins: + withpluginsLinux: # run on pushes to any branch # run on PRs from external forks if: | (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id) - name: with Plugins + name: Linux with Plugins runs-on: ubuntu-latest steps: @@ -85,3 +85,87 @@ jobs: - name: Run the backend tests run: cd src && npm test + + withoutpluginsWindows: + # run on pushes to any branch + # run on PRs from external forks + if: | + (github.event_name != 'pull_request') + || (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id) + name: Windows without plugins + runs-on: windows-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - uses: actions/setup-node@v2 + with: + node-version: 12 + + - name: Install all dependencies and symlink for ep_etherpad-lite + run: | + cd src + npm ci --no-optional + + - name: Fix up the settings.json + run: | + powershell -Command "(gc settings.json.template) -replace '\"max\": 10', '\"max\": 10000' | Out-File -encoding ASCII settings.json.holder" + powershell -Command "(gc settings.json.holder) -replace '\"points\": 10', '\"points\": 1000' | Out-File -encoding ASCII settings.json" + + - name: Run the backend tests + run: cd src && npm test + + withpluginsWindows: + # run on pushes to any branch + # run on PRs from external forks + if: | + (github.event_name != 'pull_request') + || (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id) + name: Windows with Plugins + runs-on: windows-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - uses: actions/setup-node@v2 + with: + node-version: 12 + + - name: Install Etherpad plugins + run: > + npm install + ep_align + ep_author_hover + ep_cursortrace + ep_font_size + ep_hash_auth + ep_headings2 + ep_image_upload + ep_markdown + ep_readonly_guest + ep_set_title_on_pad + ep_spellcheck + ep_subscript_and_superscript + ep_table_of_contents + + # This must be run after installing the plugins, otherwise npm will try to + # hoist common dependencies by removing them from src/node_modules and + # installing them in the top-level node_modules. As of v6.14.10, npm's hoist + # logic appears to be buggy, because it sometimes removes dependencies from + # src/node_modules but fails to add them to the top-level node_modules. Even + # if npm correctly hoists the dependencies, the hoisting seems to confuse + # tools such as `npm outdated`, `npm update`, and some ESLint rules. + - name: Install all dependencies and symlink for ep_etherpad-lite + run: | + cd src + npm ci --no-optional + + - name: Fix up the settings.json + run: | + powershell -Command "(gc settings.json.template) -replace '\"max\": 10', '\"max\": 10000' | Out-File -encoding ASCII settings.json.holder" + powershell -Command "(gc settings.json.holder) -replace '\"points\": 10', '\"points\": 1000' | Out-File -encoding ASCII settings.json" + + - name: Run the backend tests + run: cd src && npm test diff --git a/src/tests/backend/specs/api/importexportGetPost.js b/src/tests/backend/specs/api/importexportGetPost.js index fbd5b944d..9261aafa6 100644 --- a/src/tests/backend/specs/api/importexportGetPost.js +++ b/src/tests/backend/specs/api/importexportGetPost.js @@ -280,6 +280,8 @@ describe(__filename, function () { return pad; }; + this.timeout(1000); + beforeEach(async function () { await deleteTestPad(); settings.requireAuthorization = true; @@ -292,7 +294,6 @@ describe(__filename, function () { }); it('!authn !exist -> create', async function () { - this.timeout(100); await agent.post(`/p/${testPadIdEnc}/import`) .attach('file', padText, {filename: '/test.txt', contentType: 'text/plain'}) .expect(200); @@ -302,7 +303,6 @@ describe(__filename, function () { }); it('!authn exist -> replace', async function () { - this.timeout(100); const pad = await createTestPad('before import'); await agent.post(`/p/${testPadIdEnc}/import`) .attach('file', padText, {filename: '/test.txt', contentType: 'text/plain'}) @@ -312,7 +312,6 @@ describe(__filename, function () { }); it('authn anonymous !exist -> fail', async function () { - this.timeout(100); settings.requireAuthentication = true; await agent.post(`/p/${testPadIdEnc}/import`) .attach('file', padText, {filename: '/test.txt', contentType: 'text/plain'}) @@ -321,7 +320,6 @@ describe(__filename, function () { }); it('authn anonymous exist -> fail', async function () { - this.timeout(100); settings.requireAuthentication = true; const pad = await createTestPad('before import\n'); await agent.post(`/p/${testPadIdEnc}/import`) @@ -331,7 +329,6 @@ describe(__filename, function () { }); it('authn user create !exist -> create', async function () { - this.timeout(100); settings.requireAuthentication = true; await agent.post(`/p/${testPadIdEnc}/import`) .auth('user', 'user-password') @@ -343,7 +340,6 @@ describe(__filename, function () { }); it('authn user modify !exist -> fail', async function () { - this.timeout(100); settings.requireAuthentication = true; authorize = () => 'modify'; await agent.post(`/p/${testPadIdEnc}/import`) @@ -354,7 +350,6 @@ describe(__filename, function () { }); it('authn user readonly !exist -> fail', async function () { - this.timeout(100); settings.requireAuthentication = true; authorize = () => 'readOnly'; await agent.post(`/p/${testPadIdEnc}/import`) @@ -365,7 +360,6 @@ describe(__filename, function () { }); it('authn user create exist -> replace', async function () { - this.timeout(100); settings.requireAuthentication = true; const pad = await createTestPad('before import\n'); await agent.post(`/p/${testPadIdEnc}/import`) @@ -376,7 +370,6 @@ describe(__filename, function () { }); it('authn user modify exist -> replace', async function () { - this.timeout(100); settings.requireAuthentication = true; authorize = () => 'modify'; const pad = await createTestPad('before import\n'); @@ -388,7 +381,6 @@ describe(__filename, function () { }); it('authn user readonly exist -> fail', async function () { - this.timeout(100); const pad = await createTestPad('before import\n'); settings.requireAuthentication = true; authorize = () => 'readOnly';