Commit Graph

423 Commits

Author SHA1 Message Date
Frank Schroeder da604495a0
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 c39bc770b3
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 e1358a541d
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 b3195006b1
local state: rename tests 2017-10-23 10:56:04 +02:00
Frank Schroeder d9a4b440a8
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 462de8b2cb
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 32c2d1b217
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 6b966e48ce
local state: fix test with updated error message 2017-10-23 10:56:04 +02:00
Frank Schroeder 632c43e575
local state: fix failing tests 2017-10-23 10:56:03 +02:00
Frank Schroeder ea92ee308a
local state: tests compile 2017-10-23 10:56:03 +02:00
Frank Schroeder 7289576988
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 bc7571cccf
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 b363586813
agent: simplify some loops 2017-10-23 10:56:03 +02:00
Frank Schroeder 218cd4d501
agent: refactor sync loop to linear flow of control 2017-10-23 10:56:03 +02:00
Frank Schroeder 8cc4ee886d
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 e7051da8d1
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
Frank Schroeder c2a3f5e007
Merge pull request #3585 from hashicorp/document-runtime-config
Moving the previous `agent/config.go` documentation to
`agent/config/runtime.go`.
2017-10-23 10:51:22 +02:00
Frank Schroeder f3ecef290c
Merge pull request #3598 from hashicorp/issue-3397-error-with-extra-flags
The `consul agent` command was ignoring extra command line arguments
which can lead to confusion when the user has for example forgotten to
add a dash in front of an argument or is not using an `=` when setting
boolean flags to `true`. `-bootstrap true` is not the same as
`-bootstrap=true`, for example.

Since all command line flags are known and we don't expect unparsed
arguments we can return an error. However, this may make it slightly
more difficult in the future if we ever wanted to have these kinds of
arguments.

Fixes #3397
2017-10-23 10:47:04 +02:00
Frank Schroeder 6517d7720a
Merge pull request #3600 from hashicorp/support-go-sockaddr-for-dns-recursors
DNS recursors can be added through go-sockaddr templates. Entries
are deduplicated while the order is maintained.

Originally proposed by @taylorchu

