Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ on:
- main
paths-ignore:
- '**.md'
- 'docs'
- 'docsrc'

pull_request:
# run tests only for pull requests to `main`
branches:
- main
paths-ignore:
- '**.md'
- 'docs'
- 'docsrc'

env:
# Docker image
Expand Down
26 changes: 24 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,27 @@ When you're done, submit a pull request and for one of the maintainers to check

### Tests

Package-level unit tests are written in pytest and we ask that you run them via [tox][1] in a [poetry][2] virtual environment. To run all package-level unit tests, which require [tox][1] and [poetry][2] installed and in your `$PATH`, issue: `tox`. Tox will pass positional arguments to pytest, e.g. `tox -- --pdb -xk 'test_can_send_message'`
#### GitHub Actions

GitHub Actions CI will automatically run package tests on pull requests and pushes to `main` branch. Therefore, the recommended method of testing is to simply create a new pull request.

#### Testing Locally

Package-level unit tests are written in pytest and we ask that you run them via [tox][1] in a [poetry][2] virtual environment if running locally. To run all package-level unit tests, which require [tox][1] and [poetry][2] installed and in your `$PATH`, issue: `tox`. Tox will pass positional arguments to pytest, e.g. `tox -- --pdb -xk 'test_can_send_message'`

Note that some tests require a valid [Loggly customer token](https://documentation.solarwinds.com/en/success_center/loggly/content/admin/customer-token-authentication-token.html) set in the environment. The token is already included in the GitHub Secrets for this repository, so these tests will run on Actions CI. To run these tests locally, specify the environment variable when calling `tox`:

```bash
_TEST_LOGGLY_CUSTOMER_TOKEN='f5cc76a7-XXXX-XXXX-XXXX-3864b42c1215' tox
```

If you do not have a valid customer token, simply skip these tests by skipping the tests marked as `loggly_auth`:

```bash
tox -- -k 'not loggly_auth'
```

#### Docker Tests

This repository also maintains a [base Docker image](./Dockerfile) for Tapis Actors. To run unit tests and check CLI usage in the Docker environment, issue:

Expand All @@ -34,7 +54,9 @@ make pytest-docker
make test-cli-docker
```

To run all tests mentioned above, issue `make tests`.
Note that poetry and Docker are required to run build the image using make. In addition, the user must have a [valid Tapis/Agave credentials cache](https://tapis-cli.readthedocs.io/en/latest/usage/apim.html) at `$HOME/.agave`, since it is used for pytests marked `tapis_auth` and [mounted in the container](https://github.com/TACC-Cloud/python-reactors/blob/97d071416c586d0333a49f5b949580d7f74ff37c/Makefile#L45-L45).

To run all tests mentioned thus far, issue `make tests`.

### Documentation

Expand Down
21 changes: 14 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PYTHON ?= python3
PREF_SHELL ?= bash
GITREF=$(shell git rev-parse --short HEAD)
GITREF_FULL=$(shell git rev-parse HEAD)
PYTEST_OPTS ?= -s -vvv
PYTEST_OPTS ?= -k 'not loggly_auth'
PYTEST_DIR ?= tests
DOT_ENV ?= ./.env

Expand All @@ -21,29 +21,33 @@ IMAGE_DOCKER ?= $(IMAGE_ORG)/$(IMAGE_NAME):$(IMAGE_TAG)
####################################
# Build Docker image
####################################
.PHONY: image
.PHONY: image build

image: Dockerfile
build:
rm -rf dist
poetry build

image: Dockerfile build
docker build -t $(IMAGE_DOCKER) -f $< .

####################################
# Tests
####################################
.PHONY: pytest-docker test-cli-docker tests shell clean

tests: test-cli-docker pytest-docker pytest-native
tests: pytest-native test-cli-docker pytest-docker

pytest-native tox:
tox --
tox -- $(PYTEST_OPTS) $(PYTEST_DIR)

pytest-docker: clean image
docker run --rm -t \
-v ${HOME}/.agave:/root/.agave \
-v ${PWD}/tests/data/abacoschemas:/schemas:ro \
-v ${PWD}/tests/data/message.jsonschema:/message.jsonschema:ro \
-v ${PWD}/$(PYTEST_DIR):/tmp/$(PKG)-$(VERSION)/$(PYTEST_DIR) \
-v ${PWD}/$(PYTEST_DIR):/mnt/ephemeral-01/$(PYTEST_DIR) \
$(IMAGE_DOCKER) \
bash -c "(python3 -m pip install -q pytest && python3 -m pytest $(PYTEST_OPTS) /tmp/$(PKG)-$(VERSION)/$(PYTEST_DIR))"
bash -c "(python3 -m pip install -q pytest polling2 && python3 -m pytest $(PYTEST_OPTS) /mnt/ephemeral-01/$(PYTEST_DIR))"

test-cli-docker: clean image
docker run --rm -t \
Expand All @@ -68,3 +72,6 @@ clean:

docs:
cd docsrc && make html

livehtml:
cd docsrc && make livehtml
2 changes: 1 addition & 1 deletion docs/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 69e3b12298528aa9ff69b6802fed3003
config: fb289cb2d8dadc13e7de412f7312a5d2
tags: 645f666f9bcd5a90fca523b33c5a78b7
37 changes: 0 additions & 37 deletions docs/_sources/api-ref/reactors.aliases.agavedb.rst.txt

This file was deleted.

37 changes: 0 additions & 37 deletions docs/_sources/api-ref/reactors.aliases.agavedb.tests.rst.txt

This file was deleted.

29 changes: 0 additions & 29 deletions docs/_sources/api-ref/reactors.aliases.rst.txt

This file was deleted.

29 changes: 29 additions & 0 deletions docs/_sources/api-ref/reactors.cli.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
reactors.cli package
====================

Submodules
----------

reactors.cli.run module
-----------------------

.. automodule:: reactors.cli.run
:members:
:undoc-members:
:show-inheritance:

reactors.cli.usage module
-------------------------

.. automodule:: reactors.cli.usage
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: reactors.cli
:members:
:undoc-members:
:show-inheritance:
20 changes: 14 additions & 6 deletions docs/_sources/api-ref/reactors.logtypes.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,26 @@ reactors.logtypes package
Submodules
----------

reactors.logtypes.logstash module
---------------------------------
reactors.logtypes.loggly module
-------------------------------

.. automodule:: reactors.logtypes.logstash
.. automodule:: reactors.logtypes.loggly
:members:
:undoc-members:
:show-inheritance:

reactors.logtypes.logstash\_asyncio module
------------------------------------------
reactors.logtypes.loggly\_futures\_session module
-------------------------------------------------

.. automodule:: reactors.logtypes.logstash_asyncio
.. automodule:: reactors.logtypes.loggly_futures_session
:members:
:undoc-members:
:show-inheritance:

reactors.logtypes.logstash module
---------------------------------

.. automodule:: reactors.logtypes.logstash
:members:
:undoc-members:
:show-inheritance:
Expand Down
42 changes: 6 additions & 36 deletions docs/_sources/api-ref/reactors.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,18 @@ Subpackages
:maxdepth: 4

reactors.agaveutils
reactors.aliases
reactors.cli
reactors.logtypes
reactors.runtime
reactors.validation

Submodules
----------

reactors.jsonmessages module
----------------------------
reactors.config module
----------------------

.. automodule:: reactors.jsonmessages
:members:
:undoc-members:
:show-inheritance:

reactors.process module
-----------------------

.. automodule:: reactors.process
:members:
:undoc-members:
:show-inheritance:

reactors.runtime module
-----------------------

.. automodule:: reactors.runtime
:members:
:undoc-members:
:show-inheritance:

reactors.storage module
-----------------------

.. automodule:: reactors.storage
:members:
:undoc-members:
:show-inheritance:

reactors.uniqueid module
------------------------

.. automodule:: reactors.uniqueid
.. automodule:: reactors.config
:members:
:undoc-members:
:show-inheritance:
Expand Down
Loading