[tempest-k8s] Add tempest config overrides

Add tempest config override for object storage.
Ceph reef supports SHA1 for hash tempurl related APIs
where as tempest uses SHA256 by default. Override
tempest config to use SHA1 for object-storage hash
calulation.

Change-Id: I618bc55bc91c4f7b24803918574cac7fcc4cd718
This commit is contained in:
Hemanth Nakkina 2024-08-16 15:47:44 +05:30
parent f6da527ab2
commit 8ca8d63e3a
No known key found for this signature in database
GPG Key ID: 2E4970F7B143168E
4 changed files with 41 additions and 1 deletions

View File

@ -72,6 +72,9 @@ from utils.constants import (
TEMPEST_WORKSPACE,
TEMPEST_WORKSPACE_PATH,
)
from utils.overrides import (
get_swift_overrides,
)
from utils.types import (
TempestEnvVariant,
)
@ -237,6 +240,15 @@ class TempestOperatorCharm(sunbeam_charm.OSBaseOperatorCharmK8S):
return {}
return {"OS_CACERT": OS_CACERT_PATH}
def _get_overrides_for_tempest_conf(self) -> str:
"""Return a string of overrides.
The format should be section.key value section.key value
The returned value should be append to discover-tempest-config
at the end to act as overrides to tempest config.
"""
return get_swift_overrides()
def _get_environment_for_tempest(
self, variant: TempestEnvVariant
) -> Dict[str, str]:
@ -270,6 +282,7 @@ class TempestOperatorCharm(sunbeam_charm.OSBaseOperatorCharmK8S):
"TEMPEST_WORKSPACE": TEMPEST_WORKSPACE,
"TEMPEST_WORKSPACE_PATH": TEMPEST_WORKSPACE_PATH,
"TEMPEST_OUTPUT": variant.output_path(),
"TEMPEST_CONFIG_OVERRIDES": self._get_overrides_for_tempest_conf(),
}
tempest_env.update(self._get_proxy_environment())
tempest_env.update(self._get_os_cacert_environment())

View File

@ -14,7 +14,7 @@ rm -rf "${TEMPEST_HOME}/.tempest"
tempest init --name "$TEMPEST_WORKSPACE" "$TEMPEST_WORKSPACE_PATH"
discover-tempest-config --out "$TEMPEST_CONF" --create
discover-tempest-config --out "$TEMPEST_CONF" --create $TEMPEST_CONFIG_OVERRIDES
tempest account-generator -r "$TEMPEST_ACCOUNTS_COUNT" -c "$TEMPEST_CONF" "$TEMPEST_TEST_ACCOUNTS"

View File

@ -0,0 +1,26 @@
# Copyright 2024 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tempest configuration overrides."""
def get_swift_overrides() -> str:
"""Return swift configuration override.
Ceph reef supports SHA1 for hashing for tempurl access.
SHA256 is used from v19.1.0
Tempest 2024.1 uses SHA256.
[1] https://github.com/ceph/ceph/commit/e2023d28dc6e6e835303716e7235df720d33a01c
"""
return "object-storage-feature-enabled.tempurl_digest_hashlib sha1"

View File

@ -65,6 +65,7 @@ TEST_TEMPEST_ENV = {
"TEMPEST_TEST_ACCOUNTS": "/var/lib/tempest/workspace/test_accounts.yaml",
"TEMPEST_WORKSPACE": "tempest",
"TEMPEST_WORKSPACE_PATH": "/var/lib/tempest/workspace",
"TEMPEST_CONFIG_OVERRIDES": "object-storage-feature-enabled.tempurl_digest_hashlib sha1",
}