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

fix(configmap): remove data of Configmap after test #2272

Merged
merged 2 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions manager/integration/tests/backupstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,22 @@ def backup_cleanup():
else:
assert (not e)

backups = api.list_namespaced_custom_object("longhorn.io",
"v1beta2",
"longhorn-system",
"backups")
ok = False
for _ in range(RETRY_COUNTS_SHORT):
if backups['items'] == []:
ok = True
break
time.sleep(RETRY_INTERVAL)
backups = api.list_namespaced_custom_object("longhorn.io",
"v1beta2",
"longhorn-system",
"backups")
assert ok, f"backups: {backups['items']}"


def backupstore_cleanup(client):
backup_volumes = client.list_backupVolume()
Expand Down
39 changes: 24 additions & 15 deletions manager/integration/tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import subprocess
import yaml

from backupstore import set_random_backupstore # NOQA

from common import ( # NOQA
get_longhorn_api_client, get_self_host_id,
get_core_api_client, get_apps_api_client,
Expand Down Expand Up @@ -50,8 +48,13 @@
DATA_ENGINE, SETTING_V2_DATA_ENGINE
)

from backupstore import SETTING_BACKUP_TARGET_NOT_SUPPORTED
from backupstore import backupstore_get_backup_target
from backupstore import ( # NOQA
backupstore_get_backup_target,
reset_backupstore_setting,
set_random_backupstore, # NOQA

SETTING_BACKUP_TARGET_NOT_SUPPORTED
)

from test_infra import wait_for_node_up_longhorn

Expand Down Expand Up @@ -1121,18 +1124,24 @@ def reset_default_settings():
SETTING_BACKUP_TARGET,
SETTING_TAINT_TOLERATION]
setting_values = ["3", "", ""]
configmap_body = config_map_with_value(configmap_name,
setting_names,
setting_values,
data_yaml_name)
core_api.patch_namespaced_config_map(name=configmap_name,
namespace='longhorn-system',
body=configmap_body)
elif configmap_name == DEFAULT_RESOURCE_CONFIGMAP_NAME:
setting_names = [SETTING_BACKUP_TARGET,
SETTING_BACKUP_TARGET_CREDENTIAL_SECRET,
SETTING_BACKUPSTORE_POLL_INTERVAL]
setting_values = ["", "", "300"]
configmap_body = config_map_with_value(configmap_name,
setting_names,
setting_values,
data_yaml_name)
core_api.patch_namespaced_config_map(name=configmap_name,
namespace='longhorn-system',
body=configmap_body)
# Directly cleanup data of ConfigMap `longhorn-default-resource`
# It will reset the default backup target settings
# if the ConfigMap contains the data 'backup-target': "", ... .
init_longhorn_default_setting_configmap(
core_api,
client,
configmap_name=DEFAULT_RESOURCE_CONFIGMAP_NAME,
data_yaml_name=DEFAULT_RESOURCE_YAML_NAME)
reset_backupstore_setting(client)

request.addfinalizer(reset_default_settings)


Expand Down
Loading