Frank Schroeder
eb2963345e
watch: convert TestServicesWatch to use channels
2017-10-24 20:35:35 +02:00
Frank Schroeder
ef4e8b5811
watch: convert TestServiceWatch to use channels
2017-10-24 20:35:35 +02:00
Frank Schroeder
375fbcb643
watch: convert TestNodesWatch to use channels
2017-10-24 20:35:35 +02:00
Frank Schroeder
a7c78e637d
watch: use test agent instead of external Consul instance
2017-10-24 11:59:44 +02:00
James Phillips
a3f6e16573
Update CHANGELOG.md
2017-10-23 22:54:37 -07:00
James Phillips
7fdd016bd6
Update CHANGELOG.md
2017-10-23 22:53:29 -07:00
Alex Dadgar
be18f97531
Merge pull request #3609 from hashicorp/f-freeport-testing
...
Make freeport testing friendly
2017-10-23 16:34:27 -07:00
Alex Dadgar
3ac2268c32
format vendor
2017-10-23 16:31:44 -07:00
Alex Dadgar
17dcbb1912
Make freeport testing friendly
...
This PR allows the caller to decide if they would like to have the
calling test fail, have the caller panic on error, or handle the errors
themselves.
2017-10-23 16:28:02 -07:00
James Phillips
9580f75ee9
Update CHANGELOG.md
2017-10-23 08:58:49 -07:00
Frank Schroeder
b8501a999b
Update CHANGELOG.md
2017-10-23 16:44:32 +02:00
Frank Schroeder
0a50f82ead
Update README.md
...
Mention vendorfmt in the `Vendoring` section.
2017-10-23 12:42:00 +02:00
James Phillips
a11c277f75
Changes "ip" to "IP".
2017-10-23 12:34:43 +02:00
Frank Schroeder
c88733d144
Merge pull request #3391 from hashicorp/refactor-local-state-2
...
This patch decouples the local state and the anti-entropy code from the
agent and from each other to have cleaner separation of concerns and to
ensure that data structures are properly locked.
2017-10-23 10:59:55 +02:00
Frank Schroeder
1cb8b0ffe3
local state: fix go vet issue
2017-10-23 10:56:05 +02:00
Frank Schroeder
7335c34c32
local state: remove stale comment
2017-10-23 10:56:05 +02:00
Frank Schroeder
3d547e30c7
local state: make test more robust
2017-10-23 10:56:05 +02:00
Frank Schroeder
52e73301f6
local state: clone check to avoid side effect
2017-10-23 10:56:05 +02:00
Frank Schroeder
6bc9d66192
local state: use synchronized access to internal maps
2017-10-23 10:56:05 +02:00
Frank Schroeder
cc0499da3d
ae: do not trigger on Resume while holding the lock
2017-10-23 10:56:05 +02:00
Frank Schroeder
92f136de12
ae: add remaining test cases
2017-10-23 10:56:05 +02:00
Frank Schroeder
622ace2829
ae: refactor StateSyncer to state machine for better testing
2017-10-23 10:56:05 +02:00
Frank Schroeder
1212598ae2
ae: add test that we run a full before a partial sync
2017-10-23 10:56:05 +02:00
Frank Schroeder
4431e222fe
ae: make control flow more explicit
2017-10-23 10:56:05 +02:00
Frank Schroeder
3231385089
ae: fix typo in constructor name
2017-10-23 10:56:05 +02:00
Frank Schroeder
51daa96dfe
ae: add test for resume triggering SyncChanges
2017-10-23 10:56:05 +02:00
Frank Schroeder
92088d21e8
ae: add test for ifNotPausedRun
2017-10-23 10:56:05 +02:00
Frank Schroeder
11e172d1e9
ae: make stagger function pluggable for testing
2017-10-23 10:56:05 +02:00
Frank Schroeder
e2452efed8
ae: restore previous pause/resume behavior
2017-10-23 10:56:04 +02:00
Frank Schroeder
aba072bd1d
ae: ensure that syncs are blocked when paused
2017-10-23 10:56:04 +02:00
Frank Schroeder
58d52ac580
local state: rename Add{Check,Service}State to Set{Check,Service}State
2017-10-23 10:56:04 +02:00
Frank Schroeder
e144f51b29
local state: move Metadata methods together
2017-10-23 10:56:04 +02:00
Frank Schroeder
4f9e05f634
local state: update documentation of updateSyncState
2017-10-23 10:56:04 +02:00
Frank Schroeder
41c7b0927e
local state: update comments
2017-10-23 10:56:04 +02:00
Frank Schroeder
de57b16d99
local state: address review comments
...
* move non-blocking notification mechanism into ae.Trigger
* move Pause/Resume into separate type
2017-10-23 10:56:04 +02:00
Frank Schroeder
5c77c59501
local state: refactor TestAgentAntiEntropy_EnableTagOverride
...
Make intent clearer by being more explicit and adding some comments.
Use verify.Values to compare service entries.
2017-10-23 10:56:04 +02:00
Frank Schroeder
524981f367
local state: fix TestAgentAntiEntropy_EnableTagOverride
...
The test had a race condition where it relied on the first service to be
synced to the remote catalog which sometimes failed.
2017-10-23 10:56:04 +02:00
Frank Schroeder
1181aaee6a
local state: rename tests
2017-10-23 10:56:04 +02:00
Frank Schroeder
1602ac56b5
local state: drop retry loops from tests
...
Since the tests are now using synchronous calls for state syncing
we no longer need to use retry loops to wait for the changes to
propagate.
2017-10-23 10:56:04 +02:00
Frank Schroeder
7e3adc4549
agent: skip non-sensical TestCatalogRegister
...
It is not clear what this test is supposed to verify.
2017-10-23 10:56:04 +02:00
Frank Schroeder
71c74e62c7
local state: fix anti-entropy state tests
...
The anti-entropy tests relied on the side-effect of the StartSync()
method to perform a full sync instead of a partial sync. This lead to
multiple anti-entropy go routines being started unnecessary retry loops.
This change changes the behavior to perform synchronous full syncs when
necessary removing the need for all of the time.Sleep and most of the
retry loops.
2017-10-23 10:56:04 +02:00
Frank Schroeder
37b95ef98e
local state: fix test with updated error message
2017-10-23 10:56:04 +02:00
Frank Schroeder
d2cc0e6e8a
local state: fix failing tests
2017-10-23 10:56:03 +02:00
Frank Schroeder
b803bf3091
local state: tests compile
2017-10-23 10:56:03 +02:00
Frank Schroeder
0a9ac9749e
local state: replace multi-map state with structs
...
The state of the service and health check records was spread out over
multiple maps guarded by a single lock. Access to the maps has to happen
in a coordinated effort and the tests often violated this which made
them brittle and racy.
This patch replaces the multiple maps with a single one for both checks
and services to make the code less fragile.
This is also necessary since moving the local state into its own package
creates circular dependencies for the tests. To avoid this the tests can
no longer access internal data structures which they should not be doing
in the first place.
The tests still don't compile but this is a ncessary step in that
direction.
2017-10-23 10:56:03 +02:00
Frank Schroeder
6027a9e2a5
local state: move to separate package
...
This patch moves the local state to a separate package to further
decouple it from the agent code.
The code compiles but the tests do not yet.
2017-10-23 10:56:03 +02:00
Frank Schroeder
c00bbdb5e4
agent: simplify some loops
2017-10-23 10:56:03 +02:00
Frank Schroeder
cbaf97bced
agent: refactor sync loop to linear flow of control
2017-10-23 10:56:03 +02:00
Frank Schroeder
94ef1041a1
agent: cleanup StateSyncer
...
This patch cleans up the state syncer code by renaming fields, adding
helpers and documentation.
2017-10-23 10:56:03 +02:00
Frank Schroeder
29e18c7494
agent: decouple anti-entropy from local state
...
The anti-entropy code manages background synchronizations of the local
state on a regular basis or on demand when either the state has changed
or a new consul server has been added.
This patch moves the anti-entropy code into its own package and
decouples it from the local state code since they are performing
two different functions.
To simplify code-review this revision does not make any optimizations,
renames or refactorings. This will happen in subsequent commits.
2017-10-23 10:56:03 +02:00