influxdata / influxdata/kapacitor

Creating an incorrect task from HTTP API returns error but creates task anyway

Open
#2,161 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.4k
Forks
479
Avg merge
4d 16h
Merged PRs (30d)
4

Description

Hi!

I am trying to create a task from the HTTP API. This task has incorrect fields, basically has some duration variables set to '0s' which kapacitor does not like (and makes no sense, but...). When posting this new kapacitor task, I am returned a `500 error` with a json saying I cannot have this variables being '0s' but the task is nonetheless created.

I believe this is a bug since when a creation (or update for the matter) returns an error, it should not create an invalid task.

### Details:
- I am using Ubuntu 18.04.2 LTS
- I am using Kapacitor 1.5.2-1 (latest version as of today).
- I am also using influxdb, chronograf and telegraf to the latest version as of today (updated an hour ago just in case!)
- I installed everything from pre-built packages
- I have attached a postman collection with a POST, GET and DELETE request (all with an example).

[Kapacitor.postman_collection.zip](https://github.com/influxdata/kapacitor/files/2868455/Kapacitor.postman_collection.zip)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the HTTP API behavior with the attached Postman collection against the reported Kapacitor version. Trace the task creation and update path to determine why validation errors occur after persistence. Done means invalid requests return an error without creating or changing a task, with regression coverage for the reported case.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.