While there are still hardcoded defaults, this change allows people to
specify custom credentials via environment variables for each shield
role in our tests.
These changes will make sure the kibana server in tests is using shield
credentials, as are any requests made through the kbn_server test
helper.
The current credentials are hardcoded based on our internal best
practices, but they should be made configurable in the future.
This will pass credentials to ES regardless of whether shield is
actually enabled, but that will have no negative effect if shield
happens to be disabled.
The new kbn_server test utility allows us to setup KbnServer instances
with consistent defaults and make requests through a common test-only
interface. These abstractions allow us to configure global behaviors
such as shield authorization for all of our tests rather than
re-implementing it in every test.
Starting in lodash 3.0 _() chains are lazily evaluated and therefor usage of the pattern had to be checked for side effects. Where it made more sense to just use Array methods, the code was updated. In other places the code was already calling .value() on the chain, so no changes were needed. Finally, there were places where the chain was not designed to produce a value, but to modify a value that was already in scope (like this/self), in those senarios .commit() was added to force evaluation of the chain.
A circular dependency was discovered in the Doc AppController tests, because it was stubbing
$route and required the IndexPattern class. The dependency path was something like:
$route -> IndexPattern -> Field -> kbnUrl -> $route
While investigating solutions for this I noticed two things: we require kbnUrl both
in the object classes where urls are precomputed and in the controllers/directives
where we redirect/change the url, we needed error-prone logic to recompute the urls
when their dependencies change.
To simplify things and solve the circular dep, the indexPattern and field objects now just
expose a .routes property that has named route patterns. These patterns expect to receive
the object they describe in order to create the route. kbnUrl was also updated with helper
functions for this:
```
kbnUrl.getRouteUrl(indexPattern, 'edit') -> '#/settings/indices/logstash-*'
kbnUrl.redirectToRoute(indexPattern, 'indexedFields')
kbnUrl.changeToRoute(field, 'edit')
```