diff options
author | Alberto Contreras <alberto.contreras@canonical.com> | 2023-05-08 23:17:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-08 16:17:17 -0500 |
commit | 4d28d203ff03dc4a4994ad223e769d2460f83a57 (patch) | |
tree | 1d21f25f88ddf03b739d79825295eac5b94418a0 | |
parent | a18442af33ed8c47d6b61436e9259010fd1f4612 (diff) | |
download | cloud-init-git-4d28d203ff03dc4a4994ad223e769d2460f83a57.tar.gz |
ci: add hypothesis scheduled GH check (#2149)
-rw-r--r-- | .github/workflows/scheduled.yml | 32 | ||||
-rw-r--r-- | tests/unittests/conftest.py | 8 | ||||
-rw-r--r-- | tox.ini | 1 |
3 files changed, 41 insertions, 0 deletions
diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml new file mode 100644 index 00000000..ac4af1e7 --- /dev/null +++ b/.github/workflows/scheduled.yml @@ -0,0 +1,32 @@ +name: scheduled +on: + schedule: + - cron: '3 14 * * *' +concurrency: + group: 'ci-${{ github.workflow }}-${{ github.ref }}' + cancel-in-progress: true + +jobs: + unittests: + strategy: + matrix: + toxenv: [ hypothesis-slow ] + name: unittest / ${{ matrix.toxenv }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + # Fetch all tags for tools/read-version + fetch-depth: 0 + - name: Install dependencies + env: + DEBIAN_FRONTEND: noninteractive + run: | + sudo apt-get -qy update + sudo apt-get -qy install tox + - name: Run fuzztest + env: + PYTEST_ADDOPTS: -v + HYPOTHESIS_PROFILE: ci + run: tox -e ${{ matrix.toxenv }} diff --git a/tests/unittests/conftest.py b/tests/unittests/conftest.py index a3daaf22..0cfa810e 100644 --- a/tests/unittests/conftest.py +++ b/tests/unittests/conftest.py @@ -7,6 +7,7 @@ from unittest import mock import pytest from cloudinit import atomic_helper, util +from tests.hypothesis import HAS_HYPOTHESIS from tests.unittests.helpers import retarget_many_wrapper FS_FUNCS = { @@ -81,3 +82,10 @@ if PYTEST_VERSION_TUPLE < (3, 9, 0): @pytest.fixture def tmp_path(tmpdir): return Path(tmpdir) + + +if HAS_HYPOTHESIS: + from hypothesis import settings # pylint: disable=import-error + + settings.register_profile("ci", max_examples=1000) + settings.load_profile(os.getenv("HYPOTHESIS_PROFILE", "default")) @@ -17,6 +17,7 @@ setenv = LC_ALL = en_US.utf-8 passenv= PYTEST_ADDOPTS + HYPOTHESIS_PROFILE [format_deps] black==22.3.0 |