Commit Graph

127 Commits

Author SHA1 Message Date
Thomas Gelf 1e9e15278a Merge branch 'bugfix/service-set-contraints-13309' 2016-11-30 08:16:47 +01:00
Markus Frosch 9fb94e82c0 Add travis.yml 2016-11-29 10:20:35 +01:00
Markus Frosch 84f39a60ac IcingaServiceSetTest: Add test case
refs #13309
2016-11-28 15:32:41 +01:00
Thomas Gelf d5131f7fac Arguments: always render += instead of =
This allows to extend existing arguments

fixes #12941
2016-11-15 17:57:02 +01:00
Thomas Gelf fee8e7847d IcingaHostTest: fix erroneous test
Code behaves correct now, the test wasn't up to date. However, it wasn't
failing as the object has been changed at runtime while the (at that time
already filled) internal lookup cache wasn't cleared. Woulnd't have had any
effect on real-world environments. However, it's fixed right now.
2016-11-14 13:39:20 +01:00
Markus Frosch 738f6a5c9f Update gitignores 2016-11-07 14:06:43 +01:00
Markus Frosch 10ee7901c8 Add composer support for testing 2016-11-03 10:19:25 +01:00
Thomas Gelf 7e2f8c9430 test/bootstrap: allow fallback to configdir 2016-11-03 03:06:06 +01:00
Thomas Gelf a52e52b517 IcingaHostTest: temporarily skip broken test 2016-11-03 02:54:59 +01:00
Thomas Gelf b996a684be tests: refactor bootstrapping, initial Gitlab-CI..
...support. Currently expects three test-runners offering Debian Jessie,
Ubuntu 16.04 LTS (Xenial) and CentOS 7. Removed all dependencies on the
Icinga Web 2 test module, installing phpunit should suffice to run tests
in a normal environment.

This is a first attempt to make things easier, more to come.
2016-11-03 02:50:39 +01:00
Thomas Gelf 6c23a02252 Test: add test suite prototype and command
refs #12905
2016-11-02 19:30:11 +01:00
Thomas Gelf ad7c5bc997 IcingaHost: fix tests 2016-10-25 00:30:12 +00:00
Thomas Gelf 0d86c24cd8 Huge change, getting rid of legacy assignment...
...code. All objects should work with the new code base right now
2016-10-24 03:41:37 +00:00
Thomas Gelf 9ba6116091 IcingaService: support and test speciall object...
...name variants with apply for
2016-10-22 06:54:53 +00:00
Thomas Gelf 4c9de0fa34 IcingaServiceTest: no need to store when setting...
...a connection
2016-10-22 06:37:22 +00:00
Thomas Gelf 5d693debeb IcingaServiceTest: re-add tests lost on rebase 2016-10-22 06:23:59 +00:00
Corentin Ardeois 3e30d34098 Use `config` variable in apply for rules
* use `config` instead of `value` in apply for rules
* update documentation

refs #11976
2016-10-22 06:07:57 +00:00
Corentin Ardeois e7bd4343b5 Add support for Apply for rules in services
Apply for rules are defined through `apply_for` property
Only Array custom variables will be eligible in apply_for dropdown.

API Example:
```bash
 ./director-curl POST director/service?name=my_service '{"apply_for": "for (checked_tcp_port in host.vars.checked_tcp_ports)" }'
 ```

 Will render as:
 ```
  apply Service "my_service" for (checked_tcp_port in host.vars.checked_tcp_ports) {
      ...
  }
  ```
Feature: https://dev.icinga.org/issues/11976

Depends-On: https://github.com/Icinga/icingaweb2-module-director/pull/20
refs #11976
2016-10-22 06:00:54 +00:00
Thomas Gelf b7eaab715b Make explicit calls to renderStringWithVariables 2016-10-22 05:48:09 +00:00
Corentin Ardeois 37c91050c7 Expressions syntax is now $var$
Instead of $$var$$.
We make sure $$var$$ is left untouched.

refs #11976
2016-10-22 00:15:09 +00:00
Corentin Ardeois ddcfb09f58 Handle expressions only for apply objects
Expressions will be handled only if the object is an ApplyRule.
Only properties and custom variables are replaced.

refs #11976
2016-10-22 00:15:09 +00:00
Corentin Ardeois bcef87f4c9 Add support for expressions
Any rendered string can contain variables encapsulated with "$$" characters.

