Skip to content

Commit

Permalink
use most recent workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
MiaAltieri committed Jul 31, 2024
1 parent 8e30908 commit 504c206
Show file tree
Hide file tree
Showing 11 changed files with 422 additions and 915 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
jobs:
lint:
name: Lint
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v13.1.2
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v16.7.0

lib-check:
name: Check libraries
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:

build:
name: Build charm | ${{ matrix.path }}
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v13.1.2
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v16.7.0
strategy:
matrix:
path:
Expand All @@ -60,14 +60,14 @@ jobs:
cache: true
path-to-charm-directory: ${{ matrix.path }}
integration-test:
name: Integration test charm | 3.1.7
name: Integration test charm | 3.4.4
needs:
- lint
- unit-test
- build
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v13.1.2
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v16.7.0
with:
artifact-prefix: packed-charm-cache-true
cloud: microk8s
microk8s-snap-channel: 1.29-strict/stable
juju-agent-version: 3.1.7
juju-agent-version: 3.4.4
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ jobs:

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/build_charm_without_cache.yaml@v8.0.0
uses: canonical/data-platform-workflows/.github/workflows/build_charm_without_cache.yaml@v16.7.0

release-charm:
name: Release charm
needs:
- ci-tests
- build
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v8.0.0
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v16.7.0
with:
channel: 6/edge
artifact-name: ${{ needs.build.outputs.artifact-name }}
secrets:
charmhub-token: ${{ secrets.CHARMHUB_TOKEN }}
permissions:
contents: write # Needed to create GitHub release
contents: write # Needed to create GitHub release

release-libraries:
name: Release libraries
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sync_issue_to_jira.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
sync:
name: Sync GitHub issue to Jira
uses: canonical/data-platform-workflows/.github/workflows/sync_issue_to_jira.yaml@v8.0.0
uses: canonical/data-platform-workflows/.github/workflows/sync_issue_to_jira.yaml@v16.7.0
with:
jira-base-url: https://warthogs.atlassian.net
jira-project-key: DPE
Expand All @@ -18,4 +18,4 @@ jobs:
jira-api-token: ${{ secrets.JIRA_API_TOKEN }}
jira-user-email: ${{ secrets.JIRA_USER_EMAIL }}
permissions:
issues: write # Needed to create GitHub issue comment
issues: write # Needed to create GitHub issue comment
2 changes: 0 additions & 2 deletions metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ website:
- https://github.com/canonical/mongos-k8s-operator
- https://chat.charmhub.io/charmhub/channels/data-platform
summary: A mongos k8s operator charm
series:
- jammy

peers:
router-peers:
Expand Down
1,206 changes: 333 additions & 873 deletions poetry.lock

Large diffs are not rendered by default.

63 changes: 36 additions & 27 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@ repository = "https://github.com/canonical/mongos-k8s-operator"


[tool.poetry.dependencies]
python ="^3.10.12"
python = "^3.10.12"
ops = "^2.15.0"
pymongo = "^4.7.3"
tenacity = "^8.2.3"
pymongo = "^4.6.3"
ops = "^2.4.1"
parameterized = "^0.9.0"
cffi = "^1.16.0"
pyopenssl = "^24.1.0"
cosl = "^ 0.0.11"
pure-sasl = ">=0.6.2"
jsonschema = ">=4.10"
cryptography = "^42.0.5"
poetry= "^1.8.2"
pydantic ="^1.10.7"
pyyaml = "^6.0.1"
jinja2= "^3.1.3"
rpds-py = "0.18.0"

jinja2 = "^3.1.3"
poetry-core = "^1.9.0"
data-platform-helpers = "^0.1.2"
pyOpenSSL = "^24.2.1"
setuptools = "^72.0.0"
# FIXME: Unpin once rustc 1.76 is available at build time
rpds-py = "<0.19"

