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.
This commit is contained in:
John McLear 2021-02-18 18:49:43 +00:00 committed by GitHub
parent 13e4451c2b
commit 9fb2c640b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 91 additions and 14 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
* text=auto eol=lf

View File

@ -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

View File

@ -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';