consul/agent
Pierre Souchay ef3b81ab13 Allow to rename nodes with IDs, will fix #3974 and #4413 (#4415)
* Allow to rename nodes with IDs, will fix #3974 and #4413

This change allow to rename any well behaving recent agent with an
ID to be renamed safely, ie: without taking the name of another one
with case insensitive comparison.

Deprecated behaviour warning
----------------------------

Due to asceding compatibility, it is still possible however to
"take" the name of another name by not providing any ID.

Note that when not providing any ID, it is possible to have 2 nodes
having similar names with case differences, ie: myNode and mynode
which might lead to DB corruption on Consul server side and
lead to server not properly restarting.

See #3983 and #4399 for Context about this change.

Disabling registration of nodes without IDs as specified in #4414
should probably be the way to go eventually.

* Removed the case-insensitive search when adding a node within the else
block since it breaks the test TestAgentAntiEntropy_Services

While the else case is probably legit, it will be fixed with #4414 in
a later release.

* Added again the test in the else to avoid duplicated names, but
enforce this test only for nodes having IDs.

Thus most tests without any ID will work, and allows us fixing

* Added more tests regarding request with/without IDs.

`TestStateStore_EnsureNode` now test registration and renaming with IDs

`TestStateStore_EnsureNodeDeprecated` tests registration without IDs
and tests removing an ID from a node as well as updated a node
without its ID (deprecated behaviour kept for backwards compatibility)

* Do not allow renaming in case of conflict, including when other node has no ID

* Fixed function GetNodeID that was not working due to wrong type when searching node from its ID

Thus, all tests about renaming were not working properly.

Added the full test cas that allowed me to detect it.

* Better error messages, more tests when nodeID is not a valid UUID in GetNodeID()

* Added separate TestStateStore_GetNodeID to test GetNodeID.

More complete test coverage for GetNodeID

* Added new unit test `TestStateStore_ensureNoNodeWithSimilarNameTxn`

Also fixed comments to be clearer after remarks from @banks

* Fixed error message in unit test to match test case

