Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/subscription_manager/repolib.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from subscription_manager.repofile import YumRepoFile
from subscription_manager.utils import get_supported_resources

from rhsm.config import get_config_parser, in_container
import rhsm.config
import configparser
from rhsmlib.facts.hwprobe import HardwareCollector

Expand All @@ -39,7 +39,7 @@

log = logging.getLogger(__name__)

conf = config.Config(get_config_parser())
conf = config.Config(rhsm.config.get_config_parser())

ALLOWED_CONTENT_TYPES = ["yum", "deb"]

Expand Down Expand Up @@ -303,7 +303,7 @@ def get_expansion(self):
# same consumer as the host they run on. They only have the same
# access to content as the host they run on.)
result = None
if not in_container():
if not rhsm.config.in_container():
uep = self.cp_provider.get_consumer_auth_cp()
result = self.release_status_cache.read_status(uep, self.identity.uuid)

Expand Down
31 changes: 19 additions & 12 deletions test/rhsmlib/test_file_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@
# Red Hat trademarks are not licensed under GPLv2. No permission is
# granted to use or replicate Red Hat trademarks that are incorporated
# in this software or its documentation.
import subprocess
import tempfile
import time
import os
from threading import Thread

from rhsmlib import file_monitor
import configparser
from rhsmlib import file_monitor

from unittest.mock import Mock, patch

from test import fixture
from threading import Thread
import subprocess
import tempfile


class TestFilesystemWatcher(fixture.SubManFixture):
Expand All @@ -35,6 +39,9 @@ def setUp(self):
self.fsw1 = file_monitor.FilesystemWatcher(self.dir_list)
self.fsw2 = file_monitor.InotifyFilesystemWatcher(self.dir_list)

now: float = time.time()
self.future = now + 120.0

def tearDown(self):
super(TestFilesystemWatcher, self).tearDown()

Expand Down Expand Up @@ -99,18 +106,18 @@ def test_polling_stop_value_change(self):

def test_polling_changed_dw_set_2_modified(self):
self.fsw1.changed_dw_set()
subprocess.call("touch %s -m" % self.testpath1, shell=True)
subprocess.call("touch %s -m" % self.testpath2, shell=True)
os.utime(self.testpath1, (self.future, self.future))
os.utime(self.testpath2, (self.future, self.future))
self.assertEqual(self.fsw1.changed_dw_set(), {self.dw1, self.dw2, self.dw3})

def test_polling_changed_dw_set_first_modified(self):
self.fsw1.changed_dw_set()
subprocess.call("touch %s -m" % self.testpath1, shell=True)
os.utime(self.testpath1, (self.future, self.future))
self.assertEqual(self.fsw1.changed_dw_set(), {self.dw1})

def test_polling_changed_dw_set_second_modified(self):
self.fsw1.changed_dw_set()
subprocess.call("touch %s -m" % self.testpath2, shell=True)
os.utime(self.testpath2, (self.future, self.future))
self.assertEqual(self.fsw1.changed_dw_set(), {self.dw2, self.dw3})

def test_polling_changed_dw_set_0_modified(self):
Expand All @@ -119,18 +126,18 @@ def test_polling_changed_dw_set_0_modified(self):

def test_polling_update_2_modified(self):
self.fsw1.changed_dw_set()
subprocess.call("touch %s -m" % self.testpath1, shell=True)
subprocess.call("touch %s -m" % self.testpath2, shell=True)
os.utime(self.testpath1, (self.future, self.future))
os.utime(self.testpath2, (self.future, self.future))
self.assertEqual(self.fsw1.update(), {self.dw1, self.dw2, self.dw3})

def test_polling_update_first_modified(self):
self.fsw1.changed_dw_set()
subprocess.call("touch %s -m" % self.testpath1, shell=True)
os.utime(self.testpath1, (self.future, self.future))
self.assertEqual(self.fsw1.update(), {self.dw1})

def test_polling_update_second_modified(self):
self.fsw1.changed_dw_set()
subprocess.call("touch %s -m" % self.testpath2, shell=True)
os.utime(self.testpath2, (self.future, self.future))
self.assertEqual(self.fsw1.update(), {self.dw2, self.dw3})

def test_polling_update_0_modified(self):
Expand Down