From cd6f39bc9bc4ac2b4371d2b5da013574a226343d Mon Sep 17 00:00:00 2001 From: phvalguima Date: Sat, 9 Mar 2024 00:52:00 +0100 Subject: [PATCH] [DPE-3647] Pin charm to snap v2.11.1 (#199) Pins the charm to snap v2.11.1. Also, moves the snap revision constant to a lib, so both src/opensearch.py and integration tests can access the same value. --- lib/charms/opensearch/v0/constants_charm.py | 3 +++ src/opensearch.py | 4 +--- tests/integration/helpers.py | 1 - tests/integration/test_charm.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/charms/opensearch/v0/constants_charm.py b/lib/charms/opensearch/v0/constants_charm.py index 7a0687925..c03c995f5 100644 --- a/lib/charms/opensearch/v0/constants_charm.py +++ b/lib/charms/opensearch/v0/constants_charm.py @@ -92,3 +92,6 @@ # Opensearch Users OpenSearchUsers = {"admin", "monitor"} OpenSearchRoles = set() + +# Opensearch Snap revision +OPENSEARCH_SNAP_REVISION = 39 diff --git a/src/opensearch.py b/src/opensearch.py index 421e75616..41f2aa410 100644 --- a/src/opensearch.py +++ b/src/opensearch.py @@ -15,6 +15,7 @@ from pathlib import Path import requests +from charms.opensearch.v0.constants_charm import OPENSEARCH_SNAP_REVISION from charms.opensearch.v0.opensearch_distro import OpenSearchDistribution, Paths from charms.opensearch.v0.opensearch_exceptions import ( OpenSearchCmdError, @@ -34,9 +35,6 @@ logger = logging.getLogger(__name__) -OPENSEARCH_SNAP_REVISION = 37 - - class OpenSearchSnap(OpenSearchDistribution): """Snap distribution of opensearch, only overrides properties and logic proper to the snap.""" diff --git a/tests/integration/helpers.py b/tests/integration/helpers.py index 55c19eb00..aa6aeee72 100644 --- a/tests/integration/helpers.py +++ b/tests/integration/helpers.py @@ -29,7 +29,6 @@ METADATA = yaml.safe_load(Path("./metadata.yaml").read_text()) APP_NAME = METADATA["name"] -EXPECTED_SNAP_REVISION = 37 SERIES = "jammy" UNIT_IDS = [0, 1, 2] IDLE_PERIOD = 75 diff --git a/tests/integration/test_charm.py b/tests/integration/test_charm.py index 8a4b550f2..0c8984bba 100644 --- a/tests/integration/test_charm.py +++ b/tests/integration/test_charm.py @@ -7,11 +7,11 @@ import pytest import yaml +from charms.opensearch.v0.constants_charm import OPENSEARCH_SNAP_REVISION from pytest_operator.plugin import OpsTest from .helpers import ( APP_NAME, - EXPECTED_SNAP_REVISION, MODEL_CONFIG, SERIES, get_admin_secrets, @@ -170,5 +170,5 @@ async def test_check_pinned_revision(ops_test: OpsTest) -> None: ).replace("\r\n", "\n") )["installed"].split() logger.info(f"Installed snap: {installed_info}") - assert installed_info[1] == f"({EXPECTED_SNAP_REVISION})" + assert installed_info[1] == f"({OPENSEARCH_SNAP_REVISION})" assert installed_info[3] == "held"