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

IT Tests: FIM - Refactor limits test of test report changes #2417

Merged
merged 15 commits into from
Feb 1, 2022

Conversation

CamiRomero
Copy link
Contributor

@CamiRomero CamiRomero commented Dec 28, 2021

Related issue
#2345

Description

Changes applied in this PR:

  • We add the auto-configuration of the test in order to not set manually the local internal options.
  • We changed the import in order to only import the functions that use in the test and not all the module
  • We changed YAML, now this file only contains one configuration, we note that when we put more than one, the test that does not apply with the configuration will be automatically skipped and this is wrong, if not applied the
    test just not run. When this changes the test only runs nine times and there isn't a skipped test.
  • We modified callback_generater function in order to apply this function and not a specific function per test.
  • We update the documentation.

Important

In this PR we only work on tests:

  • tests/integration/test_fim/test_files/test_report_changes/test_diff_size_limit_configured.py
  • tests/integration/test_fim/test_files/test_report_changes/test_diff_size_limit_default.py

but we apply a small change to use other Callback in order to not affect the tests:

  • tests/integration/test_fim/test_registry/test_registry_report_changes/test_registry_file_size_default.py
  • tests/integration/test_fim/test_synchronization/test_sync_disabled_win32.py
  • tests/integration/test_fim/test_synchronization/test_sync_registry_disabled_win32.py
  • tests/integration/test_fim/test_synchronization/test_sync_registry_enabled_win32.py

Configuration options

Type Format Tag File name
Agent - Windows msi 4.3.0 wazuh-agent-4.3.0-0.40301.20211108.msi
Agent - MacOS msi 4.3.0 wazuh-agent-4.3.0-0.40301.20211108.pkg
Agent - Centos msi 4.3.0 wazuh-agent-4.3.0-0.40301.20211108.x86_64.rpm
Manager - Centos msi 4.3.0 wazuh-manager-4.3.0-0.40301.20211108.x86_64.rpm

Configuration options

syscheck.debug=2
agent.debug=2
monitord.rotate_log=0
windows.debug=2

test_fim/test_files/test_report_changes/test_diff_size_limit_configured.py

Test path Execution OS Type Version Date Status Executed by
test_fim/test_files/test_report_changes/test_diff_size_limit_configured.py Local Windows Agent 4.3.0 10/01/2022 🟢 Camila
test_diff_size_limit_configured.py Local Windows Agent 4.3.0 10/01/2022 🟢 Camila
test_diff_size_limit_configured.py Local Windows Agent 4.3.0 10/01/2022 🟢 Camila

tests/integration/test_fim/test_files/test_report_changes/test_diff_size_limit_default.py

Test path Execution OS Type Version Date Status Executed by
tests/integration/test_fim/test_files/test_report_changes/test_diff_size_limit_default.py Local Windows Agent 4.3.0 10/01/2022 🟢 Camila
test_diff_size_limit_default.py Local Windows Agent 4.3.0 10/01/2022 🟢 Camila
test_diff_size_limit_default.py Local Windows Agent 4.3.0 10/01/2022 🟢 Camila

test_fim/

Test path Execution OS Type Version Date Status Executed by
test_fim/ Jenkins Windows Agent 4.3.0 28/12/2021 🟢 Camila
test_fim/ Jenkins Windows Agent 4.3.0 28/12/2021 🟢 Camila
test_fim/ Jenkins Windows Agent 4.3.0 28/12/2021 🟢 Camila
Test path Execution OS Type Version Date Status Executed by
test_fim/ Jenkins MacOS Agent 4.3.0 28/12/2021 🟢 Camila
test_fim/ Jenkins MacOS Agent 4.3.0 28/12/2021 🟢 Camila
test_fim/ Jenkins MacOS Agent 4.3.0 28/12/2021 🟢 Camila
Test path Execution OS Type Version Date Status Executed by
test_fim/ Jenkins Centos Agent 4.3.0 28/12/2021 🟢 Camila
test_fim/ Jenkins Centos Agent 4.3.0 28/12/2021 🟢 Camila
test_fim/ Jenkins Centos Agent 4.3.0 28/12/2021 🟢 Camila
Test path Execution OS Type Version Date Status Executed by
test_fim/ Jenkins Centos Manager 4.3.0 28/12/2021 🟢 Camila
test_fim/ Jenkins Centos Manager 4.3.0 28/12/2021 🟢 Camila
test_fim/ Jenkins Centos Manager 4.3.0 28/12/2021 🟢 Camila
Test path Execution OS Type Version Date Status Executed by
test_fim/ Jenkins Solaris Manager 4.3.0 10/01/2022 🟢 Camila
test_fim/ Jenkins Solaris Manager 4.3.0 10/01/2022 🟢 Camila
test_fim/ Jenkins Solaris Manager 4.3.0 10/01/2022 🟢 Camila