Example:
Display Name declared with `Port $$host.vars.tcp_port$$ check` will
be processed as `"Port " + host.vars.tcp_port + " check"`

API:
```bash
 ./director-curl POST director/service?name=my_service '{"display_name": "Port $$host.vars.tcp_port$$ check" }'
 ```

 Rendered config:
 ```
  apply Service "my_service" {
      import "my_template"

      display_name = "Port " + host.vars.tcp_port + " check"
  }
 ```

refs #11976
2016-10-22 00:15:09 +00:00
Thomas Gelf c4da25ef25 IcingaCommandArgument: render set_if without format
Icinga DSL support was introduced in 348cb1aa6 and works fine, but breaks
rendering of legacy arguments with set_if_format = NULL. This should default
to 'string', as we should IMO not force NOT NULL in the DB in this case.

refs #12153
fixes #12886
2016-10-11 09:45:11 +00:00
Thomas Gelf 89f86abdda IcingaHostTest: remove obsolete workaround 2016-10-09 13:15:51 +00:00
Thomas Gelf d915bb25f7 CustomVariablesTest: testVarsCanBeUnsetAndSetAgain 2016-09-08 23:13:48 +00:00
Thomas Gelf 8390457939 test/Objects: check for new constant imports 2016-09-08 22:41:58 +00:00
Thomas Gelf 2c6afcbd66 IcingaTimePeriodTest: adjust to recent changes 2016-09-08 15:25:36 +00:00
Thomas Gelf 8a3956b6a2 IcingaServiceTest: delete after storing them 2016-09-08 13:52:07 +00:00
Thomas Gelf 999019ba16 IcingaService: make sure to have a db connection
...when rendering, as we require settings
2016-09-08 13:30:37 +00:00
Thomas Gelf 4f4b6eb63a IcingaService: allow host vars to override vars...
...for applied services

refs #12546
2016-09-08 10:45:02 +00:00
Thomas Gelf 4cd399e059 IcingaConfigHelper: use string-based sort for...
...dictionary fields to make PHP 5.x and PHP 7.x produce the same output.

refs #12591
2016-09-07 20:44:03 +00:00
Thomas Gelf 6427b22621 IcingaConfigHelper: fix numeric dictionary key...
...rendering and add related tests

fixes #12591
2016-08-30 12:15:48 +00:00
Thomas Gelf d142fa1c49 tests: adjust rendered dictionaries to fit...
...latest changes

refs #12447
2016-08-26 07:07:35 +00:00
Thomas Gelf 6258230fdb IcingaArguments: test and fix modification tracking
This fixes related behaviour when working on CLI, API or through
Sync Rules - but not web forms

refs #12266
2016-08-01 09:31:10 +00:00
Thomas Gelf 439757d464 IcingaHost: introduce API keys 2016-07-26 09:52:55 +02:00
Thomas Gelf 4e083d7d40 CustomVariables: use array notation for keys...
...with special characters
2016-07-22 18:09:02 +02:00
Thomas Gelf 15acbb5290 IcingaObject::replaceWith: implement preserve...
...and add related tests, as this is a tricky one
2016-07-14 17:06:48 +02:00
Thomas Gelf 123b4c7549 tests: be resiliant to adjusted master zone 2016-05-26 01:33:55 +02:00
Thomas Gelf 2ae326ab8c IcingaTimePeriod: add and test isActive() method 2016-05-18 21:21:53 +02:00
Thomas Gelf 4222261434 IcingaCommand: fix windows absolute path detection
Also add a couple of new related tests

