Skip to content

New testcase added "verify_essential_kernel_modules" #3864

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

SRIKKANTH
Copy link
Collaborator

A testcase to verify the presence of essential kernel modules.

A testcase to verify the presence of essential kernel modules.
Comment on lines 48 to 55
def _get_kernel_modules_configuration(self, node: Node) -> Dict[str, str]:
"""
Returns a dictionary of kernel modules and their configuration names.
"""
return {
"wdt": "CONFIG_WATCHDOG",
"cifs": "CONFIG_CIFS",
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be a class variable. Any reason to return the constant from a function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some times these values depend on OS type. We need to use logic in such cases. That's why method is used instead of class variables

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, it statically returns the dict without an OS check.
How about check if OS is Linux, and Skip the case otherwise?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed comment

not_enabled_modules = self._get_not_enabled_modules(node)

assert_that(not_enabled_modules).described_as(
"Not enabled essential kernel modules for Hyper-V / Azure platform found."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the test case level, there are no platform requirements specified, but platforms are mentioned here. We should make them consistent.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the test class name is 'AzureImageStandard' should we specify platform requirements at class level?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the test class name is 'AzureImageStandard' should we specify platform requirements at class level?

No, the class-level requirement will be replaced by the method-level requirement if it is defined at the method level. Unless the entire class shares the same requirement, it can be defined at the class level.

Comment on lines 1623 to 1626
essential_modules_configuration = {
"wdt": "CONFIG_WATCHDOG",
"cifs": "CONFIG_CIFS",
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would still recommend having this as a class variable like "linux_essential_modules". Someone looking at the test case will immediately understand the modules being verified.

If it's defined within a function, they will need to navigate through the functions

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified as suggested.

@squirrelsc
Copy link
Member

@LiliDeng LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants