Skip to content

Commit

Permalink
test(daemon): add daemon test back (#1771)
Browse files Browse the repository at this point in the history
* test(daemon): add daemon test back
  • Loading branch information
hanxiao committed Jan 24, 2021
1 parent 54b07ac commit ce45e6d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 24 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/ci.yml
Expand Up @@ -126,8 +126,15 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test
run: |
pytest --suppress-no-test-exit-code --force-flaky --min-passes 1 --max-runs 5 --cov=jina --cov-report=xml -n 1 --timeout=120 -v --ignore-glob='tests/integration/hub_usage/dummyhub*' ${{ matrix.test-path }}
timeout-minutes: 20
if [[ "${{ matrix.test-path }}" == "tests/distributed/test_against_external_daemon/" ]]; then
docker build -f Dockerfiles/debianx.Dockerfile -t jinaai/jina:test-daemon .
docker run --name jinad --network=host -d jinaai/jina:test-daemon
pytest --suppress-no-test-exit-code --force-flaky --min-passes 1 --max-runs 5 --cov=jina --cov-report=xml -n 1 --timeout=120 -v --ignore-glob='tests/integration/hub_usage/dummyhub*' ${{ matrix.test-path }}
docker rm -f jinad
else
pytest --suppress-no-test-exit-code --force-flaky --min-passes 1 --max-runs 5 --cov=jina --cov-report=xml -n 1 --timeout=120 -v --ignore-glob='tests/integration/hub_usage/dummyhub*' ${{ matrix.test-path }}
fi
timeout-minutes: 15
env:
JINAHUB_USERNAME: ${{ secrets.JINAHUB_USERNAME }}
JINAHUB_PASSWORD: ${{ secrets.JINAHUB_PASSWORD }}
Expand Down
4 changes: 1 addition & 3 deletions daemon/__init__.py
@@ -1,5 +1,4 @@
import json
import os
import subprocess
import threading

Expand All @@ -17,7 +16,6 @@
daemon_logger = JinaLogger('DAEMON', **vars(jinad_args))



def _get_app():
from .api.endpoints import router, flow, pod, pea, logs, workspace
app = FastAPI(
Expand Down Expand Up @@ -94,7 +92,7 @@ def _start_fluentd():
fluentd_proc = subprocess.Popen(['fluentd', '-c', cfg], stdout=subprocess.PIPE, stdin=subprocess.PIPE,
bufsize=0, universal_newlines=True)
for line in fluentd_proc.stdout:
daemon_logger.info(f'fluentd: {line.strip()}')
daemon_logger.debug(f'fluentd: {line.strip()}')
except FileNotFoundError:
daemon_logger.warning('Fluentd not found locally, Jinad cannot stream logs!')
jinad_args.no_fluentd = True
Expand Down
@@ -1,5 +1,3 @@
import os

import numpy as np
import pytest

Expand All @@ -9,9 +7,6 @@
NUM_DOCS = 100


@pytest.mark.skip(
'Flaky test since it depends on external cloud host, to be enabled once '
'https://github.com/jina-ai/jina/issues/1733 is fixed')
@pytest.mark.parametrize('silent_log', [True, False])
@pytest.mark.parametrize('parallels', [1, 2])
def test_r_l_simple(silent_log, parallels, mocker):
Expand All @@ -27,9 +22,6 @@ def test_r_l_simple(silent_log, parallels, mocker):
response_mock.assert_called()


@pytest.mark.skip(
'Flaky test since it depends on external cloud host, to be enabled once '
'https://github.com/jina-ai/jina/issues/1733 is fixed')
@pytest.mark.parametrize('silent_log', [True, False])
@pytest.mark.parametrize('parallels', [1, 2])
def test_l_r_simple(silent_log, parallels, mocker):
Expand All @@ -46,9 +38,6 @@ def test_l_r_simple(silent_log, parallels, mocker):
response_mock.assert_called()


@pytest.mark.skip(
'Flaky test since it depends on external cloud host, to be enabled once '
'https://github.com/jina-ai/jina/issues/1733 is fixed')
@pytest.mark.parametrize('silent_log', [True, False])
@pytest.mark.parametrize('parallels', [1, 2])
def test_r_l_r_simple(silent_log, parallels, mocker):
Expand All @@ -68,9 +57,6 @@ def test_r_l_r_simple(silent_log, parallels, mocker):
response_mock.assert_called()


@pytest.mark.skip(
'Flaky test since it depends on external cloud host, to be enabled once '
'https://github.com/jina-ai/jina/issues/1733 is fixed')
@pytest.mark.parametrize('silent_log', [True, False])
@pytest.mark.parametrize('parallels', [1, 2])
def test_r_r_r_simple(silent_log, parallels, mocker):
Expand All @@ -92,9 +78,6 @@ def test_r_r_r_simple(silent_log, parallels, mocker):
response_mock.assert_called()


@pytest.mark.skip(
'Flaky test since it depends on external cloud host, to be enabled once '
'https://github.com/jina-ai/jina/issues/1733 is fixed')
@pytest.mark.parametrize('silent_log', [True, False])
@pytest.mark.parametrize('parallels', [1, 2])
def test_l_r_l_simple(silent_log, parallels, mocker):
Expand All @@ -112,8 +95,6 @@ def test_l_r_l_simple(silent_log, parallels, mocker):
response_mock.assert_called()


@pytest.mark.skipif('GITHUB_WORKFLOW' in os.environ,
reason='somehow this upload test does not work on Github action, but locally it works fine!')
@pytest.mark.parametrize('silent_log', [True, False])
@pytest.mark.parametrize('parallels', [1, 2])
def test_l_r_l_with_upload(silent_log, parallels, mocker):
Expand Down

0 comments on commit ce45e6d

Please sign in to comment.