Skip to content

Commit

Permalink
Adding support from focal to noble
Browse files Browse the repository at this point in the history
  • Loading branch information
addyess committed Jul 12, 2024
1 parent bbb2ed3 commit 909c01f
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 14 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/naming-lint-unit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ on:
jobs:
call-inclusive-naming-check:
name: Inclusive Naming
uses: canonical-web-and-design/Inclusive-naming/.github/workflows/woke.yaml@main
uses: canonical/inclusive-naming/.github/workflows/woke.yaml@main
with:
fail-on-error: "true"

lint-unit:
name: Lint Unit
uses: charmed-kubernetes/workflows/.github/workflows/lint-unit.yaml@main
uses: charmed-kubernetes/workflows/.github/workflows/lint-unit.yaml@main
with:
python: "['3.8', '3.10', '3.12']"

2 changes: 1 addition & 1 deletion .github/workflows/vsphere-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: charmed-kubernetes/actions-operator@main
with:
provider: vsphere
juju-channel: 3.1/stable
juju-channel: 3/stable
credentials-yaml: ${{ secrets.CREDENTIALS_YAML }}
clouds-yaml: ${{ secrets.CLOUDS_YAML }}
bootstrap-constraints: "arch=amd64 cores=2 mem=4G"
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/wheelhouse-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ on:

jobs:
validate-wheelhouse:
uses: charmed-kubernetes/workflows/.github/workflows/validate-wheelhouse.yaml@main
uses: charmed-kubernetes/workflows/.github/workflows/validate-wheelhouse.yaml@main
with:
python: "['3.8', '3.10', '3.12']"

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ __pycache__
.coverage
.unit-state.db
*.swp
*.charm
.cache/*
1 change: 1 addition & 0 deletions metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ resources:
[DEPRECATED] in favor of using a Snap Store Proxy.
See https://ubuntu.com/kubernetes/docs/proxies for more details.
series:
- noble
- jammy
- focal
storage:
Expand Down
14 changes: 12 additions & 2 deletions tests/unit/test_etcdctl.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest
from unittest.mock import patch, MagicMock

from charms.unit_test import MockKV
import reactive.etcd

import etcd_lib
Expand Down Expand Up @@ -28,6 +29,15 @@
)


@pytest.fixture
def config():
kv = MockKV()
reactive.etcd.config.reset_mock()
reactive.etcd.config.side_effect = kv.get
reactive.etcd.config.set = kv.set
return reactive.etcd.config


class TestEtcdCtl:
@pytest.fixture
def etcdctl(self):
Expand Down Expand Up @@ -140,7 +150,7 @@ def test_register_grafana_dashboard(self, mock_dashboard_render):
)
reactive.etcd.set_flag.assert_called_with("grafana.configured")

def test_register_prometheus_job(self, mocker):
def test_register_prometheus_job(self, mocker, config):
"""Test successful registration of prometheus job."""
ingress_address = "10.0.0.1"
port = "2379"
Expand All @@ -160,7 +170,7 @@ def test_register_prometheus_job(self, mocker):
mocker.patch.object(
reactive.etcd, "get_ingress_address", return_value=ingress_address
)
reactive.etcd.config.return_value = port
config.set("port", port)

register_prometheus_jobs()

Expand Down
5 changes: 3 additions & 2 deletions tests/validate-wheelhouse.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash

build_dir="$(mktemp -d)"
charm="$(egrep '^name\S*:' ./metadata.yaml | awk '{ print $2 }')"
function cleanup { rm -rf "$build_dir"; }
trap cleanup EXIT

charm build . --build-dir "$build_dir" --debug
pip install -f "$build_dir/etcd/wheelhouse" --no-index --no-cache-dir "$build_dir"/etcd/wheelhouse/*
charm-build . --build-dir "$build_dir" --debug
pip install -f "$build_dir/$charm/wheelhouse" --no-index --no-cache-dir "$build_dir"/etcd/wheelhouse/*
8 changes: 2 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ commands =

[testenv:validate-wheelhouse]
deps =
# Temporarily pin setuptools to avoid the breaking change from 58 until
# all dependencies we use have a chance to update.
# See: https://setuptools.readthedocs.io/en/latest/history.html#v58-0-0
# and: https://github.com/pypa/setuptools/issues/2784#issuecomment-917663223
setuptools<58
git+https://github.com/juju/charm-tools.git
allowlist_externals = {toxinidir}/tests/validate-wheelhouse.sh
commands = {toxinidir}/tests/validate-wheelhouse.sh
commands = {toxinidir}/tests/validate-wheelhouse.sh
2 changes: 2 additions & 0 deletions wheelhouse.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
charms.reactive @ git+https://github.com/canonical/charms.reactive.git
setuptools==70.3.0

0 comments on commit 909c01f

Please sign in to comment.