Skip to content

Commit

Permalink
[irods#7521] test_control_plane: Increase delay server sleep time
Browse files Browse the repository at this point in the history
Increasing the delay server's sleep time decreases the chances that
it will wake up and query for work from the server while it is being
shut down. This makes for cleaner shut downs which should prevent
future tests run on the same host from failing due to failure to
clean up shmem files or something of that sort.
  • Loading branch information
alanking committed Mar 27, 2024
1 parent f49504c commit 70efc21
Showing 1 changed file with 36 additions and 12 deletions.
48 changes: 36 additions & 12 deletions scripts/irods/test/test_control_plane.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
import sys

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest

import copy
import json
import os
import shutil
import tempfile
import time
import unittest

from .. import test
from . import session
from . import settings
from .resource_suite import ResourceBase
from ..controller import IrodsController
from ..configuration import IrodsConfig
from .. import lib
from .. import paths
from . import session
from .. import test
from ..configuration import IrodsConfig
from ..controller import IrodsController
from ..test.command import assert_command
from .resource_suite import ResourceBase

try:
import zmq
Expand All @@ -29,6 +25,34 @@

class TestControlPlane(SessionsMixin, unittest.TestCase):

@classmethod
def setUpClass(cls):
# Copy the server config to a temporary file for backup.
config = IrodsConfig()
cls.backup_server_config = tempfile.NamedTemporaryFile(prefix=os.path.basename(config.server_config_path)).name
shutil.copyfile(config.server_config_path, cls.backup_server_config)

# Get the contents of the server config.
with open(config.server_config_path) as f:
server_config = json.load(f)

# Update the delay server sleep time to some really long time. This test suite does not use the delay server
# and the nature of the tests are such that any additional connections to the main server can cause problems
# with test clean up whenever the server is restarted. Specifically, it seems that delay server queries for
# work to do can cause shared memory cleanup problems, so we can just avoid them by effectively disabling the
# delay server.
server_config['advanced_settings']['delay_server_sleep_time_in_seconds'] = 7200
lib.update_json_file_from_dict(config.server_config_path, server_config)

IrodsController().restart(test_mode=True)

@classmethod
def tearDownClass(cls):
# Copy the backed up server config back to where it belongs and restart the server.
config = IrodsConfig()
shutil.copyfile(cls.backup_server_config, config.server_config_path)
IrodsController().restart(test_mode=True)

def test_pause_and_resume(self):
with session.make_session_for_existing_admin() as admin_session:
admin_session.environment_file_contents = IrodsConfig().client_environment
Expand Down

0 comments on commit 70efc21

Please sign in to comment.