Skip to content

Commit

Permalink
Merge commit 'c257e1750b7b44e101bc49c9ea985994358a9ac5' into charmcraft3
Browse files Browse the repository at this point in the history
  • Loading branch information
hpidcock committed Nov 21, 2024
2 parents dfc4830 + c257e17 commit ce266fa
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 36 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ jobs:
build:
name: Build charms
needs: unit-tests
uses: canonical/data-platform-workflows/.github/workflows/build_charms_with_cache.yaml@v4
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v23
with:
artifact-name: charm-packed
charmcraft-snap-channel: 3.x/stable


channel:
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
env:
CHARMCRAFT_AUTH: ${{ secrets.CHARMCRAFT_AUTH }}
run: |
sudo snap install charmcraft --classic
sudo snap install charmcraft --channel 3.x/stable --classic
charmcraft upload ${{ steps.download.outputs.download-path }}/*.charm \
--name $CHARM_NAME \
--release ${{ needs.channel.outputs.test }}
Expand Down Expand Up @@ -188,7 +188,7 @@ jobs:
steps:
- name: Install Charmcraft
run: |
sudo snap install charmcraft --classic
sudo snap install charmcraft --channel 3.x/stable --classic
- name: Get uploaded revision
id: revision
Expand Down
38 changes: 8 additions & 30 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,11 @@ type: charm
parts:
charm:
charm-python-packages: [setuptools,markdown]
bases:
- build-on:
- name: ubuntu
channel: "24.04"
architectures: ["amd64"]
run-on:
- name: ubuntu
channel: "24.04"
architectures:
- amd64
- arm64
- s390x
- ppc64el
- riscv64
- name: ubuntu
channel: "22.04"
architectures:
- amd64
- arm64
- s390x
- ppc64el
- riscv64
- name: ubuntu
channel: "20.04"
architectures:
- amd64
- arm64
- s390x
- ppc64el
- riscv64
build-packages:
- cargo
base: [email protected]
platforms:
amd64:
arm64:
s390x:
ppc64el:
2 changes: 2 additions & 0 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ def _on_metrics_endpoint_relation_created(self, event: RelationJoinedEvent):
api_port = self.api_port()
except AgentConfException as e:
logger.error('cannot read controller API port from agent configuration: %s', e)
self.unit.status = BlockedStatus(
f"can't read controller API port from agent.conf: {e}")
return

metrics_endpoint = MetricsEndpointProvider(
Expand Down
6 changes: 4 additions & 2 deletions tests/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import yaml

from charm import JujuControllerCharm, AgentConfException
from ops.model import BlockedStatus, ActiveStatus
from ops import BlockedStatus, ActiveStatus
from ops.testing import Harness
from unittest.mock import mock_open, patch

Expand Down Expand Up @@ -139,7 +139,9 @@ def test_apiaddresses_missing_status(self, *_):

harness.add_relation('metrics-endpoint', 'prometheus-k8s')
harness.evaluate_status()
self.assertIsInstance(harness.charm.unit.status, BlockedStatus)
self.assertEqual(harness.charm.unit.status, BlockedStatus(
"can't read controller API port from agent.conf: agent.conf key 'apiaddresses' missing"
))

@patch("builtins.open", new_callable=mock_open, read_data=agent_conf_ipv4)
def test_apiaddresses_ipv4(self, _):
Expand Down

0 comments on commit ce266fa

Please sign in to comment.