From b96a760aee1c39038ea743d5f3c540dd6ceed5b4 Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Tue, 2 Jul 2019 12:53:06 +0200 Subject: [PATCH] Simplify test for the tljh_post_install hook --- .../plugins/simplest/tljh_simplest.py | 19 ++----------------- integration-tests/test_simplest_plugin.py | 8 +++++--- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/integration-tests/plugins/simplest/tljh_simplest.py b/integration-tests/plugins/simplest/tljh_simplest.py index 6253bad..3c6a3f7 100644 --- a/integration-tests/plugins/simplest/tljh_simplest.py +++ b/integration-tests/plugins/simplest/tljh_simplest.py @@ -1,9 +1,6 @@ """ Simplest plugin that exercises all the hooks """ -from textwrap import dedent - -from tljh import systemd from tljh.hooks import hookimpl @@ -47,17 +44,5 @@ def tljh_custom_jupyterhub_config(c): @hookimpl def tljh_post_install(): - post_install_service = dedent(""" - [Unit] - Description=Post Install Test Service - - [Service] - ExecStart=ls - - [Install] - WantedBy=multi-user.target - """) - service = "post-install-test.service" - systemd.install_unit(service, post_install_service) - systemd.enable_service(service) - systemd.reload_daemon() + with open('test_post_install', 'w') as f: + f.write('123456789') diff --git a/integration-tests/test_simplest_plugin.py b/integration-tests/test_simplest_plugin.py index b740857..bb07a83 100644 --- a/integration-tests/test_simplest_plugin.py +++ b/integration-tests/test_simplest_plugin.py @@ -6,7 +6,6 @@ import requests import os import subprocess from tljh.config import CONFIG_FILE, USER_ENV_PREFIX, HUB_ENV_PREFIX -from tljh.systemd import check_service_enabled yaml = YAML(typ='rt') @@ -67,6 +66,9 @@ def test_jupyterhub_config_hook(): def test_post_install_hook(): """ - Test that the post-install-test systemd service is enabled + Test that the test_post_install file has the correct content """ - assert check_service_enabled("post-install-test") + with open("test_post_install") as f: + content = f.read() + + assert content == "123456789"