Commit Graph

22 Commits

Author SHA1 Message Date
George Robinson 4d6ddd25c9
Fix panic in acceptance tests (#3592)
* Fix panic in acceptance tests

This commit attempts to address a panic that occurs in acceptance
tests if a server in the cluster fails to start.

Signed-off-by: George Robinson <george.robinson@grafana.com>

* Remove started and check am.cmd.Process != nil

Signed-off-by: George Robinson <george.robinson@grafana.com>

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-02-13 15:38:44 +00:00
Matthieu MOREL b81bad8711 use Go standard errors
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-12-08 16:44:13 +01:00
George Robinson 70bd5dad98
Support UTF-8 label matchers: Use compat package in Alertmanager server (#3567)
* Support UTF-8 label matchers: Use compat package in Alertmanager server

This pull request adds use of the compat package in Alertmanager server that will allow users to switch between the new matchers/parse parser and the old pkg/labels parser. The new matchers/parse parser uses a fallback mechanism where if the input cannot be parsed in the new parser it then attempts to use the old parser. If an input is parsed in the old parser but not the new parser then a warning log is emitted.

Signed-off-by: George Robinson <george.robinson@grafana.com>

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2023-11-24 10:01:40 +00:00
Simon Pasquier 01e1f5433a test: reduce flakiness of acceptance tests
The CI environment isn't as performant as local machines: the time
needed to fully initialize the test environment can be significant and
skew the verification. Rather than setting the "virtual" clock used to
measure alert timings at the beginning of the acceptance test, it is
better to wait for the test bed to be ready.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2023-01-13 16:10:38 +01:00
Ben Kochie 432ee01c8c
Update Go to 1.19 (#3150)
* Update Go to 1.19

* Update Go.
* Update some Go modules.
* Update Swagger to the latest for Go 1.19 compatibility.
* api/v2: regenerate
* Accommodate to the changes in the client package
* asset/assets_vfsdata.go: regenerate

Signed-off-by: SuperQ <superq@gmail.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
2022-11-30 17:06:57 +01:00
Cosrider 228b7959b3
Delete unreachable code caused by t.Fatalf (#3042)
Signed-off-by: Cosrider <cosrider7@gmail.com>

Signed-off-by: Cosrider <cosrider7@gmail.com>
2022-09-09 16:07:53 +02:00
inosato 791e542100 Remove ioutil
Signed-off-by: inosato <si17_21@yahoo.co.jp>
2022-07-18 22:01:02 +09:00
gotjosh cbc94fad46
Acceptance Tests: Better error messages
The CI keeps reporting flakes for our acceptance test around the starting and stopping of the Alertmanagers. While I have an idea of where these failures are coming from, it would be nice to get a confirmation by structuring our error messages a bit better.

Signed-off-by: gotjosh <josue.abreu@gmail.com>
2022-07-07 11:09:42 +01:00
Simon Pasquier 1207b90029 test/with_api_v2: remove calls to the v1 API
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-06-20 17:37:08 +02:00
Simon Pasquier c20873b1fe
test/with_api_v2: fix variable shadowing (#1889)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-05-15 10:49:59 +02:00
Paul Gier 8688c7b9ad api/v2: move generated client code from test to api/v2 (#1792)
- Move the generated api/v2 client code out of the test directory
and into the api/v2 directory with models and restapi.
- Remove duplicate models directory
- Update tests to use api/v2 package for models and client

Signed-off-by: Paul Gier <pgier@redhat.com>
2019-03-12 17:11:23 +01:00
Karsten Weiss c637ca1a6e Fix typos in comments and metric HELPs (#1790)
No functional change.

Signed-off-by: Karsten Weiss <knweiss@gmail.com>
2019-03-12 10:29:26 +01:00
stuart nelson 51eebbef85
Stn/correctly mark api silences (#1733)
* Update alert status on every GET to alerts

Signed-off-by: stuart nelson <stuartnelson3@gmail.com>
2019-02-18 17:06:51 +01:00
Simon Pasquier b676fa79c0 *: update Makefile.common with new staticcheck (#1692)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-01-04 15:37:33 +01:00
Max Leonard Inden 2b697aaa6b
api/v2: Extract shared properties of gettable and postable alert
With issue 1465 on openapi-generator [1] being fixed, we can not extract
shared properties of the gettable and postable alert definition into a
shared object (`alert`) like we do for silence, gettable silence and
postable silence.

In addition this patch does the following changes to the UI:

- Use `List GettableAlert` instead of plural type definition like
`GettableAlerts` because the plural definitions are not generated.

- Fix openapi-generator-cli docker image to specific hash.

[1] https://github.com/OpenAPITools/openapi-generator/issues/1465

Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2018-11-28 14:35:39 +01:00
Max Inden 091a8a83b1
Merge pull request #1632 from mxinden/alerts-api-v2
ui: Move alerts to api v2
2018-11-26 14:28:13 +01:00
Simon Pasquier d6f8437b9b test/with_api_v2: add test for route prefix
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-11-23 13:59:28 +01:00
Max Leonard Inden f504f953c1
ui: Move /alerts to API v2
Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2018-11-23 12:53:48 +01:00
Max Leonard Inden e4e053b18e
ui: Move /status & /silences to API v2
This patch makes the Alertmanager UI (/status & /silences) use the
api/v2 endpoint. In addition it adds logic to generate the elm side data
model based on the OpenAPI specification.

Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2018-11-15 13:24:26 +01:00
Simon Pasquier 306fd73e32 *: remove use of golang.org/x/net/context
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-11-09 10:00:23 +01:00
Max Leonard Inden d123cbe696
test: Enable testing against cluster of Alertmanagers
Instead of only testing single instance Alertmanagers, this patch
enables individual tests to spin up Alertmanager clusters.

In addition it adds two tests:

1. A test firing alerts against a cluster, expecting to only receive a a
notification by one of the Alertmanager instances in the cluster.

2. A test firing alerts both against a single instance as well as a
cluster, making sure the output equals.

Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2018-10-24 15:59:36 +02:00
Max Leonard Inden f1b920bcc9
api: Implement OpenAPI generated Alertmanager API V2
The current Alertmanager API v1 is undocumented and written by hand.
This patch introduces a new Alertmanager API - v2. The API is fully
generated via an OpenAPI 2.0 [1] specification (see
`api/v2/openapi.yaml`) with the exception of the http handlers itself.

Pros:
- Generated server code
- Ability to generate clients in all major languages
  (Go, Java, JS, Python, Ruby, Haskell, *elm* [3] ...)
    - Strict contract (OpenAPI spec) between server and clients.
    - Instant feedback on frontend-breaking changes, due to strictly
      typed frontend language elm.
- Generated documentation (See Alertmanager online Swagger UI [4])

Cons:
- Dependency on open api ecosystem including go-swagger [2]

In addition this patch includes the following changes.

- README.md: Add API section

- test: Duplicate acceptance test to API v1 & API v2 version

  The Alertmanager acceptance test framework has a decent test coverage
  on the Alertmanager API. Introducing the Alertmanager API v2 does not go
  hand in hand with deprecating API v1. They should live alongside each
  other for a couple of minor Alertmanager versions.

  Instead of porting the acceptance test framework to use the new API v2,
  this patch duplicates the acceptance tests, one using the API v1, the
  other API v2.

  Once API v1 is removed we can simply remove `test/with_api_v1` and bring
  `test/with_api_v2` to `test/`.

[1]
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md

[2] https://github.com/go-swagger/go-swagger/

[3] https://github.com/ahultgren/swagger-elm

[4]
http://petstore.swagger.io/?url=https://raw.githubusercontent.com/mxinden/alertmanager/apiv2/api/v2/openapi.yaml

Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2018-09-04 13:38:34 +02:00