Browse Source

[python] Add local dev mod runing python integate tests (#11362)

3.1.0-release
陈家名 2 years ago committed by GitHub
parent
commit
26a21566bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      dolphinscheduler-python/pydolphinscheduler/DEVELOP.md
  2. 5
      dolphinscheduler-python/pydolphinscheduler/tests/integration/conftest.py
  3. 9
      dolphinscheduler-python/pydolphinscheduler/tox.ini

14
dolphinscheduler-python/pydolphinscheduler/DEVELOP.md

@ -188,11 +188,14 @@ It would not only run unit test but also show each file coverage which cover rat
line show you total coverage of you code. If your CI failed with coverage you could go and find some reason by line show you total coverage of you code. If your CI failed with coverage you could go and find some reason by
this command output. this command output.
#### Integrate Test ### Integrate Test
Integrate Test can not run when you execute command `tox -e local-ci` because it needs external environment Integrate Test can not run when you execute command `tox -e local-ci` because it needs external environment
including [Docker](https://docs.docker.com/get-docker/) and specific image build by [maven](https://maven.apache.org/install.html). including [Docker](https://docs.docker.com/get-docker/) and specific image build by [maven](https://maven.apache.org/install.html).
Here we would show you the step to run integrate test in directory `dolphinscheduler-python/pydolphinscheduler/tests/integration`. Here we would show you the step to run integrate test in directory `dolphinscheduler-python/pydolphinscheduler/tests/integration`.
There are two ways to run integrate tests.
#### Method 1: Launch Docker Container Locally
```shell ```shell
# Go to project root directory and build Docker image # Go to project root directory and build Docker image
@ -210,6 +213,15 @@ cd ../../
tox -e integrate-test tox -e integrate-test
``` ```
#### Method 2: Start Standalone Server in IntelliJ IDEA
```shell
# Start the standalone server in IDEA
# Go to pydolphinscheduler root directory and run integrate tests
tox -e local-integrate-test
```
## Add LICENSE When New Dependencies Adding ## Add LICENSE When New Dependencies Adding
When you add a new package in pydolphinscheduler, you should also add the package's LICENSE to directory When you add a new package in pydolphinscheduler, you should also add the package's LICENSE to directory

5
dolphinscheduler-python/pydolphinscheduler/tests/integration/conftest.py

@ -17,6 +17,8 @@
"""py.test conftest.py file for package integration test.""" """py.test conftest.py file for package integration test."""
import os
import pytest import pytest
from tests.testing.docker_wrapper import DockerWrapper from tests.testing.docker_wrapper import DockerWrapper
@ -33,6 +35,9 @@ def docker_setup_teardown():
For more information about conftest.py see: For more information about conftest.py see:
https://docs.pytest.org/en/latest/example/simple.html#package-directory-level-fixtures-setups https://docs.pytest.org/en/latest/example/simple.html#package-directory-level-fixtures-setups
""" """
if os.environ.get("skip_launch_docker") == "true":
yield True
else:
docker_wrapper = DockerWrapper( docker_wrapper = DockerWrapper(
image="apache/dolphinscheduler-standalone-server:ci", image="apache/dolphinscheduler-standalone-server:ci",
container_name="ci-dolphinscheduler-standalone-server", container_name="ci-dolphinscheduler-standalone-server",

9
dolphinscheduler-python/pydolphinscheduler/tox.ini

@ -16,7 +16,7 @@
# under the License. # under the License.
[tox] [tox]
envlist = local-ci, auto-lint, lint, doc-build-test, code-test, integrate-test, py{36,37,38,39} envlist = local-ci, auto-lint, lint, doc-build-test, code-test, integrate-test, local-integrate-test, py{36,37,38,39}
[testenv] [testenv]
whitelist_externals = make whitelist_externals = make
@ -53,6 +53,13 @@ extras = test
commands = commands =
python -m pytest tests/integration/ python -m pytest tests/integration/
[testenv:local-integrate-test]
extras = test
setenv =
skip_launch_docker = true
commands =
{[testenv:integrate-test]commands}
[testenv:local-ci] [testenv:local-ci]
extras = dev extras = dev
commands = commands =

Loading…
Cancel
Save