[tool.poetry.group.charm-libs.dependencies]
# data_platform_libs/v0/data_interfaces.py
ops = ">=2.0.0"
ops = "^2.15.0"
pydantic = "^1.10.7" # cos_agent lib
cryptography = "^42.0.5" # tls_certificates lib v3
jsonschema = "^4.22.0" # tls_certificates lib v3
cosl = "^0.0.16" # loki_push_api
pyOpenSSL = "^24.2.1"

[tool.poetry.group.format]
optional = true
Expand All @@ -60,21 +60,30 @@ black = "^24.4.2"
isort = "^5.13.2"

[tool.poetry.group.unit.dependencies]
pytest = "^7.4.3"
pytest-cov = "^4.1.0"
coverage = {extras = ["toml"], version = "^7.5.0"}
pytest = "^8.1.1"
parameterized = "^0.9.0"

[tool.poetry.group.integration.dependencies]
pytest = "^7.4.3"
pytest-operator = "^0.28.0"
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v8.0.0", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v8.0.0", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
pytest-asyncio ="^0.17"
tenacity = "^8.1.0"
pymongo = "^4.3.3"
ops = "^2.4.1"
allure-pytest = "^2.13.5"
ops = "^2.15.0"
tenacity = "^8.2.3"
pymongo = "^4.7.3"
parameterized = "^0.9.0"
lightkube = "^0.15.3"
kubernetes = "^30.1.0"
juju = "^3.4.0"
pytest = "^8.1.1"
pytest-asyncio = "^0.21.1"
pytest-mock = "^3.14.0"
pytest-operator = "^0.34.0"
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v16.7.0", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v16.7.0", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v16.7.0", subdirectory = "python/pytest_plugins/github_secrets"}
allure-pytest-collection-report = {git = "https://github.com/canonical/data-platform-workflows", tag = "v16.7.0", subdirectory = "python/pytest_plugins/allure_pytest_collection_report"}

[build-system]
requires = ["poetry-core"]
requires = ["poetry-core>=1.9.0"]
build-backend = "poetry.core.masonry.api"

# Linting tools configuration
Expand Down
7 changes: 6 additions & 1 deletion src/charm.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
from ops.charm import CharmBase
from ops.main import main


class MongosOperatorCharm(CharmBase):
class MongosCharm(CharmBase):
"""A Juju Charm to deploy mongos on Kubernetes."""

def __init__(self, *args):
"""Listen to juju events and pair them with their associated function."""
super().__init__(*args)


if __name__ == "__main__":
main(MongosCharm)
2 changes: 2 additions & 0 deletions tests/integration/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
31 changes: 31 additions & 0 deletions tests/integration/test_charm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env python3
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

from pathlib import Path

import pytest
import yaml
from pytest_operator.plugin import OpsTest

MONGOS_APP_NAME = "mongos"
METADATA = yaml.safe_load(Path("./metadata.yaml").read_text())


@pytest.mark.group(1)
@pytest.mark.abort_on_fail
async def test_build_and_deploy(ops_test: OpsTest):
"""TODO: Build the charm-under-test and deploy it together with related charms.
Assert on the unit status before any relations/configurations take place.
"""
charm = await ops_test.build_charm(".")
resources = {
"mongodb-image": METADATA["resources"]["mongodb-image"]["upstream-source"]
}
await ops_test.model.deploy(
charm,
resources=resources,
application_name=MONGOS_APP_NAME,
series="jammy",
)
2 changes: 2 additions & 0 deletions tests/unit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
4 changes: 2 additions & 2 deletions tests/unit/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

from ops.testing import Harness

from charm import MongosOperatorCharm
from charm import MongosCharm


class TestCharm(unittest.TestCase):
"""Basic unit tests for mongos charm."""

def setUp(self, *unused):
"""Set up the charm for each unit test."""
self.harness = Harness(MongosOperatorCharm)
self.harness = Harness(MongosCharm)
self.addCleanup(self.harness.cleanup)
self.harness.begin()

Expand Down

0 comments on commit 504c206

Please sign in to comment.