generated from giantswarm/template-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add tests for the chart * Update .ats/main.yaml Co-authored-by: Hervé Nicol <[email protected]> * change job dependency for push-to-registries --------- Co-authored-by: Hervé Nicol <[email protected]>
- Loading branch information
1 parent
d1d5bd8
commit 5344001
Showing
8 changed files
with
489 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
app-tests-app-config-file: tests/test-values.yaml | ||
app-tests-deploy-namespace: monitoring | ||
|
||
smoke-tests-cluster-type: kind | ||
|
||
upgrade-tests-cluster-type: kind | ||
upgrade-tests-app-catalog-url: https://giantswarm.github.io/control-plane-catalog | ||
upgrade-tests-app-config-file: tests/test-values.yaml | ||
|
||
skip-steps: [functional] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[[source]] | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
[packages] | ||
pytest-helm-charts = ">=1.0.2" | ||
pytest = ">=6.2.5" | ||
pykube-ng = ">=22.1.0" | ||
pytest-rerunfailures = "~=14.0" | ||
|
||
[requires] | ||
python_version = "3.9" |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[pytest] | ||
markers = | ||
smoke | ||
functional | ||
upgrade |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import logging | ||
from typing import List | ||
|
||
import pykube | ||
import pytest | ||
from pytest_helm_charts.clusters import Cluster | ||
from pytest_helm_charts.k8s.deployment import wait_for_deployments_to_run | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
namespace_name = "monitoring" | ||
deployment_name= "observability-operator" | ||
|
||
timeout: int = 560 | ||
|
||
@pytest.mark.smoke | ||
def test_api_working(kube_cluster: Cluster) -> None: | ||
""" | ||
Testing apiserver availability. | ||
""" | ||
assert kube_cluster.kube_client is not None | ||
assert len(pykube.Node.objects(kube_cluster.kube_client)) >= 1 | ||
|
||
# scope "module" means this is run only once, for the first test case requesting! It might be tricky | ||
# if you want to assert this multiple times | ||
@pytest.fixture(scope="module") | ||
def ic_deployment(kube_cluster: Cluster) -> List[pykube.Deployment]: | ||
logger.info("Waiting for observability-operator deployment..") | ||
|
||
deployment_ready = wait_for_ic_deployment(kube_cluster) | ||
|
||
logger.info("observability-operator deployment looks satisfied..") | ||
|
||
return deployment_ready | ||
|
||
def wait_for_ic_deployment(kube_cluster: Cluster) -> List[pykube.Deployment]: | ||
deployments = wait_for_deployments_to_run( | ||
kube_cluster.kube_client, | ||
[deployment_name], | ||
namespace_name, | ||
timeout, | ||
) | ||
return deployments | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def pods(kube_cluster: Cluster) -> List[pykube.Pod]: | ||
pods = pykube.Pod.objects(kube_cluster.kube_client) | ||
|
||
pods = pods.filter(namespace=namespace_name, selector={ | ||
'app.kubernetes.io/name': 'observability-operator', 'app.kubernetes.io/instance': 'observability-operator'}) | ||
|
||
return pods | ||
|
||
# when we start the tests on circleci, we have to wait for pods to be available, hence | ||
# this additional delay and retries | ||
|
||
|
||
@pytest.mark.smoke | ||
@pytest.mark.upgrade | ||
@pytest.mark.flaky(reruns=5, reruns_delay=10) | ||
def test_pods_available(ic_deployment: List[pykube.Deployment]): | ||
for s in ic_deployment: | ||
assert int(s.obj["status"]["readyReplicas"]) == int( | ||
s.obj["spec"]["replicas"]) |
Empty file.