Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: integration test battery #3654

Merged
merged 61 commits into from
Jul 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
bacfa16
pytest: add pytest-xdist to developer dependencies
oliver-sanders May 18, 2020
7d09997
scheduler: open up python api to scheduler class
oliver-sanders May 14, 2020
6dc3b86
tests: scheduler_cli
oliver-sanders May 14, 2020
e7ccde2
itests: new integration test framework for cylc in python
oliver-sanders May 18, 2020
e2cc259
itests: meta-testing
oliver-sanders May 18, 2020
f0dc942
tests: add readme files to explain differences
oliver-sanders May 18, 2020
526b56a
itests: conftest setup
oliver-sanders May 19, 2020
b70f83f
itests: add cylc.flow.network.client.SuiteRuntimeClient tests
oliver-sanders May 19, 2020
ad97f7c
temp: remove optparer2nametuple dead end
oliver-sanders May 19, 2020
dae3b07
itests: mutiprocessing -> asycio
oliver-sanders May 22, 2020
565afec
itests: test the tests
oliver-sanders May 22, 2020
04bb253
itests: convert SuiteRuntimeClient to itest
oliver-sanders May 22, 2020
3d98fce
itests: convert Publisher to itest
oliver-sanders May 22, 2020
018e355
itests: session, module and function scoping
oliver-sanders May 22, 2020
d37f046
itests: allow logging level selection
oliver-sanders May 26, 2020
96bbd0b
tests: test option_parsers.Options
oliver-sanders May 27, 2020
c298985
scheduler: re-organisation of startup sequence
oliver-sanders Jun 3, 2020
c0c6165
scheduler: fix exceptions and exit codes
oliver-sanders Jun 4, 2020
992a2f7
scheduler: tidy tidy
oliver-sanders Jun 4, 2020
ea756a3
scheduler: use __slots__ to define attributes
oliver-sanders Jun 5, 2020
bef16e4
scheduler: convert to dataclass
oliver-sanders Jun 5, 2020
3a00f3b
itests: niceify test interface - again
oliver-sanders Jun 5, 2020
a1549f3
itests: niceify test_publisher and replace old unittest
oliver-sanders Jun 5, 2020
33ca627
itests: convert cylc/flow/tests/data_store_mgr
oliver-sanders Jun 5, 2020
4c80be2
itests: niceify test_client
oliver-sanders Jun 5, 2020
e5147f5
data store: don't crash if tcp server not started
oliver-sanders Jun 10, 2020
bd4175b
scheduler: open python api to release tasks
oliver-sanders Jun 10, 2020
f0200d7
itests: advanced tidying
oliver-sanders Jun 10, 2020
1c504c2
itests: convert cylc.flow.tests.network.test_resolvers
oliver-sanders Jun 8, 2020
9a71726
itests: nuclear option for scheduler shutdown
oliver-sanders Jun 10, 2020
0081aa1
itests: convert cylc.flow.tests.test_job_pool
oliver-sanders Jun 10, 2020
cab5b20
itests: convert cylc.flow.tests.network.test_server
oliver-sanders Jun 10, 2020
b2fdf06
tests: remove CylcWorkflowTestCase
oliver-sanders Jun 10, 2020
40d9e40
itests: remove scheduler unit test
oliver-sanders Jun 11, 2020
227c4d1
itests: functional documentation
oliver-sanders Jun 11, 2020
1137e57
scheduler: fix daemonisation and exit codes
oliver-sanders Jun 11, 2020
6393e58
itests: migrate some tests from cylc.flow.tests.network.test_zmq
oliver-sanders Jun 11, 2020
b752cd0
scheduler: run startup handler during startup
oliver-sanders Jun 12, 2020
4e345af
tests: co-locate functional, integration and unit tests
oliver-sanders Jun 12, 2020
04fd3da
actions: run integration tests
oliver-sanders Jun 12, 2020
48530f6
shellchecker: remove tests/functional/jobscript/00-torture/foo.ref-jo…
oliver-sanders Jun 12, 2020
528b7f3
setup: add missing test dependency
oliver-sanders Jun 12, 2020
b645c01
tests: documentation
oliver-sanders Jun 12, 2020
063f6f0
tests/i: clean tests
oliver-sanders Jun 15, 2020
cd7031e
tests/i: forward port test changes from #3500
oliver-sanders Jun 18, 2020
a914626
tests/i: fix nfs issues with integration testing cleanup/teardown
oliver-sanders Jun 19, 2020
29d5607
Merge branch 'master' into scheduler-options
oliver-sanders Jun 22, 2020
e9e4181
asyncio: shut down workflow tasks cleanly
oliver-sanders Jun 23, 2020
eb1e8f2
tests/i: fix asyncio event loop issues
oliver-sanders Jun 30, 2020
9c0f0db
tests/i: suppress NFS teardown issues
oliver-sanders Jun 30, 2020
7e69694
Merge remote-tracking branch 'upstream/master' into scheduler-options
oliver-sanders Jun 30, 2020
743c3ff
pycodestyle++
oliver-sanders Jun 30, 2020
8619d62
tests/i: simplify teardown
oliver-sanders Jun 30, 2020
714bcf1
scheduler_cli: simplify cli teardown
oliver-sanders Jul 1, 2020
f8b7e54
pytest: exclude un-collectable test file
oliver-sanders Jul 1, 2020
9d90b44
tests/i: tidy test utilities away out of sight
oliver-sanders Jul 1, 2020
9e681d7
scheduler: shutdown logic for paritally initiated flows
oliver-sanders Jul 2, 2020
3c29153
Merge remote-tracking branch 'upstream/master' into scheduler-options…
oliver-sanders Jul 2, 2020
e865e9e
tests: fix tests/f/cylc-ping/03
oliver-sanders Jul 2, 2020
425b869
Merge remote-tracking branch 'upstream/master' into scheduler-options
oliver-sanders Jul 3, 2020
a19966f
scheduler_cli: add asyncio notes
oliver-sanders Jul 3, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .codacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ exclude_paths:
- 'conf/**'
- 'doc/joss-paper/**'
- 'etc/**'
- 'cylc/flow/tests/**'
- 'tests/**'
- 'cylc/flow/**_pb2.py'
2 changes: 1 addition & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ coverage:

# files to ignore
ignore:
- "tests/**/*.py"
- "tests/**"
- "ws_messages_pb2.py"

# turn off comments to pull requests
Expand Down
6 changes: 2 additions & 4 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ debug=
#include
note=
omit=
*/cylc/flow/tests/*
tests/*
*/cylc/flow/profiler.py
*/cylc/flow/profiling/*
*/cylc/flow/parsec/OrderedDictCompat.py
*/cylc/flow/parsec/tests/*
*/cylc/flow/*_pb2.py
parallel = True
plugins=
Expand All @@ -55,11 +54,10 @@ fail_under=0
ignore_errors = False
include=
omit=
*/cylc/flow/tests/*
tests/*
*/cylc/flow/profiler.py
*/cylc/flow/profiling/*
*/cylc/flow/parsec/OrderedDictCompat.py
*/cylc/flow/parsec/tests/*
*/cylc/flow/*_pb2.py
partial_branches=
precision=2
Expand Down
27 changes: 15 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [pull_request]


jobs:
unit-test:
fast-tests:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -26,29 +26,32 @@ jobs:
- name: Install
run: |
pip install ."[all]"
pip install pytest-xdist

- name: Style
run: |
pycodestyle cylc/flow
pycodestyle
etc/bin/shellchecker

- name: Unit Test
- name: Unit Tests
run: |
pytest -n 5
pytest -n 5 tests/unit

- name: Integration Tests
run: |
pytest -n 5 tests/integration


functional_test:
functional-tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7']
tests: [
['tests', '1/4'],
['tests', '2/4'],
['tests', '3/4'],
['tests', '4/4'],
['flakytests', '1/1']
['tests/f', '1/4'],
['tests/f', '2/4'],
['tests/f', '3/4'],
['tests/f', '4/4'],
['tests/k', '1/1']
]
env:
BASE: ${{ matrix.tests[0] }}
Expand All @@ -73,7 +76,7 @@ jobs:

- name: Test
run: |
if [[ "${BASE}" == 'flakytests' ]]; then
if [[ "${BASE}" == 'tests/k' ]]; then
NPROC=4
else
NPROC=8
Expand Down
2 changes: 1 addition & 1 deletion cylc/flow/data_store_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def generate_definition_elements(self):
workflow.name = self.schd.suite
workflow.owner = self.schd.owner
workflow.host = self.schd.host
workflow.port = self.schd.port
workflow.port = self.schd.port or -1
for key, val in config.cfg['meta'].items():
if key in ['title', 'description', 'URL']:
setattr(workflow.meta, key, val)
Expand Down
11 changes: 7 additions & 4 deletions cylc/flow/network/publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,13 @@ async def send_multi(self, topic, data, serializer=None):
serializer (object, optional): string/func for encoding.

"""
self.topics.add(topic)
self.socket.send_multipart(
[topic, serialize_data(data, serializer)]
)
if self.socket:
# don't attempt to send anything if we are in the process of
# shutting down
self.topics.add(topic)
self.socket.send_multipart(
[topic, serialize_data(data, serializer)]
)

async def publish(self, items):
"""Publish topics.
Expand Down
54 changes: 53 additions & 1 deletion cylc/flow/option_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"""Common options for all cylc commands."""

import logging
from optparse import OptionParser, OptionConflictError
from optparse import OptionParser, OptionConflictError, Values
import os
import sys

Expand Down Expand Up @@ -300,3 +300,55 @@ def parse_args(self, remove_opts=None):
LOG.addHandler(errhandler)

return (options, args)


class Options(Values):
"""Wrapper to allow Python API access to optparse CLI functionality.

Example:
Create an optparse parser as normal:
>>> import optparse
>>> parser = optparse.OptionParser()
>>> _ = parser.add_option('-a', default=1)
>>> _ = parser.add_option('-b', default=2)

Create an Options object from the parser:
>>> PythonOptions = Options(parser, overrides={'c': 3})

"Parse" options via Python API:
>>> opts = PythonOptions(a=4)

Access options as normal:
>>> opts.a
4
>>> opts.b
2
>>> opts.c
3

Optparse allows you to create new options on the fly:
>>> opts.d = 5
>>> opts.d
5

But you can't create new options at initiation, this gives us basic
input validation:
>>> opts(e=6)
Traceback (most recent call last):
ValueError: e

"""

def __init__(self, parser, overrides=None):
if overrides is None:
overrides = {}
defaults = {**parser.defaults, **overrides}
Values.__init__(self, defaults)

def __call__(self, **kwargs):
for key, value in kwargs.items():
if hasattr(self, key):
setattr(self, key, value)
else:
raise ValueError(key)
return self
Loading