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

Windows 4659 events tests #648

Merged
merged 11 commits into from
Nov 30, 2021
Merged

Windows 4659 events tests #648

merged 11 commits into from
Nov 30, 2021

Conversation

Molter73
Copy link
Contributor

@Molter73 Molter73 commented Apr 7, 2020

Related issue
#642

Description

The added tests verify that Windows events with ID 4659 generate deleted events correctly.

In order to test this condition, the tests create a number of files and later deletes them by using the Windows del command interactively.

Results

imagen

@Molter73 Molter73 requested a review from bah07 April 7, 2020 10:43
@Molter73 Molter73 linked an issue Apr 7, 2020 that may be closed by this pull request
@bah07 bah07 added the FIM label Apr 15, 2020
@bah07 bah07 modified the milestone: Sprint 110 - Core Apr 15, 2020
@jotacarma90 jotacarma90 added core/fim and removed FIM labels Apr 20, 2020
@jesusjimsa jesusjimsa self-requested a review April 29, 2020 11:27
Fix some styling problems on test_basic_usage_deferred_delete_folder.py
to comply with the stablished guidelines.
@Molter73 Molter73 force-pushed the 642-windows-deferred-delete branch from a353fbd to 08e2c49 Compare April 29, 2020 15:03
jesusjimsa
jesusjimsa previously approved these changes Apr 30, 2020
Copy link
Contributor

@jesusjimsa jesusjimsa left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@juliamagan juliamagan left a comment

Choose a reason for hiding this comment

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

GJ, but some changes are required

# configurations

conf_params = {'TEST_DIRECTORIES': directory_str, 'MODULE_NAME': __name__}
p, m = generate_params(extra_params=conf_params, modes=['whodata'])
Copy link
Member

Choose a reason for hiding this comment

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

Variables with a single letter are not allowed, they should have descriptive names as parameters and metadata

Copy link
Member

Choose a reason for hiding this comment

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

Done

Comment on lines 41 to 55
# callback
def callback_detect_delete_event(line):
msg = r'.*Sending FIM event: (.+)$'
match = re.match(msg, line)

try:
event = json.loads(match.group(1))
if (event['type'] == 'event' and
event['data']['type'] == 'deleted' and
'process_name' not in event['data']['audit']):
return event
except (AttributeError, JSONDecodeError, KeyError):
pass

return None
Copy link
Member

Choose a reason for hiding this comment

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

A callback is a generic function, it should be placed in a common library as fim.py

Copy link
Member

Choose a reason for hiding this comment

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

Done

confirmation = re.search(r'\((\w)\/\w\)\?', stdout[0])
assert confirmation

# Run the command again and this time delete the files
Copy link
Member

Choose a reason for hiding this comment

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

Instead of this time delete the files, we could comment confirm deletion of files

Copy link
Member

Choose a reason for hiding this comment

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

Done

Molter73 and others added 4 commits November 24, 2021 08:39
Fix some styling problems on test_basic_usage_deferred_delete_folder.py
to comply with the stablished guidelines.
@CamiRomero
Copy link
Contributor

CamiRomero commented Nov 25, 2021

This PR is outdated, we work with this in a temporal branch tmp-642-windows-deferred-delete, where we update the test implemented here and applied a rebase of the stable tests from 2040-4.3-full-green branch.

I attached some details about the package used and executions.

Package Details

Version Path
4.3.0 https://packages-dev.wazuh.com/staging/windows/wazuh-agent-4.3.0-0.40302.20211112.msi

The test execution results are:

Windows Jenkins Notes
R1 🔴

@jotacarma90
Copy link
Member

After analyzing the problem, I have found that it is no longer necessary to check in this test that the process_name field does not appear, since the fix that has been given to this bug has finally been different from what was thought at first.
I have modified the callback that detects the deletion event so that it simply looks for a normal deletion.
PR ready for review!

@jotacarma90 jotacarma90 changed the base branch from master to 2040-4.3-full-green November 26, 2021 10:50
@damarisg damarisg assigned jotacarma90 and unassigned fedepacher Nov 26, 2021
@damarisg damarisg requested review from CamiRomero and removed request for fedepacher November 26, 2021 11:22
@CamiRomero
Copy link
Contributor

Jenkins branch QA branch
4.3 642-windows-deferred-delete

Packages details

Type Format Architecture Version File name
Agent Windows x86_64 4.3.0 wazuh-agent-4.3.0-0.40302.20211112.msi

local_internal_options.conf

Agent

syscheck.debug=2
agent.debug=2
monitord.rotate_log=0
windows.debug=2
Windows Agent Type Status
Test Execution 1 Jenkins 🟢

@CamiRomero
Copy link
Contributor

CamiRomero commented Nov 30, 2021

Jenkins branch QA branch
4.3 642-windows-deferred-delete

Packages details

Type Format Version File name
Agent Windows 4.3.0 wazuh-agent-4.3.0-0.2204.msi
Agent Solaris 4.3.0 wazuh-agent_v4.3.0-0.2204-sol11-i386.p5p
Agent Macos 4.3.0 wazuh-agent-4.3.0-0.2204.pkg
Agent Centos 4.3.0 wazuh-agent-4.3.0-0.2204.x86_64.rpm
Manager Centos 4.3.0 wazuh-manager-4.3.0-0.2204.x86_64.rpm

local_internal_options.conf

Agent Windows

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

Agent Centos, macos, solaris

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

Manager

syscheck.debug=2
analysisd.debug=2
monitord.rotate_log=0

Test Results

OS Type Status Notes
Centos Manager Jenkins 🟢
Centos Manager Jenkins 🟢
Centos Manager Jenkins 🟢
Windows Agent Jenkins 🟢
Windows Agent Jenkins 🟢
Windows Agent Jenkins 🟢
Windows Agent Jenkins 🔴 test windows-deferred has passed but there are flaky tests according to the issue #1836
Windows Agent Jenkins 🔴 test windows-deferred has passed but there are flaky tests according to the issue #1836
Centos Agent Jenkins 🟢
Centos Agent Jenkins 🟢
Centos Agent Jenkins 🟢
Macos Agent Jenkins 🟢
Macos Agent Jenkins 🟢
Macos Agent Jenkins 🟢
Solaris Agent Jenkins 🟢
Solaris Agent Jenkins 🟢
Solaris Agent Jenkins 🟢

Base automatically changed from 2040-4.3-full-green to master November 30, 2021 22:34
@snaow
Copy link
Contributor

snaow commented Nov 30, 2021

Try not to use hardcoded Popen and command execution within the test, better to create a framework function.

@snaow snaow merged commit 9f8a14c into master Nov 30, 2021
@snaow snaow deleted the 642-windows-deferred-delete branch November 30, 2021 22:40
@snaow snaow mentioned this pull request Jan 27, 2022
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.

FIM System Tests: Windows EventID 4659
10 participants