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

Update mock_vulnerability_scan fixture from vuln scan tests #1058

Merged
merged 1 commit into from
Feb 15, 2021

Conversation

jmv74211
Copy link
Contributor

Related issue
closes #1050

Hi,

This PR makes the following changes:

  • Improve mock_vulnerability_scan_fixture from vuln scan tests. Now it uses a mocked agent, and it has been removed a sleep due to it has not to wait to wazuh-modulesd updates the global.db since it is stopped.

  • Fix the following error

    test_vulnerability_detector/test_scan_results/test_scan_nvd_feed.py:104: in mock_vulnerability_scan
        control_service('stop', daemon='wazuh-modulesd')
    /usr/local/lib/python3.8/dist-packages/wazuh_testing-4.2.0-py3.8.egg/wazuh_testing/tools/services.py:124: in control_service
        processes = [proc for proc in psutil.process_iter() if daemon in proc.name()]
    /usr/local/lib/python3.8/dist-packages/wazuh_testing-4.2.0-py3.8.egg/wazuh_testing/tools/services.py:124: in <listcomp>
        processes = [proc for proc in psutil.process_iter() if daemon in proc.name()]
    /usr/local/lib/python3.8/dist-packages/psutil/__init__.py:630: in name
        name = self._proc.name()
    /usr/local/lib/python3.8/dist-packages/psutil/_pslinux.py:1516: in wrapper
        return fun(self, *args, **kwargs)
    /usr/local/lib/python3.8/dist-packages/psutil/_pslinux.py:1611: in name
        name = self._parse_stat_file()['name']
    /usr/local/lib/python3.8/dist-packages/psutil/_pslinux.py:1523: in wrapper
        raise NoSuchProcess(self.pid, self._name)
    E   psutil.NoSuchProcess: psutil.NoSuchProcess process no longer exists (pid=83691)
    

Tests

  • Proven that tests pass when they have to pass.
  • Python codebase satisfies PEP-8 style style guide. pycodestyle --max-line-length=120 --show-source --show-pep8 file.py

Regards.

spothound
spothound previously approved these changes Feb 15, 2021
Copy link
Contributor

@spothound spothound left a comment

Choose a reason for hiding this comment

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

lgtm

@BraulioV BraulioV merged commit 68f04cd into master Feb 15, 2021
@BraulioV BraulioV deleted the 1050-development branch February 15, 2021 16:26
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.

Review and change mock_vulnerability_scan fixture design for vuln detector scan tests
3 participants