Commit Graph

61 Commits

Author SHA1 Message Date
Matt Keeler a34f8c751e
Pass a testing.T into NewTestAgent and TestAgent.Start (#5342)
This way we can avoid unnecessary panics which cause other tests not to run.

This doesn't remove all the possibilities for panics causing other tests not to run, it just fixes the TestAgent
2019-02-14 10:59:14 -05:00
dawxy f4288baafe Fix data race (#5029)
Fix #4357
2019-01-08 11:43:14 -05:00
Paul Banks 979e1c9c94 Add -sidecar-for and new /agent/service/:service_id endpoint (#4691)
- A new endpoint `/v1/agent/service/:service_id` which is a generic way to look up the service for a single instance. The primary value here is that it:
   - **supports hash-based blocking** and so;
   - **replaces `/agent/connect/proxy/:proxy_id`** as the mechanism the built-in proxy uses to read its config.
   - It's not proxy specific and so works for any service.
   - It has a temporary shim to call through to the existing endpoint to preserve current managed proxy config defaulting behaviour until that is removed entirely (tested).
 - The built-in proxy now uses the new endpoint exclusively for it's config
 - The built-in proxy now has a `-sidecar-for` flag that allows the service ID of the _target_ service to be specified, on the condition that there is exactly one "sidecar" proxy (that is one that has `Proxy.DestinationServiceID` set) for the service registered.
 - Several fixes for edge cases for SidecarService
 - A fix for `Alias` checks - when running locally they didn't update their state until some external thing updated the target. If the target service has no checks registered as below, then the alias never made it past critical.
2018-10-10 16:55:34 +01:00
Pierre Souchay aaaf448e21 Fixed flaky watch tests (#4595) 2018-09-04 12:32:59 +01:00
Pierre Souchay e974ebd62e Fixed flaky tests (#4626) 2018-09-04 12:31:51 +01:00
Paul Banks ba6e909ed7 Misc test fixes 2018-06-25 12:25:39 -07:00
Mitchell Hashimoto b28e2b8622
connect/proxy: don't require proxy ID 2018-06-14 09:42:20 -07:00
Paul Banks 02ab461dae
TLS watching integrated into Service with some basic tests.
There are also a lot of small bug fixes found when testing lots of things end-to-end for the first time and some cleanup now it's integrated with real CA code.
2018-06-14 09:42:07 -07:00
Paul Banks 072b2a79ca
Support legacy watch.HandlerFunc type for backward compat reduces impact of change 2018-06-14 09:42:05 -07:00
Paul Banks eca94dcc92
Working proxy config reload tests 2018-06-14 09:42:05 -07:00
Paul Banks 6f566f750e
Basic `watch` support for connect proxy config and certificate endpoints.
- Includes some bug fixes for previous `api` work and `agent` that weren't tested
 - Needed somewhat pervasive changes to support hash based blocking - some TODOs left in our watch toolchain that will explicitly fail on hash-based watches.
 - Integration into `connect` is partially done here but still WIP
2018-06-14 09:42:05 -07:00
Matt Keeler 4858aa6be4 Add RunWithConfig and put Run signature back to normal 2018-05-31 20:22:14 -04:00
Matt Keeler f300d7bc65 Update unit tests to reflect change to func signature 2018-05-31 17:20:16 -04:00
Matt Keeler 365e8d11ee Allow passing in a config to the watch plan to use when creating the API client
This allows watches from consul agent config (rather than consul watch command) to be able to utilize HTTPs
2018-05-31 17:07:36 -04:00
Guido Iaquinti 244fc72b05 Add package name to log output 2018-03-21 15:56:14 +00:00
Frank Schroeder 4bb5cf425b
watch: make sure invoke channels timeout evenutally 2017-10-24 20:35:36 +02:00
Frank Schroeder c059270394
watch: run tests in parallel 2017-10-24 20:35:36 +02:00
Frank Schroeder cee28aee30
watch: convert TestEventWatch to use channels 2017-10-24 20:35:36 +02:00
Frank Schroeder be1d91966a
watch: convert TestKeyPrefixWatch to use channels 2017-10-24 20:35:36 +02:00
Frank Schroeder f24b06fe97
watch: convert TestKeyWatch_With_PrefixDelete to use channels 2017-10-24 20:35:36 +02:00
Frank Schroeder 8c1dcffdff
watch: convert TestKeyWatch to use channels 2017-10-24 20:35:36 +02:00
Frank Schroeder 899d11f1c9
watch: convert TestChecksWatch_Service to use channels 2017-10-24 20:35:35 +02:00
Frank Schroeder 4677ca436a
watch: convert TestChecksWatch_State to use channels 2017-10-24 20:35:35 +02:00
Frank Schroeder cc51b39eed
watch: convert TestServicesWatch to use channels 2017-10-24 20:35:35 +02:00
Frank Schroeder 7a470d377d
watch: convert TestServiceWatch to use channels 2017-10-24 20:35:35 +02:00
Frank Schroeder 813660507a
watch: convert TestNodesWatch to use channels 2017-10-24 20:35:35 +02:00
Frank Schroeder 8e5662ddd0
watch: use test agent instead of external Consul instance 2017-10-24 11:59:44 +02:00
James Phillips 2e7d048345
Cleans up import sorting. 2017-10-21 20:08:11 -07:00
Hadar Greinsmark 0c5f5e2821 Implement HTTP Watch handler (#3413)
Implement HTTP Watch handler
2017-10-21 20:39:09 -05:00
Preetha Appan f4cccf44e3 Use new DeletePrefixMethod for implementing KVSDeleteTree operation. This makes deletes on sub trees larger than one million nodes about 100 times faster. Added unit tests. 2017-07-25 17:21:18 -05:00
James Phillips f5188dfe8c Expands and rework context support in the API client. (#3273) 2017-07-14 17:30:08 -07:00
Preetha Appan 26d58865ab Make sure to call cancel on the context 2017-06-27 16:22:57 -05:00
Preetha Appan f04c0a7069 Made helper method for query options with context 2017-06-26 16:11:14 -05:00
Preetha Appan 82bf05c888 Fix socket file handle leaks from old blocking queries upon consul reload. This fixes issue #3018 2017-06-26 15:52:03 -05:00
James Phillips 4b85d33ef1 Fixes watch tracking during reloads and fixes address issue. (#3189)
This patch fixes watch registration through the config file and a broken log line when the watch registration fails. It also plumbs all the watch loading through a common function and tweaks the
unit test to create the watch before the reload.
2017-06-24 12:52:41 -07:00
James Phillips d8c21afa35 Merge pull request #2621 from alicebob/devwatch
reset watch's lastIndex on error
2017-06-02 09:06:02 -07:00
Frank Schroeder f50d6871f9 golint: No stutter 2017-04-25 09:26:13 -07:00
Frank Schroeder 9f8f258d4d Remove duplicate constants
This patch removes duplicate internal copies of constants in the structs
package which are also defined in the api package. The api.KVOp type
with all its values for the TXN endpoint and the api.HealthXXX constants
are now used throughout the codebase.

This resulted in some circular dependencies in the testutil package
which have been resolved by copying code and constants and moving the
WaitForLeader function into a separate testrpc package.
2017-04-20 09:54:49 -07:00
James Phillips fa5d3a81cd
Makes watcher test more robust. 2017-04-16 22:15:48 -07:00
Harmen bb41934230 reset the watch index when somehow the index goes backwards 2017-01-17 09:02:53 +01:00
Harmen 10cca4f9ca reset index to 0, not to 1 2017-01-17 09:02:49 +01:00
Harmen 0d550ff4b8 reset watch's lastIndex on error
When a -dev agent is restarted it'll have a clean state, including a
reset index. A watch() will reconnect after a restart, but it won't
notice that the index counter has reset and it will keep waiting until
we reached the old index again, which is wrong. Resetting the index will
prevent that and makes watch work for -dev agents.
2016-12-29 21:58:46 +01:00
James Phillips 9469b30e27
Moves stale code to same spot and adds it everywhere that supports it. 2016-08-10 15:49:51 -07:00
Evan Gilman bf2760ac18
Enable Stale mode for watchers
Solves https://github.com/hashicorp/consul/issues/917 by giving consul
watch a `-stale` flag
2016-05-10 00:09:15 -07:00
Sean Chittenden 65f9017c63 Update Check API to use constants
Use constants where appropriate to advocate their use.  Also add a deprecation notice re: `updateTTL`.
2016-04-23 16:01:59 -07:00
Ryan Uber 5172b21ee8 api: initial import from armon/consul-api 2015-01-06 10:40:00 -08:00
Emil Hessman 0222ed9eb9 Fix missing arguments 2014-11-01 22:56:48 +01:00
Armon Dadgar 175de542bc watch: Adding support for events 2014-08-28 15:41:06 -07:00
Armon Dadgar 4e3ca1a785 watch: Fixing bug with null keys 2014-08-21 17:24:20 -07:00
Armon Dadgar f82a38ab12 agent: First pass at agent-based watches 2014-08-21 13:09:13 -07:00