Skip to content

Commit

Permalink
tests: co-locate functional, integration and unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-sanders committed Jun 12, 2020
1 parent 8e98a44 commit f56cf74
Show file tree
Hide file tree
Showing 1,894 changed files with 43 additions and 82 deletions.
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
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ jobs:
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 @@ -72,7 +72,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/hostuserutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def _get_host_info(self, target=None):
"""Return the extended info of the current host."""
if target not in self._host_exs:
if target is None:
target = socket.getfqdn()
target = socket.gethostname()
try:
self._host_exs[target] = socket.gethostbyname_ex(target)
except IOError as exc:
Expand Down
18 changes: 9 additions & 9 deletions etc/bin/run-functional-tests
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Usage: run-functional-tests [...]
Run the Cylc test battery, in <CYLC_REPO_DIR>/tests.
Options and arguments are appended to "prove -j \$NPROC -s -r \${@:-tests}".
Options and arguments are appended to "prove -j \$NPROC -s -r \${@:-tests/f}".
NPROC is the number of concurrent processes to run, which defaults to the
global config "process pool size" setting.
Expand Down Expand Up @@ -68,13 +68,13 @@ Run the full test suite with the default options.
run-functional-tests
Run the full test suite with 12 processes
run-functional-tests -j 12
Run only tests under "tests/cyclers/"
run-functional-tests tests/cyclers
Run only "tests/cyclers/16-weekly.t" in verbose mode
run-functional-tests -v tests/cyclers/16-weekly.t
Run only tests under "tests/cyclers/", and skip 00-daily.t
export CYLC_TEST_SKIP=tests/cyclers/00-daily.t
run-functional-tests tests/cyclers
Run only tests under "tests/f/cyclers/"
run-functional-tests tests/f/cyclers
Run only "tests/f/cyclers/16-weekly.t" in verbose mode
run-functional-tests -v tests/f/cyclers/16-weekly.t
Run only tests under "tests/f/cyclers/", and skip 00-daily.t
export CYLC_TEST_SKIP=tests/f/cyclers/00-daily.t
run-functional-tests tests/f/cyclers
Run the first quarter of the test battery
CHUNK=1/4 run-functional-tests
Re-run failed tests
Expand Down Expand Up @@ -125,7 +125,7 @@ export CYLC_REPO_DIR="${PWD}"

# default test base
if [[ ${#TESTS[@]} -eq 0 ]]; then
TESTS=('tests')
TESTS=('tests/functional')
fi

# handle chunking
Expand Down
2 changes: 1 addition & 1 deletion etc/bin/shellchecker
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ default () {
# run a strict check on all "functional" scripts
main '.' \
--exclude 'etc/bin/live-graph-movie.sh' \
--exclude 'tests/jobscript/00-torture/foo.ref-jobfile' \
--exclude 'tests/functional/jobscript/00-torture/foo.ref-jobfile' \
-- -e SC1090
}

Expand Down
46 changes: 0 additions & 46 deletions etc/cylc-tests.rst

This file was deleted.

9 changes: 4 additions & 5 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ addopts = --verbose
--ignore=cylc/flow/parsec/empysupport.py
--ignore=cylc/flow/parsec/validate.py
--ignore=cylc/flow/parsec/example
--ignore=cylc/flow/tests/parsec/getcfg/bin/one-line.py
--ignore=cylc/flow/tests/parsec/synonyms/bin/synonyms.py
--ignore=cylc/flow/tests/parsec/nullcfg/bin/empty.py
--ignore=tests/unit/parsec/getcfg/bin/one-line.py
--ignore=tests/unit/parsec/synonyms/bin/synonyms.py
--ignore=tests/unit/parsec/nullcfg/bin/empty.py
--ignore=cylc/flow/data_messages_pb2.py
testpaths =
cylc/flow/
tests/lib/python/
tests/unit/
2 changes: 0 additions & 2 deletions tests/README

This file was deleted.

1 change: 1 addition & 0 deletions tests/f
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 13 additions & 3 deletions tests/README.md → tests/functional/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,21 @@ This directory contains Cylc functional tests.
## How To Run These Tests

```console
$ etc/bin/run-functional-tests tests/ flakytests/
$ etc/bin/run-functional-tests tests/ flakytests/ -j 4 # 4 tests in parallel
$ etc/bin/run-functional-tests tests/f tests/k
$ etc/bin/run-functional-tests tests/f tests/k # 4 tests in parallel
```

## What Are Functional Tests
## Why Are There Flaky Tests?

A lot of the functional tests are highly timing dependent which can cause
them to become flaky, especially on heavily loaded systems or slow
file systems.

We put especially sensitive functional tests into the `flakyfunctional`
directory so that we can easily test them separately with fewer tests
running in parallel to give them a chance of passing.

## What Are Functional Tests?

These tests ensure end-to-end functionality is as expected.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit f56cf74

Please sign in to comment.