Tests

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

# FIM modules
SCHEDULE_MODE = 'scheduled'

# Yaml Configuration
YAML_CONF_REGISTRY_RESPONSE = 'wazuh_conf_registry_responses_win32.yaml'
YAML_CONF_SYNC_WIN32 = 'wazuh_sync_conf_win32.yaml'
YAML_CONF_DIFF = 'wazuh_conf_diff.yaml'
Copy link
Contributor

Choose a reason for hiding this comment

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

Why add config yaml files here, if they will be used only on a specific test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently, this configuration is only used in one test but the idea is to reuse it in the next refactors

configurations_path = os.path.join(test_data_path, 'wazuh_conf.yaml')
testdir1 = test_directories[0]
DIFF_LIMIT_VALUE = 2
test_directories = [os.path.join(PREFIX, TEST_DIR_1)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why use test_directories as an array, if only One test path will be used? And it won't be passed as an iterable on configuration, but it's hardcoded to only use the first in the array?
Better change it to a simple string instead of an array for legibility.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in commit 543b1

@Deblintrake09
Copy link
Contributor

Deblintrake09 commented Jan 4, 2022

Test path Execution OS Type Version Date Status Executed by
test_fim/ Jenkins Windows Agent 4.3.0 2021/01/04 🟢 @Deblintrake09
test_fim/ Jenkins Windows Agent 4.3.0 2021/01/05 🟢 @Deblintrake09
test_fim/ Jenkins Windows Agent 4.3.0 2021/01/05 🟢 @Deblintrake09
test_fim/ Jenkins MacOs Agent 4.3.0 2021/01/04 🟡 @Deblintrake09
test_fim/ Jenkins MacOs Agent 4.3.0 2021/01/05 🟡 @Deblintrake09
test_fim/ Jenkins Centos Agent 4.3.0 2021/01/04 🟢 @Deblintrake09
test_fim/ Jenkins Centos Agent 4.3.0 2021/01/05 🟢 @Deblintrake09
test_fim/ Jenkins Centos Agent 4.3.0 2021/01/05 🟢 @Deblintrake09
test_fim/ Jenkins Centos Manager 4.3.0 2021/01/04 🟢 @Deblintrake09
test_fim/ Jenkins Centos Manager 4.3.0 2021/01/05 🟢 @Deblintrake09
test_fim/ Jenkins Centos Manager 4.3.0 2021/01/05 🟢 @Deblintrake09
  • Macos Skipped all tests

Deblintrake09
Deblintrake09 previously approved these changes Jan 10, 2022
Copy link
Contributor

@Deblintrake09 Deblintrake09 left a comment

Choose a reason for hiding this comment

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

All works correctly. Will need to run tests on local environments when we are done with Issue #2421.

@damarisg damarisg changed the title 2345 refactor fim limits test of test report changes IT Tests: FIM - Refactor limits test of test report changes Jan 23, 2022
@snaow snaow merged commit c20d2dc into master Feb 1, 2022
@snaow snaow deleted the 2345-refactor-fim-limits-test-of-test-report-changes branch February 1, 2022 09:16
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.

Refactor FIM limits tests of 'test_report_changes' according to new standard (2)
3 participants