-
Notifications
You must be signed in to change notification settings - Fork 696
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
Add new test to ensure that CCEs are removed from the avail file #11590
Conversation
This test ensures that any assigned CCE isn't in the respective avail file.
6d3611d
to
3bb2ffd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tried it and it successfully detected CCE in a rule that isn't removed from the pool.
tests/cces-removed.py
Outdated
@@ -0,0 +1,72 @@ | |||
#! /usr/bin/python3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#! /usr/bin/python3 | |
#!/usr/bin/python3 |
tests/cces-removed.py
Outdated
"run.") | ||
parser.add_argument('-p', '--products', required=True, | ||
help='Comma separated list (no spaces) of products to check') | ||
parser.add_argument('-l', '--cee-list', type=str, required=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parser.add_argument('-l', '--cee-list', type=str, required=True, | |
parser.add_argument('-l', '--cce-list', type=str, required=True, |
tests/CMakeLists.txt
Outdated
if(PYTHON_VERSION_MAJOR GREATER 2) | ||
add_test( | ||
NAME "cce_avail_check-${TEST_NAME_SUFFIX}" | ||
COMMAND env "PYTHONPATH=$ENV{PYTHONPATH}" "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/cces-removed.py" --root "${CMAKE_SOURCE_DIR}" --json "${CMAKE_SOURCE_DIR}/build/rule_dirs.json" --products "${PRODUCTS}" --cee-list "${CCE_LIST_PATH}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COMMAND env "PYTHONPATH=$ENV{PYTHONPATH}" "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/cces-removed.py" --root "${CMAKE_SOURCE_DIR}" --json "${CMAKE_SOURCE_DIR}/build/rule_dirs.json" --products "${PRODUCTS}" --cee-list "${CCE_LIST_PATH}" | |
COMMAND env "PYTHONPATH=$ENV{PYTHONPATH}" "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/cces-removed.py" --root "${CMAKE_SOURCE_DIR}" --json "${CMAKE_SOURCE_DIR}/build/rule_dirs.json" --products "${PRODUCTS}" --cce-list "${CCE_LIST_PATH}" |
tests/CMakeLists.txt
Outdated
|
||
cce_avail_check("rhel-all" "rhel7,rhel8,rhel9" "${CMAKE_SOURCE_DIR}/shared/references/cce-redhat-avail.txt") | ||
cce_avail_check("sle12" "sle12" "${CMAKE_SOURCE_DIR}/shared/references/cce-sle12-avail.txt") | ||
cce_avail_check("sle15" "sle15" "${CMAKE_SOURCE_DIR}/shared/references/cce-sle12-avail.txt") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cce_avail_check("sle15" "sle15" "${CMAKE_SOURCE_DIR}/shared/references/cce-sle12-avail.txt") | |
cce_avail_check("sle15" "sle15" "${CMAKE_SOURCE_DIR}/shared/references/cce-sle15-avail.txt") |
45cb7a5
to
775f4f7
Compare
/packit retest-failed |
tests/cces-removed.py
Outdated
not_removed = avail_cces.intersection(cces_in_use) | ||
if len(not_removed) != 0: | ||
for cce in not_removed: | ||
print(f"CCE {cce} not removed from {args.cee_list}.", file=sys.stderr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here is one more place with the typo
775f4f7
to
dc85741
Compare
Code Climate has analyzed commit dc85741 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 58.3% (0.0% change). View more on Code Climate. |
/packit retest-failed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tried to create a forgotten CCE and this test has detected it.
/packit retest-failed |
1 similar comment
/packit retest-failed |
Description:
This test ensures that any assigned CCE isn't in the respective avail file.
Rationale:
Help reviewers catch errors.