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

Added new cases to test_env_variables to check some possible errors #1014

Merged
merged 3 commits into from
Feb 8, 2021

Conversation

jotacarma90
Copy link
Member

Hello team,
This PR adds new cases to test_env_variables, making one of the paths configured in the env variable too long and ending with a backslash:

if sys.platform == 'win32':
    long_path = 'a' * 235 + '\\'
else:
    long_path = 'a' * 4071 + '\\'

test_directories = [os.path.join(PREFIX, long_path),
                    os.path.join(PREFIX, 'testdir2'),
                    os.path.join(PREFIX, 'testdir3'),
                    os.path.join(PREFIX, 'testdir4')
                    ]

This way we made sure to check for the error that occurs when the expanded environment variables were longer than the maximum path allowed by the OS. We also check that even if one of those paths ends with a '' it will still be configured correctly.

Closes #999
Testing these cases in the master branch of wazuh, generate these errors:

env_variables_report.zip
We can see in the log, wrong configured paths:

2020/12/06 18:55:25 wazuh-agent[2276] syscheck.c:182 at Start_win32_Syscheck(): INFO: (6003): Monitoring path: 'c:\aaaaaaaa[...]aaaaaaa;c:\testdir4', with options 'size | permissions | owner | group | mtime | inode | hash_md5 | hash_sha1 | hash_sha256 | attributes | whodata'.
2020/12/06 18:55:25 wazuh-agent[2276] syscheck.c:182 at Start_win32_Syscheck(): INFO: (6003): Monitoring path: 'c:\testdir1', with options 'size | permissions | owner | group | mtime | inode | hash_md5 | hash_sha1 | hash_sha256 | attributes | whodata'.
2020/12/06 18:55:25 wazuh-agent[2276] syscheck.c:182 at Start_win32_Syscheck(): INFO: (6003): Monitoring path: 'c:\testdir2', with options 'size | permissions | owner | group | mtime | inode | hash_md5 | hash_sha1 | hash_sha256 | attributes | whodata'.

Best regards.

@jotacarma90 jotacarma90 force-pushed the 6951-env-variables-test-cases branch 5 times, most recently from 299efef to 12de818 Compare January 29, 2021 14:57
@jotacarma90
Copy link
Member Author

Integration tests results after problems solve:
image

@jotacarma90 jotacarma90 force-pushed the 6951-env-variables-test-cases branch 2 times, most recently from fe7a847 to 8ba5c34 Compare February 2, 2021 10:57
@jotacarma90 jotacarma90 requested a review from Molter73 February 2, 2021 11:02
@jotacarma90 jotacarma90 self-assigned this Feb 2, 2021
@jotacarma90 jotacarma90 force-pushed the 6951-env-variables-test-cases branch from 8ba5c34 to 314b245 Compare February 2, 2021 11:14
@jotacarma90
Copy link
Member Author

Due to a bug found in the unit tests (wazuh/wazuh#7344), we have changed how the path was processed in the directory configuration. This causes a bug in these integration tests which has been marked as an expected fail pending a fix.

@jotacarma90 jotacarma90 force-pushed the 6951-env-variables-test-cases branch 2 times, most recently from 29f7c29 to e20535a Compare February 3, 2021 11:14
@jotacarma90 jotacarma90 force-pushed the 6951-env-variables-test-cases branch from e20535a to 5846b66 Compare February 3, 2021 12:05
@Molter73 Molter73 requested a review from BraulioV February 4, 2021 16:49
Copy link
Contributor

@Molter73 Molter73 left a comment

Choose a reason for hiding this comment

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

LGTM!

@vikman90 vikman90 merged commit 20d9f20 into master Feb 8, 2021
@vikman90 vikman90 deleted the 6951-env-variables-test-cases branch February 8, 2021 18:17
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.

Create a new integration test to check expanded environment variables
4 participants