fixes #11550
2016-05-13 16:01:47 +02:00
Thomas Gelf 1158409eeb IcingaObject: fix rendering target and tests 2016-05-02 10:23:32 +02:00
Thomas Gelf df8926a420 test/php: add new host/service render target checks 2016-04-20 10:20:13 +02:00
Thomas Gelf 41ed29df8c IcingaCommandTest: add new command-related tests 2016-04-02 20:19:19 +02:00
Thomas Gelf 1034ff3867 IcingaServiceTest: new assignment-related tests 2016-03-24 06:44:02 +01:00
Thomas Gelf 89a2f40c81 IcingaCommandTest: add new test 2016-03-21 10:09:57 +01:00
Thomas Gelf 3970f381dd IcingaTimePeriodTest: stricter tests 2016-03-17 23:05:16 +01:00
Thomas Gelf 91ff752fec IcingaNotificationTest: intensively test modify 2016-03-16 21:35:33 +01:00
Thomas Gelf e557ea8f63 IcingaNotificationTest: related empty groups...
...should be returned when returning full plain object
2016-03-16 15:16:35 +01:00
Thomas Gelf ab90f51cfa IcingaNotificationTest: add rendering test 2016-03-16 13:54:09 +01:00
Thomas Gelf f78c858fe7 IcingaNotificationTest: add store & reload check 2016-03-16 13:48:21 +01:00
Thomas Gelf e5605afb41 IcingaNotificationTest: test related objects...
...for notifications
2016-03-16 13:03:24 +01:00
Thomas Gelf 41b909e64e IcingaHostTest: fix delete order for failing test 2016-03-15 20:44:36 +01:00
Thomas Gelf bbd96fd375 IcingaHostTest: more tests 2016-03-08 21:24:42 +01:00
Thomas Gelf 8cb84c7735 IcingaHostTest: skip db-related test with no db 2016-03-08 09:25:43 +01:00
Thomas Gelf fdfedbae04 IcingaConfigHelper: render dictionaries sorted
Adjusted test scenario
2016-03-08 09:24:18 +01:00
Thomas Gelf 407a47a6ec IcingaHostTest: add a couple of tests...
...related to recently added lazy-loading capabilities
2016-03-08 09:20:27 +01:00
Thomas Gelf a80aed49a1 StateFilterTest: a couple of tests for state filters 2016-03-01 04:28:26 +01:00
Thomas Gelf 4b46330855 ExtensibleSet: do not quote values, adjust tests 2016-02-29 18:30:32 +01:00
Thomas Gelf 245e632f54 ExtensibleSet: fix tests 2016-02-29 17:37:01 +01:00
Thomas Gelf cc70193a56 ExtensibleSet: add and test renderer 2016-02-29 12:38:31 +01:00
Thomas Gelf 23dd4721ec ExtensibleSet: basic implementation & tests 2016-02-29 12:23:08 +01:00
Thomas Gelf 11e5ef0362 IcingaConfigHelper: empty intervals are null 2016-02-28 16:27:06 +01:00
Thomas Gelf 4dde0eaaf6 IcingaConfigHelper: Icinga2 doesn't support 2m 30s 2016-02-28 13:55:16 +01:00
Thomas Gelf 255acf2fd5 IcingaConfigHelperTest: add duration format tests 2016-02-28 13:25:49 +01:00
Thomas Gelf f2a1ec91f7 test/php: allow to skip tests with db-dependency 2016-02-26 12:01:00 +01:00
Thomas Gelf 9bed3b7f8a IcingaHostTest: ship rendered objects, compare 2016-02-25 21:46:51 +01:00
Thomas Gelf 75e2511f53 IcingaHostTest: add various persistance tests...
...for custom vars
2016-02-25 20:27:59 +01:00
Thomas Gelf c32fe0a3bb AssignRendererTest: add more test cases 2016-02-25 20:11:39 +01:00
Thomas Gelf 364b902468 IcingaTimePeriodRangesTest: store period, not ranges 2016-02-25 20:04:03 +01:00
Thomas Gelf dd23380363 IcingaTimePeriodRangesTest: rename according class 2016-02-25 19:25:38 +01:00
Thomas Gelf 9417d4881b TimePeriodRangesTest: tests need meaningful names 2016-02-25 19:21:47 +01:00
Thomas Gelf 682c2619d4 IcingaHostTest: add Icinga Host object tests 2016-02-25 19:21:10 +01:00
Thomas Gelf 77804d2b37 BaseTestCase: provide db for our tests 2016-02-25 19:01:48 +01:00
Thomas Gelf f9c694d39d TimePeriodRangesTest: restructure test 2016-02-25 18:56:39 +01:00
Thomas Gelf b31855ac33 TimePeriodRangesTest: moved according to namespace
Started cleanup, still not working
2016-02-25 18:36:42 +01:00
Thomas Gelf c741042108 AssignRendererTest: first new simple test 2016-02-25 18:24:17 +01:00
Alexander Fuhr 9b8c453ff9 Test: Add first insane test for TimePeriodRanges^ 2015-07-01 16:47:44 +02:00