Skip to content

Commit

Permalink
Fix product remove parameter in web tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vodorok committed Mar 13, 2023
1 parent 8c29958 commit 01c2388
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion web/tests/functional/store/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def teardown_package():
codechecker.remove_test_package_product(
TEST_WORKSPACE,
check_env,
product=check_env['test_project_2'])
product="store_limited_product")

print("Removing: " + TEST_WORKSPACE)
shutil.rmtree(TEST_WORKSPACE, ignore_errors=True)
9 changes: 5 additions & 4 deletions web/tests/libtest/codechecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ def add_test_package_product(server_data, test_folder, check_env=None,


def remove_test_package_product(test_folder, check_env=None, protocol='http',
product='viewer_product'):
product=None):
"""
Remove the product associated with the given test folder.
The folder must exist, as the server configuration is read from the folder.
Expand All @@ -814,6 +814,7 @@ def remove_test_package_product(test_folder, check_env=None, protocol='http',

server_data = env.import_test_cfg(test_folder)['codechecker_cfg']
print(server_data)
product_to_remove = product if product else server_data['viewer_product']

if 'check_env' not in server_data:
server_data['check_env'] = check_env
Expand All @@ -824,11 +825,11 @@ def remove_test_package_product(test_folder, check_env=None, protocol='http',
str(server_data['viewer_port']),
'')
del_command = ['CodeChecker', 'cmd', 'products', 'del',
product, '--url', url]
product_to_remove, '--url', url]

print(' '.join(del_command))

# Authenticate as SUPERUSER to be able to create the product.
# Authenticate as SUPERUSER to be able to delete the product.
login(server_data, test_folder, "root", "root", protocol)
returncode = subprocess.call(
del_command,
Expand All @@ -841,7 +842,7 @@ def remove_test_package_product(test_folder, check_env=None, protocol='http',
# SQLite databases are deleted automatically as part of the
# workspace removal.
if env.get_postgresql_cfg():
env.del_database(server_data['viewer_product'], check_env)
env.del_database(product_to_remove, check_env)

if returncode:
raise Exception("Failed to remove the product from the test server!")
Expand Down

0 comments on commit 01c2388

Please sign in to comment.