* Use uuid.ParseUUID to parse Node.ID as requested by @mkeeler
2018-08-10 11:30:45 -04:00
..
ae
cache Fixes #4421: General solution to stop blocking queries with index 0 (#4437) 2018-07-25 20:26:27 +01:00
cache-types Fixes #4421: General solution to stop blocking queries with index 0 (#4437) 2018-07-25 20:26:27 +01:00
checks agent/checks: prevent overflow of backoff 2018-07-12 10:21:49 -07:00
config Gossip tuneables (#4444) 2018-07-26 11:39:49 -04:00
connect Revert "CA initialization while boostrapping and TestLeader_ChangeServerID fix." (#4497) 2018-08-07 08:29:48 -04:00
consul Allow to rename nodes with IDs, will fix #3974 and #4413 (#4415) 2018-08-10 11:30:45 -04:00
exec
local BUGFIX: Unit test relying on WaitForLeader() did not work due to wrong test (#4472) 2018-08-06 19:46:09 -04:00
metadata
mock
pool
proxy BUGFIX: Unit test relying on WaitForLeader() did not work due to wrong test (#4472) 2018-08-06 19:46:09 -04:00
router
structs Merge pull request #4400 from hashicorp/leaf-cert-ttl 2018-07-25 17:53:25 -07:00
systemd
token
acl.go Updated swith case to use same branch for async-cache and extend-cache 2018-07-02 17:39:34 +02:00
acl_endpoint.go
acl_endpoint_test.go BUGFIX: Unit test relying on WaitForLeader() did not work due to wrong test (#4472) 2018-08-06 19:46:09 -04:00
acl_test.go BUGFIX: Unit test relying on WaitForLeader() did not work due to wrong test (#4472) 2018-08-06 19:46:09 -04:00
agent.go Gossip tuneables (#4444) 2018-07-26 11:39:49 -04:00
agent_endpoint.go Handle resolving proxy tokens when parsing HTTP requests (#4453) 2018-07-30 09:11:51 -04:00
agent_endpoint_test.go BUGFIX: Unit test relying on WaitForLeader() did not work due to wrong test (#4472) 2018-08-06 19:46:09 -04:00
agent_test.go PR to fix TestAgent_IndexChurn and TestPreparedQuery_Wrapper. (#4512) 2018-08-09 12:40:07 -04:00
bindata_assetfs.go Release v1.2.2 2018-07-30 16:01:13 +00:00
blacklist.go
blacklist_test.go
catalog_endpoint.go
catalog_endpoint_test.go BUGFIX: Unit test relying on WaitForLeader() did not work due to wrong test (#4472) 2018-08-06 19:46:09 -04:00
check.go
config.go
connect_ca_endpoint.go revert go changes to hide rotation config 2018-06-25 12:26:18 -07:00
connect_ca_endpoint_test.go Merge pull request #4400 from hashicorp/leaf-cert-ttl 2018-07-25 17:53:25 -07:00
coordinate_endpoint.go
coordinate_endpoint_test.go
dns.go DNS : Fixes recursors answering the DNS query to properly return the correct response. (#4461) 2018-08-02 10:12:52 -04:00
dns_test.go BUGFIX: Unit test relying on WaitForLeader() did not work due to wrong test (#4472) 2018-08-06 19:46:09 -04:00
enterprise_delegate_oss.go
event_endpoint.go Fixes memory leak when blocking on /event/list (#4482) 2018-08-02 14:54:48 +01:00
event_endpoint_test.go
health_endpoint.go
health_endpoint_test.go BUGFIX: Unit test relying on WaitForLeader() did not work due to wrong test (#4472) 2018-08-06 19:46:09 -04:00
http.go Handle resolving proxy tokens when parsing HTTP requests (#4453) 2018-07-30 09:11:51 -04:00
http_oss.go agent: rename test to check 2018-06-14 09:42:18 -07:00
http_oss_test.go
http_test.go Handle resolving proxy tokens when parsing HTTP requests (#4453) 2018-07-30 09:11:51 -04:00
intentions_endpoint.go agent: 400 error on invalid UUID format, api handles errors properly 2018-06-27 07:40:06 +02:00
intentions_endpoint_test.go agent: 400 error on invalid UUID format, api handles errors properly 2018-06-27 07:40:06 +02:00
keyring.go
keyring_test.go
kvs_endpoint.go
kvs_endpoint_test.go
notify.go Fixes memory leak when blocking on /event/list (#4482) 2018-08-02 14:54:48 +01:00
notify_test.go Fixes memory leak when blocking on /event/list (#4482) 2018-08-02 14:54:48 +01:00
operator_endpoint.go
operator_endpoint_test.go
prepared_query_endpoint.go agent: accept connect param for execute 2018-06-25 12:24:12 -07:00
prepared_query_endpoint_test.go agent: accept connect param for execute 2018-06-25 12:24:12 -07:00
remote_exec.go
remote_exec_test.go BUGFIX: Unit test relying on WaitForLeader() did not work due to wrong test (#4472) 2018-08-06 19:46:09 -04:00
retry_join.go
retry_join_test.go Vendoring update for go-discover. (#4412) 2018-07-25 16:21:04 -07:00
session_endpoint.go
session_endpoint_test.go BUGFIX: Unit test relying on WaitForLeader() did not work due to wrong test (#4472) 2018-08-06 19:46:09 -04:00
snapshot_endpoint.go
snapshot_endpoint_test.go
status_endpoint.go
status_endpoint_test.go
testagent.go Disable TestAgent proxy execution properly 2018-06-25 12:25:38 -07:00
testagent_test.go
translate_addr.go
txn_endpoint.go
txn_endpoint_test.go
ui_endpoint.go Output the service Kind in the /v1/internal/ui/services endpoint 2018-06-25 12:25:40 -07:00
ui_endpoint_test.go Output the service Kind in the /v1/internal/ui/services endpoint 2018-06-25 12:25:40 -07:00
user_event.go
user_event_test.go
util.go
util_test.go
watch_handler.go
watch_handler_test.go