Merge pull request #3523 from grafana/dev

v1.3.74
This commit is contained in:
Matias Bordese 2023-12-06 13:12:31 -03:00 committed by GitHub
commit 0c5c01bfdb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 1 deletions

View file

@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
## v1.3.74 (2023-12-06)
### Fixed
- Fix missing timestamp value in old grafana API endpoint ([#3522](https://github.com/grafana/oncall/pull/3522))
## v1.3.73 (2023-12-06)

View file

@ -184,6 +184,46 @@ def test_integration_grafana_endpoint_has_alerts(
)
@patch("apps.integrations.views.create_alert")
@pytest.mark.django_db
def test_integration_old_grafana_endpoint(
mock_create_alert, settings, make_organization_and_user, make_alert_receive_channel
):
settings.DEBUG = False
integration_type = "grafana"
organization, user = make_organization_and_user()
alert_receive_channel = make_alert_receive_channel(
organization=organization,
author=user,
integration=integration_type,
)
client = APIClient()
url = reverse("integrations:grafana", kwargs={"alert_channel_key": alert_receive_channel.token})
data = {}
now = timezone.now()
with patch("django.utils.timezone.now") as mock_now:
mock_now.return_value = now
response = client.post(url, data, format="json")
assert response.status_code == status.HTTP_200_OK
mock_create_alert.apply_async.assert_called_once_with(
[],
{
"title": "Title",
"message": None,
"image_url": None,
"link_to_upstream_details": None,
"alert_receive_channel_pk": alert_receive_channel.pk,
"integration_unique_data": '{"evalMatches": []}',
"raw_request_data": data,
"received_at": now.isoformat(),
},
)
@patch("apps.integrations.views.create_alert")
@pytest.mark.parametrize(
"integration_type",

View file

@ -289,6 +289,7 @@ class GrafanaAPIView(
},
)
else:
timestamp = timezone.now().isoformat()
create_alert.apply_async(
[],
{