generated from giantswarm/template-app
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update ats tests #229
Merged
Merged
update ats tests #229
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
415a8f5
update ats tests
QuantumEnigmaa e1673fa
removing seemingly unnecessary imports
QuantumEnigmaa 011b7dd
add helm templating test
QuantumEnigmaa eed72c1
nitpicking
QuantumEnigmaa 47576bc
merge with main
QuantumEnigmaa 91773fd
move templating chart test before all jobs
QuantumEnigmaa b3dd30b
merge with master
QuantumEnigmaa 4facda8
remove useless blank lines
QuantumEnigmaa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -1,4 +1,11 @@ | ||
skip-steps: smoke | ||
app-tests-app-config-file: tests/test-values.yaml | ||
app-tests-deploy-namespace: monitoring | ||
|
||
functional-tests-cluster-type: kind | ||
smoke-tests-cluster-type: kind | ||
|
||
upgrade-tests-cluster-type: kind | ||
upgrade-tests-app-catalog-url: https://giantswarm.github.io/giantswarm-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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
version: 2.1 | ||
orbs: | ||
architect: giantswarm/[email protected] | ||
jobs: | ||
template-chart: | ||
docker: | ||
- image: giantswarm/helm-chart-testing:v3.11.0 | ||
steps: | ||
- checkout | ||
- run: cd helm/grafana && helm dep up | ||
- run: helm template helm/grafana | ||
|
||
workflows: | ||
package-and-push-chart-on-tag: | ||
jobs: | ||
- template-chart: | ||
name: "template-chart" | ||
filters: | ||
branches: | ||
ignore: | ||
- master | ||
|
||
- architect/push-to-app-catalog: | ||
context: "architect" | ||
executor: "app-build-suite" | ||
|
@@ -18,6 +33,8 @@ workflows: | |
filters: | ||
tags: | ||
only: /^v.*/ | ||
requires: | ||
- "template-chart" | ||
|
||
- architect/push-to-app-catalog: | ||
context: "architect" | ||
|
@@ -31,6 +48,18 @@ workflows: | |
filters: | ||
tags: | ||
only: /^v.*/ | ||
requires: | ||
- "template-chart" | ||
|
||
- architect/run-tests-with-ats: | ||
name: run-chart-tests-with-ats | ||
filters: | ||
# Do not trigger the job on merge to master. | ||
branches: | ||
ignore: | ||
- master | ||
requires: | ||
- "app-catalog" | ||
|
||
- architect/push-to-app-collection: | ||
context: "architect" | ||
|
@@ -139,12 +168,3 @@ workflows: | |
ignore: /.*/ | ||
tags: | ||
only: /^v.*/ | ||
# - architect/run-tests-with-ats: | ||
# name: execute chart tests | ||
# filters: | ||
# # Do not trigger the job on merge to master. | ||
# branches: | ||
# ignore: | ||
# - master | ||
# requires: | ||
# - "package and push grafana chart" |
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
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 |
---|---|---|
@@ -1,16 +1,63 @@ | ||
from typing import cast | ||
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__) | ||
|
||
# when grafana pod is up, it might be still starting and returning 503 | ||
@pytest.mark.flaky(reruns=10, reruns_delay=10) | ||
@pytest.mark.functional | ||
def test_grafana_login_page_available(kube_cluster: Cluster) -> None: | ||
srv = cast(pykube.Service, pykube.Service.objects(kube_cluster.kube_client).get_or_none(name="grafana")) | ||
if srv is None: | ||
raise ValueError("'grafana service not found in the 'default' namespace") | ||
login_page_res = srv.proxy_http_get("/login") | ||
assert login_page_res.ok | ||
namespace_name = "monitoring" | ||
deployment_name= "grafana" | ||
|
||
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 grafana deployment..") | ||
|
||
deployment_ready = wait_for_ic_deployment(kube_cluster) | ||
|
||
logger.info("grafana 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': 'grafana', 'app.kubernetes.io/instance': 'grafana'}) | ||
|
||
return pods | ||
|
||
# when we start the tests on circleci, we have to wait for pods to be available, hence | ||
# this additional delay and retries | ||
QuantumEnigmaa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@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"]) |
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,112 @@ | ||
global: | ||
imageRegistry: gsoci.azurecr.io | ||
grafana: | ||
dashboardProviders: | ||
dashboardproviders.yaml: | ||
apiVersion: 1 | ||
providers: | ||
- allowUiUpdates: false | ||
disableDeletion: true | ||
editable: false | ||
folder: Giant Swarm private dashboards | ||
folderUid: GMtRhFeGz | ||
name: private | ||
options: | ||
path: /var/lib/grafana/dashboards/private | ||
type: file | ||
updateIntervalSeconds: 60 | ||
- allowUiUpdates: false | ||
disableDeletion: true | ||
editable: false | ||
folder: Giant Swarm public dashboards | ||
folderUid: b6utHHg7z | ||
name: public | ||
options: | ||
path: /var/lib/grafana/dashboards/public | ||
type: file | ||
updateIntervalSeconds: 60 | ||
- allowUiUpdates: false | ||
disableDeletion: true | ||
editable: false | ||
folder: Your dashboards | ||
folderUid: customerDashboards | ||
name: customer-provided | ||
options: | ||
path: /var/lib/grafana/dashboards/customer | ||
type: file | ||
updateIntervalSeconds: 60 | ||
grafana.ini: | ||
analytics: | ||
check_for_updates: false | ||
feedback_links_enabled: false | ||
reporting_enabled: false | ||
auth: | ||
disable_login_form: true | ||
disable_signout_menu: true | ||
auth.basic: | ||
enabled: true | ||
auth.generic_oauth: | ||
allow_assign_grafana_admin: true | ||
allow_sign_up: true | ||
api_url: https://dex.grizzly.gaws.gigantic.io/userinfo | ||
auth_url: https://dex.grizzly.gaws.gigantic.io/auth | ||
auto_login: true | ||
client_id: 2qRgNb5qQBk3QqWxI1WLgB5zTQ1M4eB+ | ||
enabled: true | ||
name: grafana-dex | ||
role_attribute_path: contains(groups, 'giantswarm-ad:giantswarm-admins') && | ||
'GrafanaAdmin' || contains(groups, 'customer:giantswarm:Employees') && 'Viewer' | ||
|| contains (groups, 'giantswarm-github:giantswarm:giantswarm-admins') && | ||
'GrafanaAdmin' | ||
role_attribute_strict: true | ||
scopes: openid profile email groups offline_access | ||
token_url: https://dex.grizzly.gaws.gigantic.io/token | ||
use_refresh_token: true | ||
dashboards: | ||
default_home_dashboard_path: /var/lib/grafana/dashboards/public/home/home.json | ||
public_dashboards: | ||
enabled: false | ||
security: | ||
cookie_secure: true | ||
disable_gravatar: true | ||
server: | ||
protocol: http | ||
root_url: https://grafana.grizzly.gaws.gigantic.io | ||
users: | ||
allow_org_create: false | ||
allow_sign_up: false | ||
viewers_can_edit: true | ||
image: | ||
repository: giantswarm/grafana | ||
ingress: | ||
annotations: | ||
cert-manager.io/cluster-issuer: letsencrypt-giantswarm | ||
kubernetes.io/tls-acme: "true" | ||
enabled: true | ||
hosts: | ||
- grafana.grizzly.gaws.gigantic.io | ||
ingressClassName: nginx | ||
tls: | ||
- hosts: | ||
- grafana.grizzly.gaws.gigantic.io | ||
secretName: grafana-tls | ||
rbac: | ||
pspEnabled: false | ||
serviceMonitor: | ||
enabled: true | ||
sidecar: | ||
dashboards: | ||
SCProvider: false | ||
enabled: true | ||
folder: /var/lib/grafana/dashboards | ||
label: app.giantswarm.io/kind | ||
labelValue: dashboard | ||
searchNamespace: ALL | ||
datasources: | ||
enabled: true | ||
label: app.giantswarm.io/kind | ||
labelValue: datasource | ||
resource: both | ||
searchNamespace: ALL | ||
image: | ||
repository: giantswarm/k8s-sidecar |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean main right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have preferred but unfortunately, this repo's "main" branch is called "master" :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it? Maybe we should change it then :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would totally agree :)