Skip to content

Commit

Permalink
[DPE-3647] Pin charm to snap v2.11.1 (#199)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
phvalguima authored Mar 8, 2024
1 parent 79ad1e5 commit cd6f39b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
3 changes: 3 additions & 0 deletions lib/charms/opensearch/v0/constants_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,6 @@
# Opensearch Users
OpenSearchUsers = {"admin", "monitor"}
OpenSearchRoles = set()

# Opensearch Snap revision
OPENSEARCH_SNAP_REVISION = 39
4 changes: 1 addition & 3 deletions src/opensearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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."""

Expand Down
1 change: 0 additions & 1 deletion tests/integration/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"

0 comments on commit cd6f39b

Please sign in to comment.