Skip to content

Commit ec8ca43

Browse files
committed
fixed utest after kmods var removal
1 parent 4da51e0 commit ec8ca43

File tree

1 file changed

+4
-27
lines changed

1 file changed

+4
-27
lines changed

test/unit/plugin/test_kernel_module_analyzer.py

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def test_analyze_data_default(data_model, analyzer):
8181

8282

8383
def test_analyze_data_regex_success(data_model, analyzer):
84-
args = KernelModuleAnalyzerArgs(regex_match=True, regex_filter=["^TESTmod$"])
84+
args = KernelModuleAnalyzerArgs(regex_filter=["^TESTmod$"])
8585
result = analyzer.analyze_data(data_model, args)
8686
assert result.status == ExecutionStatus.OK
8787
ev = result.events[0]
@@ -91,44 +91,21 @@ def test_analyze_data_regex_success(data_model, analyzer):
9191

9292

9393
def test_analyze_data_regex_invalid_pattern(data_model, analyzer):
94-
args = KernelModuleAnalyzerArgs(regex_match=True, regex_filter=["*invalid"])
94+
args = KernelModuleAnalyzerArgs(regex_filter=["*invalid"])
9595
result = analyzer.analyze_data(data_model, args)
9696
assert result.status in (ExecutionStatus.ERROR, ExecutionStatus.EXECUTION_FAILURE)
9797
assert any(EventCategory.RUNTIME.value in ev.category for ev in result.events)
9898

9999

100100
def test_analyze_data_regex_unmatched_patterns(data_model, analyzer):
101-
args = KernelModuleAnalyzerArgs(regex_match=True, regex_filter=["modA", "nope"])
101+
args = KernelModuleAnalyzerArgs(regex_filter=["modA", "nope"])
102102
result = analyzer.analyze_data(data_model, args)
103103
assert result.status == ExecutionStatus.ERROR
104104
assert any(ev.description == "KernelModules did not match all patterns" for ev in result.events)
105105

106106

107107
def test_analyze_data_name_only_success(data_model, analyzer):
108-
args = KernelModuleAnalyzerArgs(
109-
regex_match=False, kernel_modules={"modA": {"parameters": {"p": 1}}}
110-
)
108+
args = KernelModuleAnalyzerArgs(kernel_modules={"modA": {"parameters": {"p": 1}}})
111109
result = analyzer.analyze_data(data_model, args)
112110
assert result.status == ExecutionStatus.OK
113111
assert result.message == "task completed successfully"
114-
assert result.events == []
115-
116-
117-
def test_analyze_data_name_only_no_match(data_model, analyzer):
118-
args = KernelModuleAnalyzerArgs(regex_match=False, kernel_modules={"XYZ": {"parameters": {}}})
119-
result = analyzer.analyze_data(data_model, args)
120-
assert result.status == ExecutionStatus.ERROR
121-
assert any("no modules matched" in ev.description.lower() for ev in result.events)
122-
123-
124-
def test_analyze_data_name_only_partial_match(data_model, analyzer):
125-
args = KernelModuleAnalyzerArgs(
126-
regex_match=False,
127-
kernel_modules={
128-
"modA": {"parameters": {"p": 1}},
129-
"otherMod": {"parameters": {"wrong": 0}},
130-
},
131-
)
132-
result = analyzer.analyze_data(data_model, args)
133-
assert result.status == ExecutionStatus.ERROR
134-
assert any("not all modules matched" in ev.description.lower() for ev in result.events)

0 commit comments

Comments
 (0)