fix(tests): add alert fingerprint to prop validation

This commit is contained in:
Łukasz Mierzwa
2020-07-02 13:54:47 +01:00
committed by Łukasz Mierzwa
parent f1dec5aedf
commit 2dd1897937
4 changed files with 10 additions and 0 deletions

View File

@@ -89,6 +89,7 @@ describe("<Alert />", () => {
const alert = MockedAlert();
alert.alertmanager[0].inhibitedBy = ["123456"];
alert.alertmanager.push({
fingerprint: "abc",
name: "ha2",
cluster: "HA",
state: "active",
@@ -123,6 +124,7 @@ describe("<Alert />", () => {
it("only renders one @cluster label per alertmanager cluster", () => {
const alert = MockedAlert();
alert.alertmanager.push({
fingerprint: "123",
name: "ha1",
cluster: "HA",
state: "active",
@@ -132,6 +134,7 @@ describe("<Alert />", () => {
inhibitedBy: [],
});
alert.alertmanager.push({
fingerprint: "123",
name: "ha2",
cluster: "HA",
state: "active",
@@ -209,6 +212,7 @@ describe("<Alert />", () => {
const alert = MockedAlert();
alert.alertmanager = [
{
fingerprint: "123",
name: "am1",
cluster: "ha",
state: "suppressed",
@@ -218,6 +222,7 @@ describe("<Alert />", () => {
inhibitedBy: [],
},
{
fingerprint: "123",
name: "am2",
cluster: "ha",
state: "suppressed",

View File

@@ -130,6 +130,7 @@ describe("<AlertGroup />", () => {
MockAlerts(2);
for (let i = 0; i < group.alerts.length; i++) {
group.alerts[i].alertmanager.push({
fingerprint: "123",
name: "ha1",
cluster: "HA",
state: "active",
@@ -139,6 +140,7 @@ describe("<AlertGroup />", () => {
inhibitedBy: [],
});
group.alerts[i].alertmanager.push({
fingerprint: "123",
name: "ha2",
cluster: "HA",
state: "active",

View File

@@ -10,6 +10,7 @@ const Annotation = PropTypes.exact({
});
const APIAlertAlertmanagerState = PropTypes.exact({
fingerprint: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
cluster: PropTypes.string.isRequired,
state: AlertState.isRequired,

View File

@@ -13,6 +13,7 @@ const MockAlert = (annotations, labels, state) => ({
state: state,
alertmanager: [
{
fingerprint: "1234567",
name: "default",
cluster: "default",
state: "active",
@@ -67,6 +68,7 @@ const MockSilence = () => ({
});
const MockAlertmanager = () => ({
fingerprint: "1234567",
name: "default",
cluster: "default",
uri: "http://localhost",