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

NotificationRules - able to create rules with same name #23781

Open
karel-rehor opened this issue Oct 5, 2022 · 1 comment · May be fixed by #23925
Open

NotificationRules - able to create rules with same name #23781

karel-rehor opened this issue Oct 5, 2022 · 1 comment · May be fixed by #23925

Comments

@karel-rehor
Copy link
Contributor

Steps to reproduce:
List the minimal actions needed to reproduce the behavior.

Working with the API directly...

  1. Create an HTTPNotificationEndpoint
  2. Create a Check
  3. Create a NotificationRule using the endpoint from step 1
  4. Reuse the same request used to create the rule in step 3 using the same name and POST it again to /notificationRules

Expected behavior:
Expected that a second rule using the name of an already existing rule would be rejected. This is the behavior with other resources. A request to create a resource with the same name of an already existing resource of the same type returns HTTP 422.

Actual behavior:
A second notificationRule with the same name, and same properties is created. Return status is HTTP 201

Response from an ensuing GET request

When sending a GET request to /notificationRules to verify that two rules with identical names and other properties have been created the array of notifcation rules confirms the behavior.

resp.body {
   "notificationRules": [
      {
         "id": "0a15d00abfa16000",
         "name": "HTTPRule_4d05",
         "description": "6jpqfuocwolilt52",
         "endpointID": "0a15d0096f465000",
         "orgID": "736a40f93fa90d37",
         "ownerID": "0a15d0080e865000",
         "taskID": "0a15d00ac25e9000",
         "sleepUntil": "2022-10-05T08:28:34.667Z",
         "every": "10m",
         "offset": "0s",
         "runbookLink": "/api/v2private/notebooks?orgID=9c5955fc99a60b8f",
         "statusRules": [
            {
               "currentLevel": "CRIT",
               "previousLevel": "ANY"
            }
         ],
         "limit": 3,
         "limitEvery": 3600,
         "createdAt": "2022-10-05T08:28:34.942380695Z",
         "updatedAt": "2022-10-05T08:28:34.942380695Z",
         "type": "http",
         "labels": [],
         "links": {
            "self": "/api/v2/notificationRules/0a15d00abfa16000",
            "labels": "/api/v2/notificationRules/0a15d00abfa16000/labels",
            "members": "/api/v2/notificationRules/0a15d00abfa16000/members",
            "owners": "/api/v2/notificationRules/0a15d00abfa16000/owners",
            "query": "/api/v2/notificationRules/0a15d00abfa16000/query"
         },
         "status": "active",
         "latestCompleted": "2022-10-05T08:28:34Z",
         "latestScheduled": "2022-10-05T08:28:34Z"
      },
      {
         "id": "0a15d00b1aa16000",
         "name": "HTTPRule_4d05",
         "description": "6jpqfuocwolilt52",
         "endpointID": "0a15d0096f465000",
         "orgID": "736a40f93fa90d37",
         "ownerID": "0a15d0080e865000",
         "taskID": "0a15d00b1cde9000",
         "sleepUntil": "2022-10-05T08:28:34.667Z",
         "every": "10m",
         "offset": "0s",
         "runbookLink": "/api/v2private/notebooks?orgID=9c5955fc99a60b8f",
         "statusRules": [
            {
               "currentLevel": "CRIT",
               "previousLevel": "ANY"
            }
         ],
         "limit": 3,
         "limitEvery": 3600,
         "createdAt": "2022-10-05T08:28:35.30643674Z",
         "updatedAt": "2022-10-05T08:28:35.30643674Z",
         "type": "http",
         "labels": [],
         "links": {
            "self": "/api/v2/notificationRules/0a15d00b1aa16000",
            "labels": "/api/v2/notificationRules/0a15d00b1aa16000/labels",
            "members": "/api/v2/notificationRules/0a15d00b1aa16000/members",
            "owners": "/api/v2/notificationRules/0a15d00b1aa16000/owners",
            "query": "/api/v2/notificationRules/0a15d00b1aa16000/query"
         },
         "status": "active",
         "latestCompleted": "2022-10-05T08:28:35Z",
         "latestScheduled": "2022-10-05T08:28:35Z"
      }
   ],
   "links": {
      "self": "/api/v2/notificationRules?descending=false&limit=20&offset=0&orgID=736a40f93fa90d37"
   }
}

Environment info:

Testing in K8SIDPE remocal.

Latest commit.

commit bacd3fe3dadd24c68f0b5c1f1b02877446b1ae26 (HEAD -> master, origin/master, origin/HEAD)
Author: influx-acs[bot] <107396960+influx-acs[bot]@users.noreply.github.com>
Date:   Wed Oct 5 07:43:51 2022 +0000
@karel-rehor
Copy link
Contributor Author

Also occurs with HTTP PUT

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