Skip to content
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

Implement black box test for certificate_transfer interface #280

Open
bencekov opened this issue Dec 5, 2023 · 2 comments
Open

Implement black box test for certificate_transfer interface #280

bencekov opened this issue Dec 5, 2023 · 2 comments

Comments

@bencekov
Copy link
Contributor

bencekov commented Dec 5, 2023

The tests in test_trusted_certificates.py are whitebox tests. A blackbox test would be less brittle and would better cover what we want to cover. Example.

I think a better itest would be

graph LR

self-signed-certs ---|tls-certificates| traefik ---|ingress| prometheus
grafana ---|recv-ca-cert| self-signed-certs
grafana ---|grafana-source| prometheus
Loading

The problem is that for some reason querying for datasource health doesn't work:

$ juju run graf/0 get-admin-password
admin-password: jsbSwIxR6Dg6
url: http://graf-0.graf-endpoints.auth2.svc.cluster.local:3000

$ curl "10.1.166.122:3000/api/datasources" -u admin:jsbSwIxR6Dg6 | jq
[
  {
    "id": 1,
    "uid": "P5DE4FBB56E88771A",
    "orgId": 1,
    "name": "juju_auth2_ee15db9c-9f5d-4594-8b77-3a78862775f4_prom_0",
    "type": "prometheus",
    "typeName": "Prometheus",
    "typeLogoUrl": "public/app/plugins/datasource/prometheus/img/prometheus_logo.svg",
    "access": "proxy",
    "url": "http://prom-0.prom-endpoints.auth2.svc.cluster.local:9090",
    "user": "",
    "database": "",
    "basicAuth": false,
    "isDefault": false,
    "jsonData": {
      "timeInterval": "1m",
      "timeout": 300
    },
    "readOnly": true
  }
]

$ curl "10.1.166.122:3000/api/datasources/uid/P5DE4FBB56E88771A/health" -u admin:jsbSwIxR6Dg6 | jq
{
  "message": "Not found",
  "traceID": ""
}

Any ideas?

Originally posted by @sed-i in #279 (comment)
Comment edited for context by @bencekov

@sed-i
Copy link
Contributor

sed-i commented Dec 5, 2023

@simskij pointed out that a healthcheck is impl'd but for me the issue still persists.

@simskij also pointed out that prometheus health could be checked via the grafana proxy like so:

$ curl "http://10.1.166.122:3000/api/datasources/proxy/uid/P5DE4FBB56E88771A/-/healthy" -u admin:jsbSwIxR6Dg6
Prometheus Server is Healthy.

@lucabello
Copy link
Contributor

I believe this health check is only implemented in Grafana 101, and we're currently using Grafana 9.

Either we upgrade this image, or we perform the health check in the already suggested way.

Footnotes

  1. https://github.com/grafana/grafana/issues/65970#issuecomment-1893796867

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants