Commits
- Commit:
a17d3f9dc6856d0cb60bf176e66844dc2752782d- From:
- Oliver Lowe <o@olowe.co>
- Date:
Simplify service JSON marshalling
We don't need to have a MarshalJSON method just so that it can be
created ok. It's clearer to do stuff necessart for object creation at
the time of object creation, not way earlier in some unrelated bit of
the code.
While here simplify the tests to actually test what we're worried about.
- Commit:
8f08828e8134e1160b4be74544d3b6020059366e- From:
- Oliver Lowe <o@olowe.co>
- Date:
store a service's last check result
- Commit:
f4705a64149eb5336dd9f69e1a32ebf7d886a132- From:
- Oliver Lowe <o@olowe.co>
- Date:
icinga_test: Don't assign group for random hosts
We can test hostgroup assignment in other tests if desired.
- Commit:
62bf235cf08fdde3e89d389bdc78b8602069b28c- From:
- Oliver Lowe <o@olowe.co>
- Date:
icinga_test: Inline permissions response
No need for a file on disk; it's only referenced once.
- Commit:
87154adc3ffe738b0e1223d666c0ae63e1926399- From:
- Oliver Lowe <o@olowe.co>
- Date:
Run a full test on builds.sr.ht for every commit
On OpenBSD. Why not?
- Commit:
b717ce9bd51371aefd55ccd6ddf623f83aed8e29- From:
- Oliver Lowe <o@olowe.co>
- Date:
Test against a fake in-processs icinga server
A lot of the testing doesn't really flex what a real icinga2 server
does. We can implement a simple fake server with about 250 lines of
Go, then we get all the benefits of really quick feedback and no
dependency on an icinga2 server (which isn't super easy to set up) for
most tests. More complicated tests are still performed against a real
server listening on loopback (if available).
- Commit:
49e200e1bf5862fe2a396ba4b3fa1646aa09e3ee- From:
- Oliver Lowe <o@olowe.co>
- Date:
Remove unnecessary parseAPIResponse function
All this did was wrap the usual standard library JSON decode
procedure.
- Commit:
9feb16b3670b92265319b98dbd2bdcb5d8f21db7- From:
- Oliver Lowe <o@olowe.co>
- Date:
Remove useless loop
We always returned something on the first iteration, so just remove it.
- Commit:
e4ad50b973973310a1823f00ea975697e93e3182- From:
- Oliver Lowe <o@olowe.co>
- Date:
panic on unlikely test case
We're just in test mode, so it's ok to panic if we reach this highly unlikely
scenario when, for example, the testdata file changes or something.
- Commit:
c26e0f9dab045063f9fb15a64233322532b18dcb- From:
- Oliver Lowe <o@olowe.co>
- Date:
Use default MarshalJSON method
There's no point doing so much manual work and testing just to keep
fields under a "attrs" key when marshalling to JSON. When creating the
object we can just:
1. Marshal the object to JSON
2. Put it all under a "attrs" key.
Now it's easier to imagine the mapping of the structs to JSON, since
they follow the same rules as everything else in Go.
- Commit:
717a9e7823638c994c6620883fcee2ef98da294b- From:
- Oliver Lowe <o@olowe.co>
- Date:
Keep test data in version control
While here also don't log messages in testing unless there's an error.
- Commit:
dca9442c1f7da187028aaaf66f2ebf7c34d6a863- From:
- Oliver Lowe <o@olowe.co>
- Date:
Catch all HostStates and ServiceStates
This is closer to the Icinga spec, anything greater than 2 or 3 is unknown.
- Commit:
e35b73d5e39c5601f8db91e5dc8fc38642d1dea4- From:
- Oliver Lowe <o@olowe.co>
- Date:
Only log on test error
No news is good news!
- Commit:
0324b0fdd256bf328e1eab17200b23aa803d0bd5- From:
- Oliver Lowe <o@olowe.co>
- Date:
Just panic on unlikely user test error
We're just testing, so we don't need super robust error handling code.
And if any of those conditions aren't met then we have serious
problems anyway.
- Commit:
46fe962a8b8f10d81d0281a5097886b71c99afda- From:
- Oliver Lowe <o@olowe.co>
- Date:
Revert "Create a new client interface"
This reverts commit bd3b8a33c54037e66233db80fd1120eb0b6215f1.
It's a bad idea. I'm writing a fake server instead so that we can use
the real client code.
- Commit:
bd3b8a33c54037e66233db80fd1120eb0b6215f1- From:
- Oliver Lowe <o@olowe.co>
- Date:
Create a new client interface
So that testing the client doesn't involve making real HTTP requests.
- Commit:
d762d1d1aeb9ddb5a796ccfe1fefa3edea7e242f- From:
- Oliver Lowe <o@olowe.co>
- Date:
Correctly return ErrNoMatch when rescheduling a check
For some reason the API returns an internal server error status rather
than a Not Found status (as in other methods in the API). We can catch
the condition when results are empty and return ErrNoMatch.
- Commit:
46ca0f68f521c66d60a5d6646a0a15350533c9b8- From:
- Oliver Lowe <o@olowe.co>
- Date:
Marshal using struct tags rather than a custom map
I was excluding some struct fields so I thought I'd need to do some custom marshalling .
But you don't need to do this as you can use struct tags to optionally exclude things
from being put into JSON. Now there's no longer duplicate code between struct tags and keys in a map when marshalling. Handy!
- Commit:
f8031e6577708de406336a0d73dcb1bb922238bc- From:
- Oliver Lowe <o@olowe.co>
- Date:
Delete unused testUser var
This was used in some old tests but is now unused.
- Commit:
9ffce56b80990611dbb20ba6c4af4df4f9846140- From:
- Oliver Lowe <o@olowe.co>
- Date:
Properly encode spaces in filter expressions
This is a bit tricky. url.QueryEscape() encodes spaces in queries as
"+", but Icinga2 wants them as "%20".
A test case is included because this was kinda tricky to debug.
- Commit:
64e18a8d1ef9f178f91aed840a371f3785c4d188- From:
- Oliver Lowe <o@olowe.co>
- Date:
Correctly return ErrNoMatch
The check was incorrect before. The HTTP status on responses is still
200 OK, but with empty results if there are no matches to the filter.
- Commit:
562d5c1eb8a76a65d49d14b36edefb846f747494- From:
- Oliver Lowe <o@olowe.co>
- Date:
Store acknowledgement status of hosts, services
- Commit:
1646fdebffc4c9069b824f65f8639120c224f312- From:
- Oliver Lowe <o@olowe.co>
- Date:
Actually return permissions grante to the client
Before we were just returning an empty response or something
non-meaningful
- Commit:
cb9dde9996675a4d56608eab8b57109da8484c29- From:
- Oliver Lowe <o@olowe.co>
- Date:
Let users schedule their own checks
- Commit:
dd1562c064ef82c610805dfd8cdaca5af54f6d22- From:
- Oliver Lowe <o@olowe.co>
- Date:
Always format generated code
While here document what is needed to actually run go generate.
