mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) bump mocha version to allow parallel tests; move more tests to core
Summary: This uses a newer version of mocha in grist-core so that tests can be run in parallel. That allows more tests to be moved without slowing things down overall. Tests moved are venerable browser tests; only the ones that "just work" or worked without too much trouble to are moved, in order to keep the diff from growing too large. Will wrestle with more in follow up. Parallelism is at the file level, rather than the individual test. The newer version of mocha isn't needed for grist-saas repo; tests are parallelized in our internal CI by other means. I've chosen to allocate files to workers in a cruder way than our internal CI, based on initial characters rather than an automated process. The automated process would need some reworking to be compatible with mocha running in parallel mode. Test Plan: this diff was tested first on grist-core, then ported to grist-saas so saas repo history will correctly track history of moved files. Reviewers: jarek Reviewed By: jarek Subscribers: jarek Differential Revision: https://phab.getgrist.com/D3927
This commit is contained in:
3
test/fixtures/plugins/builtInPlugins/plugins/2/manifest.yml
vendored
Normal file
3
test/fixtures/plugins/builtInPlugins/plugins/2/manifest.yml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
version: 0.0.1
|
||||
contributions:
|
||||
importSources:
|
||||
12
test/fixtures/plugins/builtInPlugins/plugins/experimental-plugin/manifest.yml
vendored
Normal file
12
test/fixtures/plugins/builtInPlugins/plugins/experimental-plugin/manifest.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
name: crazy-plugin
|
||||
version: 0.0.1
|
||||
experimental: true
|
||||
components:
|
||||
safePython: sandbox/main.py
|
||||
|
||||
contributions:
|
||||
fileParsers:
|
||||
- fileExtensions: ["csv"]
|
||||
parseFile:
|
||||
component: "safePython"
|
||||
name: "csv_parser"
|
||||
1
test/fixtures/plugins/builtInPlugins/plugins/experimental-plugin/sandbox/main.py
vendored
Normal file
1
test/fixtures/plugins/builtInPlugins/plugins/experimental-plugin/sandbox/main.py
vendored
Normal file
@@ -0,0 +1 @@
|
||||
# nothing
|
||||
3
test/fixtures/plugins/builtInPlugins/plugins/invalid-contrib-point/manifest.yml
vendored
Normal file
3
test/fixtures/plugins/builtInPlugins/plugins/invalid-contrib-point/manifest.yml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
version: 0.0.1
|
||||
contributions:
|
||||
invalidContibutionPoint:
|
||||
14
test/fixtures/plugins/builtInPlugins/plugins/long-call/manifest.yml
vendored
Normal file
14
test/fixtures/plugins/builtInPlugins/plugins/long-call/manifest.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
name: pluginName
|
||||
version: 0.0.1
|
||||
components:
|
||||
safePython: sandbox/main.py
|
||||
deactivate:
|
||||
# Let's keep it low for tests to be fast, but big enough for test to be accurate.
|
||||
inactivitySec: 0.1
|
||||
|
||||
contributions:
|
||||
fileParsers:
|
||||
- fileExtensions: ["csv"]
|
||||
parseFile:
|
||||
component: "safePython"
|
||||
name: "csv_parser"
|
||||
28
test/fixtures/plugins/builtInPlugins/plugins/long-call/sandbox/main.py
vendored
Normal file
28
test/fixtures/plugins/builtInPlugins/plugins/long-call/sandbox/main.py
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import time
|
||||
import sandbox
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
# pylint: disable=no-member
|
||||
|
||||
def import_files(file_source, parse_options):
|
||||
end = time.time() + 1
|
||||
while time.time() < end:
|
||||
pass
|
||||
return {
|
||||
"parseOptions": {},
|
||||
# Make sure the output is a list of GristTables as documented at app/plugin/GristTable.ts
|
||||
"tables": [{
|
||||
"table_name": "mytable",
|
||||
"column_metadata": [],
|
||||
"table_data": [],
|
||||
}]
|
||||
}
|
||||
|
||||
|
||||
def main():
|
||||
sandbox.register("csv_parser.parseFile", import_files)
|
||||
sandbox.run() # pylint: disable=no-member
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
9
test/fixtures/plugins/builtInPlugins/plugins/missing-component/manifest.yml
vendored
Normal file
9
test/fixtures/plugins/builtInPlugins/plugins/missing-component/manifest.yml
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
name: missing-components
|
||||
version: 0.0.1
|
||||
# missing `components` entry
|
||||
contributions:
|
||||
fileParsers:
|
||||
- fileExtensions: ["csv"]
|
||||
parseFile:
|
||||
component: "safePython"
|
||||
name: "csv_parser"
|
||||
10
test/fixtures/plugins/builtInPlugins/plugins/missing-safePython/manifest.yml
vendored
Normal file
10
test/fixtures/plugins/builtInPlugins/plugins/missing-safePython/manifest.yml
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
name: missing-safePython
|
||||
version: 0.0.1
|
||||
components:
|
||||
# missing `safePython` component
|
||||
contributions:
|
||||
fileParsers:
|
||||
- fileExtensions: ["csv"]
|
||||
parseFile:
|
||||
component: "safePython"
|
||||
name: "csv_parser"
|
||||
14
test/fixtures/plugins/builtInPlugins/plugins/safePython-deactivate-fast/manifest.yml
vendored
Normal file
14
test/fixtures/plugins/builtInPlugins/plugins/safePython-deactivate-fast/manifest.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
name: pluginName
|
||||
version: 0.0.1
|
||||
components:
|
||||
safePython: sandbox/main.py
|
||||
deactivate:
|
||||
# Let's keep it low for tests to be fast, but big enough for test to be accurate.
|
||||
inactivitySec: 0.1
|
||||
|
||||
contributions:
|
||||
fileParsers:
|
||||
- fileExtensions: ["csv"]
|
||||
parseFile:
|
||||
component: "safePython"
|
||||
name: "csv_parser"
|
||||
28
test/fixtures/plugins/builtInPlugins/plugins/safePython-deactivate-fast/sandbox/main.py
vendored
Normal file
28
test/fixtures/plugins/builtInPlugins/plugins/safePython-deactivate-fast/sandbox/main.py
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import sandbox
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
# pylint: disable=no-member
|
||||
|
||||
# TODO: configure pylint behavior for both `test/fixtures/plugins` and
|
||||
# `/plugins` folders: either to ignore them completely or to ignore
|
||||
# above mentioned rules.
|
||||
|
||||
def import_files(file_source, parse_options=None):
|
||||
return {
|
||||
"parseOptions": {},
|
||||
"tables": [{
|
||||
"table_name": "mytable",
|
||||
"column_metadata": [],
|
||||
"table_data": []
|
||||
}]}
|
||||
|
||||
|
||||
def main():
|
||||
# Todo: Grist should expose a register method accepting arguments as
|
||||
# follow: register('csv_parser', 'importFiles', can_parse)
|
||||
sandbox.register("csv_parser.parseFile", import_files)
|
||||
sandbox.run() # pylint: disable=no-member
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
5
test/fixtures/plugins/builtInPlugins/plugins/testing-function-call-plugin/backend.js
vendored
Normal file
5
test/fixtures/plugins/builtInPlugins/plugins/testing-function-call-plugin/backend.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
const grist = require('grist-plugin-api');
|
||||
|
||||
grist.rpc.registerFunc("yo", (name) => `yo ${name}`);
|
||||
grist.rpc.registerFunc("yoSafePython", (name) => grist.rpc.callRemoteFunc("yo@sandbox/main.py", name));
|
||||
grist.ready();
|
||||
17
test/fixtures/plugins/builtInPlugins/plugins/testing-function-call-plugin/manifest.yml
vendored
Normal file
17
test/fixtures/plugins/builtInPlugins/plugins/testing-function-call-plugin/manifest.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
name: testPluginFunction
|
||||
version: 0.0.1
|
||||
components:
|
||||
safePython: sandbox/main.py
|
||||
unsafeNode: backend.js
|
||||
safeBrowser: main.js
|
||||
|
||||
# For the purpose of this unit-test contributions property is actually
|
||||
# NOT need and only provided for the sake of making this manifest
|
||||
# valid,
|
||||
|
||||
contributions:
|
||||
importSources:
|
||||
- importSource:
|
||||
component: "safeBrowser"
|
||||
name: index.html
|
||||
label: My safe importer
|
||||
15
test/fixtures/plugins/builtInPlugins/plugins/testing-function-call-plugin/sandbox/main.py
vendored
Normal file
15
test/fixtures/plugins/builtInPlugins/plugins/testing-function-call-plugin/sandbox/main.py
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import sandbox
|
||||
|
||||
def greet(name):
|
||||
return "Hi " + name
|
||||
|
||||
def yo(name):
|
||||
return "yo " + name + " from safePython"
|
||||
|
||||
def main():
|
||||
sandbox.register("greet", greet)
|
||||
sandbox.register("yo", yo)
|
||||
sandbox.run()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
11
test/fixtures/plugins/builtInPlugins/plugins/valid-file-parser/manifest.yml
vendored
Normal file
11
test/fixtures/plugins/builtInPlugins/plugins/valid-file-parser/manifest.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
name: pluginName
|
||||
version: 0.0.1
|
||||
components:
|
||||
safePython: sandbox/main.py
|
||||
|
||||
contributions:
|
||||
fileParsers:
|
||||
- fileExtensions: ["csv"]
|
||||
parseFile:
|
||||
component: "safePython"
|
||||
name: "csv_parser"
|
||||
29
test/fixtures/plugins/builtInPlugins/plugins/valid-file-parser/sandbox/main.py
vendored
Normal file
29
test/fixtures/plugins/builtInPlugins/plugins/valid-file-parser/sandbox/main.py
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
import sandbox
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
# pylint: disable=no-member
|
||||
|
||||
# TODO: configure pylint behavior for both `test/fixtures/plugins` and
|
||||
# `/plugins` folders: either to ignore them completely or to ignore
|
||||
# above mentioned rules.
|
||||
|
||||
def import_files(file_source, parse_options):
|
||||
parse_options.update({"NUM_ROWS" : 1})
|
||||
return {
|
||||
"parseOptions": parse_options,
|
||||
"tables": [{
|
||||
"table_name": "mytable",
|
||||
"column_metadata": [],
|
||||
"table_data": []
|
||||
}]}
|
||||
|
||||
|
||||
def main():
|
||||
# Todo: Grist should expose a register method accepting arguments as
|
||||
# follow: register('csv_parser', 'parseFile', can_parse)
|
||||
sandbox.register("csv_parser.parseFile", import_files)
|
||||
sandbox.run() # pylint: disable=no-member
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
10
test/fixtures/plugins/builtInPlugins/plugins/valid-import-source/manifest.yml
vendored
Normal file
10
test/fixtures/plugins/builtInPlugins/plugins/valid-import-source/manifest.yml
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
name: pluginName
|
||||
version: 0.0.1
|
||||
components:
|
||||
safeBrowser: '.'
|
||||
contributions:
|
||||
importSources:
|
||||
- importSource:
|
||||
component: "safeBrowser"
|
||||
name: index.html
|
||||
label: My safe importer
|
||||
1
test/fixtures/plugins/builtInPlugins/plugins/wrong-json/manifest.json
vendored
Normal file
1
test/fixtures/plugins/builtInPlugins/plugins/wrong-json/manifest.json
vendored
Normal file
@@ -0,0 +1 @@
|
||||
wrong manifest as well in json
|
||||
1
test/fixtures/plugins/builtInPlugins/plugins/wrong-yaml/manifest.yml
vendored
Normal file
1
test/fixtures/plugins/builtInPlugins/plugins/wrong-yaml/manifest.yml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
:some-wrong-manifest
|
||||
Reference in New Issue
Block a user