Commits


Keep test data in version control While here also don't log messages in testing unless there's an error.


Catch all HostStates and ServiceStates This is closer to the Icinga spec, anything greater than 2 or 3 is unknown.


Only log on test error No news is good news!


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.


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.


Create a new client interface So that testing the client doesn't involve making real HTTP requests.


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.


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!


Delete unused testUser var This was used in some old tests but is now unused.


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.


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.


Store acknowledgement status of hosts, services


Actually return permissions grante to the client Before we were just returning an empty response or something non-meaningful


Let users schedule their own checks


Always format generated code While here document what is needed to actually run go generate.


Handle last check result of services Includes a test to know that we're handling the JSON properly.


Implement checker interface for HostGroup This also adds a test for checking all hosts in a HostGroup.


Correctly marshal Hosts into JSON We were missing some attributes, like not adding any groups or display names. This also adds a test which checks whether we are marshalling hosts into JSON correctly.


Document checker Check() methods


Support cascading delete of objects


Store host state type


Add checking of services and hosts And also add a icinga_test package that does the black-box tests i.e. tests which speak to a real icinga server.


Set accurate crud.go header comment getopt(1) clears the value of "$@", so grab it before it's cleared


deduplicate new test client code This adds a newTestClient option so that we aren't constantly creating new http transports clients and all that


Support Icinga2 hostgroups Tests of hostgroup operations are done in TestFilter