Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FeatureD] Move the Feature related config from Hostcfgd into a new daemon #71

Merged
merged 6 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
562 changes: 562 additions & 0 deletions scripts/featured

Large diffs are not rendered by default.

465 changes: 2 additions & 463 deletions scripts/hostcfgd

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
scripts = [
'scripts/caclmgrd',
'scripts/hostcfgd',
'scripts/featured',
'scripts/aaastatsd',
'scripts/procdockerstatsd',
'scripts/determine-reboot-cause',
Expand Down
14 changes: 9 additions & 5 deletions tests/common/mock_configdb.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import time
class MockConfigDb(object):
"""
Mock Config DB which responds to data tables requests and store updates to the data table
Expand Down Expand Up @@ -63,11 +62,14 @@ def listen(self, init_data_handler=None):
for e in MockConfigDb.event_queue:
self.handlers[e[0]](e[0], e[1], self.get_entry(e[0], e[1]))


class MockSelect():

event_queue = []
OBJECT = "OBJECT"
TIMEOUT = "TIMEOUT"
ERROR = ""
NUM_TIMEOUT_TRIES = 0

@staticmethod
def set_event_queue(Q):
Expand All @@ -90,12 +92,14 @@ def addSelectable(self, subscriber):
self.sub_map[subscriber.table] = subscriber

def select(self, TIMEOUT):
if not MockSelect.get_event_queue():
time.sleep(TIMEOUT/1000)
return "TIMEOUT", {}
if not MockSelect.get_event_queue() and MockSelect.NUM_TIMEOUT_TRIES == 0:
raise TimeoutError
elif MockSelect.NUM_TIMEOUT_TRIES != 0:
MockSelect.NUM_TIMEOUT_TRIES = MockSelect.NUM_TIMEOUT_TRIES - 1
return MockSelect.TIMEOUT, 0

table, key = MockSelect.get_event_queue().pop(0)
self.sub_map[table].nextKey(key)
self.reset_event_queue()
return "OBJECT", self.sub_map[table]


Expand Down
Empty file added tests/featured/__init__.py
Empty file.
470 changes: 470 additions & 0 deletions tests/featured/featured_test.py

Large diffs are not rendered by default.

1,129 changes: 1,129 additions & 0 deletions tests/featured/test_vectors.py

Large diffs are not rendered by default.

437 changes: 2 additions & 435 deletions tests/hostcfgd/hostcfgd_test.py

Large diffs are not rendered by default.

Loading