See #2932
2017-10-23 10:45:36 +02:00
Frank Schroeder 0ec82b0445
Revert "config: add support for go-sockaddr templates for DNS recursors"
This reverts commit 72bee6284d44e0ed3e18e6819188f1d32528478c.
2017-10-23 10:08:35 +02:00
Frank Schroeder 39d1ceffb5
Revert "config: do not allow an ANY address as DNS recursor"
This reverts commit 1db8d3cb00bec980480d525571cea76c6c49c3e7.
2017-10-23 10:08:35 +02:00
Frank Schroeder 759350b61f
Revert "agent: decouple anti-entropy from local state"
This reverts commit a842dc9c2bf00855ef93211232da36b2d91eab5b.
2017-10-23 10:08:35 +02:00
Frank Schroeder 0d0233acd7
Revert "agent: cleanup StateSyncer"
This reverts commit b7136e100bef727144c202ae55f81152ac6a8b5f.
2017-10-23 10:08:35 +02:00
Frank Schroeder 113ba546e7
Revert "agent: refactor sync loop to linear flow of control"
This reverts commit 7a2af206ea964fc0846f9b80c10ea9d91cb3c99e.
2017-10-23 10:08:35 +02:00
Frank Schroeder a96798f441
Revert "agent: simplify some loops"
This reverts commit b5dbad910c63b29dadf10731808d6891067a2bfa.
2017-10-23 10:08:34 +02:00
Frank Schroeder 443fe8e4db
Revert "local state: move to separate package"
This reverts commit d447e823c63720c74bb02459a985724f035f023e.
2017-10-23 10:08:34 +02:00
Frank Schroeder 435b442c8b
Revert "local state: replace multi-map state with structs"
This reverts commit ccbae7da5bceeb2328ab7993a8badbf2e72a4597.
2017-10-23 10:08:34 +02:00
Frank Schroeder 138aa25280
Revert "local state: tests compile"
This reverts commit 1af52bf7be02d952e16e14209899a9715451f7ba.
2017-10-23 10:08:34 +02:00
Frank Schroeder 571637cf7d
Revert "local state: fix failing tests"
This reverts commit 76682da4a048b623a1c201eb56710639437a9ed9.
2017-10-23 10:08:34 +02:00
Frank Schroeder 80d9df69e4
Revert "local state: fix test with updated error message"
This reverts commit e9149f64d9afb38246f9432edd806321c1eefb83.
2017-10-23 10:08:34 +02:00
Frank Schroeder ded6f79b6a
Revert "local state: fix anti-entropy state tests"
This reverts commit f8e20cd9960e19bbe61e258c445250723870816f.
2017-10-23 10:08:34 +02:00
Frank Schroeder 9b40a3cde6
Revert "agent: skip non-sensical TestCatalogRegister"
This reverts commit ce1f35373e6ad1486cb83398fce70f5c54f910d3.
2017-10-23 10:08:34 +02:00
Frank Schroeder 5aa77fb9e4
Revert "local state: drop retry loops from tests"
This reverts commit 2bdba8ab06d1c9dd99d5e7cf8370c94b4f7adfaa.
2017-10-23 10:08:34 +02:00
Frank Schroeder d7bb81a940
Revert "local state: rename tests"
This reverts commit ff62eaf0634a4c09377c53d4623685437f217b49.
2017-10-23 10:08:34 +02:00
Frank Schroeder 3d67ce9000
Revert "local state: fix TestAgentAntiEntropy_EnableTagOverride"
This reverts commit 86f7ea601342d6f3ceb9d0dc74bd5b33dae0b8d8.
2017-10-23 10:08:34 +02:00
Frank Schroeder 1bd73d2a6e
Revert "local state: refactor TestAgentAntiEntropy_EnableTagOverride"
This reverts commit c28e23eac8ada7a668b13e9a4a3d8066457488ef.
2017-10-23 10:08:33 +02:00
Frank Schroeder c72d21813b
Revert "local state: address review comments"
This reverts commit 1d315075b15647db7fcd42986c9c5673cbb77a77.
2017-10-23 10:08:33 +02:00
Frank Schroeder 4177bad4f3
Revert "local state: update comments"
This reverts commit 42188164f885188e3bc8cff70ea5aeb47d633b83.
2017-10-23 10:08:33 +02:00
Frank Schroeder d1e514cedc
Revert "local state: update documentation of updateSyncState"
This reverts commit e86521e637d742bce1e460b6b960037cef3578ed.
2017-10-23 10:08:33 +02:00
Frank Schroeder 133b23fb77
Revert "local state: move Metadata methods together"
This reverts commit 9bc8127728a62beb94b28849070b6ac35c181404.
2017-10-23 10:08:33 +02:00
Frank Schroeder 67135cc33e
Revert "local state: rename Add{Check,Service}State to Set{Check,Service}State"
This reverts commit 9280841a80d98b253a8f23967875e45e5e37e093.
2017-10-23 10:08:33 +02:00
Frank Schroeder 79405b7ce3
Revert "ae: ensure that syncs are blocked when paused"
This reverts commit ffb265dd939cefd7e865d624d0a4ba81f88e4505.
2017-10-23 10:08:33 +02:00
Frank Schroeder cb28151210
Revert "ae: restore previous pause/resume behavior"
This reverts commit 126046be2366afde97fdf01d0dceece2977dd6d6.
2017-10-23 10:08:33 +02:00
Frank Schroeder ec186ca7ba
Revert "ae: make stagger function pluggable for testing"
This reverts commit 066ad01c3804a39161c4d46147aa2eb86e48cd67.
2017-10-23 10:08:33 +02:00
Frank Schroeder 272b729ad9
Revert "ae: add test for ifNotPausedRun"
This reverts commit f5177ef332b8396aea368b7dea18a976e029a54f.
2017-10-23 10:08:33 +02:00
Frank Schroeder 54cebeda74
Revert "ae: add test for resume triggering SyncChanges"
This reverts commit cd0262744deab9294af17e4039ed2e2a27818cde.
2017-10-23 10:08:32 +02:00
Frank Schroeder 7a92839663
Revert "ae: fix typo in constructor name"
This reverts commit e88f49e2ccc79f77b5395de28d8fbdfc6eeb36f6.
2017-10-23 10:08:32 +02:00
Frank Schroeder 4bdf161d5c
Revert "ae: make control flow more explicit"
This reverts commit b9a8b53d5257d679c427422c324e6f124664db60.
2017-10-23 10:08:32 +02:00
Frank Schroeder 6eae18ac63
Revert "ae: add test that we run a full before a partial sync"
This reverts commit 8158cec82969a1262de793ee46e13f63cc2954e6.
2017-10-23 10:08:32 +02:00
Frank Schroeder 701ed61230
Revert "ae: refactor StateSyncer to state machine for better testing"
This reverts commit 8a45365f68147dd13c1232bc574bd54e4a12e478.
2017-10-23 10:08:32 +02:00