Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cortexapps_cli/commands/integrations_commands/prometheus.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def add(
"host": host,
"username": username,
"password": password,
"tenant_id": tenant_id,
"is_default": is_default
"tenantId": tenant_id,
"isDefault": is_default
}

for k, v in data.items():
Expand Down Expand Up @@ -159,7 +159,7 @@ def validate(

client = ctx.obj["client"]

r = client.post("api/v1/prometheus/configurations/validate" + alias)
r = client.post("api/v1/prometheus/configuration/validate/" + alias)
print_json(data=r)

@app.command()
Expand All @@ -172,5 +172,5 @@ def validate_all(

client = ctx.obj["client"]

r = client.post("api/v1/prometheus/configurations")
r = client.post("api/v1/prometheus/configuration/validate")
print_json(data=r)
7 changes: 7 additions & 0 deletions tests/test_integrations_prometheus.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from tests.helpers.utils import *
import json

# Since responses are all mocked and no data validation is done by the CLI --
# we let the API handle validation -- we don't need valid input files.
Expand All @@ -11,6 +12,12 @@ def _dummy_file(tmp_path):
def test_integrations_prometheus_add():
responses.add(responses.POST, os.getenv("CORTEX_BASE_URL") + "/api/v1/prometheus/configuration", json={}, status=200)
cli(["integrations", "prometheus", "add", "-a", "myAlias", "-h", "my.host.com", "--username", "my-user", "--password", "my-password", "-t", "my-tenant", "-i"])
body = json.loads(responses.calls[0].request.body)
assert body["password"] == "my-password"
assert body["tenantId"] == "my-tenant"
assert body["isDefault"] is True
assert "tenant_id" not in body
assert "is_default" not in body

@responses.activate
def test_integrations_prometheus_add_multiple(tmp_path):
Expand Down