Reduced ssl on for active tests only

This commit is contained in:
Omar Richardson
2020-11-19 12:58:38 +01:00
parent 4862831f71
commit 313f050c42
5 changed files with 10 additions and 8 deletions

View File

@@ -94,7 +94,7 @@ jobs:
- python: "3.7" - python: "3.7"
db: mysql db: mysql
- python: "3.7" - python: "3.7"
ssl: ssl_enabled ssl: ssl
- python: "3.8" - python: "3.8"
db: postgres db: postgres
- python: "3.8" - python: "3.8"
@@ -115,7 +115,7 @@ jobs:
echo "MYSQL_HOST=127.0.0.1" >> $GITHUB_ENV echo "MYSQL_HOST=127.0.0.1" >> $GITHUB_ENV
echo "JUPYTERHUB_TEST_DB_URL=mysql+mysqlconnector://root@127.0.0.1:3306/jupyterhub" >> $GITHUB_ENV echo "JUPYTERHUB_TEST_DB_URL=mysql+mysqlconnector://root@127.0.0.1:3306/jupyterhub" >> $GITHUB_ENV
fi fi
if [ "${{ matrix.ssl }}" == "ssl_enabled" ]; then if [ "${{ matrix.ssl }}" == "ssl" ]; then
echo "SSL_ENABLED=1" >> $GITHUB_ENV echo "SSL_ENABLED=1" >> $GITHUB_ENV
fi fi
if [ "${{ matrix.db }}" == "postgres" ]; then if [ "${{ matrix.db }}" == "postgres" ]; then

View File

@@ -74,11 +74,7 @@ def ssl_tmpdir(tmpdir_factory):
def app(request, io_loop, ssl_tmpdir): def app(request, io_loop, ssl_tmpdir):
"""Mock a jupyterhub app for testing""" """Mock a jupyterhub app for testing"""
mocked_app = None mocked_app = None
if 'SSL_ENABLED' in os.environ: ssl_enabled = getattr(request.module, "ssl_enabled", False)
ssl_env_var = bool(os.environ['SSL_ENABLED'])
else:
ssl_env_var = False
ssl_enabled = getattr(request.module, "ssl_enabled", ssl_env_var)
kwargs = dict() kwargs = dict()
if ssl_enabled: if ssl_enabled:
kwargs.update(dict(internal_ssl=True, internal_certs_location=str(ssl_tmpdir))) kwargs.update(dict(internal_ssl=True, internal_certs_location=str(ssl_tmpdir)))

View File

@@ -1,5 +1,6 @@
"""Tests for the REST API.""" """Tests for the REST API."""
import json import json
import os
import re import re
import sys import sys
import uuid import uuid
@@ -27,7 +28,7 @@ from .utils import async_requests
from .utils import auth_header from .utils import auth_header
from .utils import find_user from .utils import find_user
ssl_enabled = os.environ.get('SSL_ENABLED', False)
# -------------------- # --------------------
# Authentication tests # Authentication tests
# -------------------- # --------------------

View File

@@ -20,6 +20,8 @@ from ..app import JupyterHub
from .mocking import MockHub from .mocking import MockHub
from .test_api import add_user from .test_api import add_user
ssl_enabled = os.environ.get('SSL_ENABLED', False)
def test_help_all(): def test_help_all():
out = check_output([sys.executable, '-m', 'jupyterhub', '--help-all']).decode( out = check_output([sys.executable, '-m', 'jupyterhub', '--help-all']).decode(

View File

@@ -41,6 +41,9 @@ while True:
except KeyboardInterrupt: except KeyboardInterrupt:
print("interrupted") print("interrupted")
""" """
import os
ssl_enabled = os.environ.get('SSL_ENABLED', False)
def setup(): def setup():