Commit Graph

1756 Commits

Author SHA1 Message Date
Pierre Souchay 22500f242e Fix unstable tests in agent, api, and command/watch 2018-09-10 16:58:53 +01:00
Pierre Souchay eddcf228ea Implementation of Weights Data structures (#4468)
* Implementation of Weights Data structures

Adding this datastructure will allow us to resolve the
issues #1088 and #4198

This new structure defaults to values:
```
   { Passing: 1, Warning: 0 }
```

Which means, use weight of 0 for a Service in Warning State
while use Weight 1 for a Healthy Service.
Thus it remains compatible with previous Consul versions.

* Implemented weights for DNS SRV Records

* DNS properly support agents with weight support while server does not (backwards compatibility)

* Use Warning value of Weights of 1 by default

When using DNS interface with only_passing = false, all nodes
with non-Critical healthcheck used to have a weight value of 1.
While having weight.Warning = 0 as default value, this is probably
a bad idea as it breaks ascending compatibility.

Thus, we put a default value of 1 to be consistent with existing behaviour.

* Added documentation for new weight field in service description

* Better documentation about weights as suggested by @banks

* Return weight = 1 for unknown Check states as suggested by @banks

* Fixed typo (of -> or) in error message as requested by @mkeeler

* Fixed unstable unit test TestRetryJoin

* Fixed unstable tests

* Fixed wrong Fatalf format in `testrpc/wait.go`

* Added notes regarding DNS SRV lookup limitations regarding number of instances

* Documentation fixes and clarification regarding SRV records with weights as requested by @banks

* Rephrase docs
2018-09-07 15:30:47 +01:00
Pierre Souchay 92acdaa94c Fixed flaky tests (#4626) 2018-09-04 12:31:51 +01:00
Siva Prasad ca35d04472
Adds a new command line flag -log-file for file based logging. (#4581)
* Added log-file flag to capture Consul logs in a user specified file

* Refactored code.

* Refactored code. Added flags to rotate logs based on bytes and duration

* Added the flags for log file and log rotation on the webpage

* Fixed TestSantize from failing due to the addition of 3 flags

* Introduced changes : mutex, data-dir log writes, rotation logic

* Added test for logfile and updated the default log destination for docs

* Log name now uses UnixNano

* TestLogFile is now uses t.Parallel()

* Removed unnecessary int64Val function

* Updated docs to reflect default log name for log-file

* No longer writes to data-dir and adds .log if the filename has no extension
2018-08-29 16:56:58 -04:00
Pierre Souchay 8e7b8bb524 Fixed unit test TestCatalogListServicesCommand (#4592) 2018-08-27 13:53:46 -04:00
Pierre Souchay af90c88f6a Fixed unstable test TestRTTCommand_LAN in command/rtt (#4585) 2018-08-27 11:37:13 -04:00
Pierre Souchay 3f9d1370b7 Fix unstable test TestRegisterMonitor_heartbeat (#4568) 2018-08-24 13:33:58 -04:00
Shubheksha fc3997f266 replace old fork of text package (#4501) 2018-08-14 12:23:18 -07:00
Freddy 6d43d24edb
Improve reliability of tests with TestAgent (#4525)
- Add WaitForTestAgent to tests flaky due to missing serfHealth registration

- Fix bug in retries calling Fatalf with *testing.T

- Convert TestLockCommand_ChildExitCode to table driven test
2018-08-14 12:08:33 -04:00
Freddy e305443db4
Address flakiness in command/exec tests (#4517)
* Add fn to wait for TestAgent node and check registration

* Add waits for TestAgent and retries before timeouts in exec_test
2018-08-10 15:04:07 -04:00
Pierre Souchay cec5d72396 BUGFIX: Unit test relying on WaitForLeader() did not work due to wrong test (#4472)
- Improve resilience of testrpc.WaitForLeader()

- Add additionall retry to CI

- Increase "go test" timeout to 8m

- Add wait for cluster leader to several tests in the agent package

- Add retry to some tests in the api and command packages
2018-08-06 19:46:09 -04:00
Mitchell Hashimoto effb17098a
Merge pull request #4314 from hashicorp/b-ignore-check
command/connect/proxy: ignore check doesn't exist on -register
2018-07-25 11:26:40 -05:00
Mitchell Hashimoto e39dfc919a
command/connect/proxy: ignore check doesn't exist on -register 2018-06-29 10:58:06 -07:00
Siva 5e04d7f1f1 Merge branch 'master' of github.com:hashicorp/consul into WinService 2018-06-26 16:49:50 -04:00
Paul Banks c6ef6a61c9 Refactor to use embedded struct. 2018-06-25 12:25:39 -07:00
Paul Banks 32f362bad9 StartupTelemetry => InitTelemetry 2018-06-25 12:25:39 -07:00
Paul Banks a7038454fd WIP 2018-06-25 12:25:38 -07:00
Paul Banks ecfda7cda5 Fix unreachable code warning from go vet 2018-06-25 12:24:15 -07:00
Paul Banks d1c67d90bc Fixs a few issues that stopped this working in real life but not caught by tests:
- Dev mode assumed no persistence of services although proxy state is persisted which caused proxies to be killed on startup as their services were no longer registered. Fixed.
 - Didn't snapshot the ProxyID which meant that proxies were adopted OK from snapshot but failed to restart if they died since there was no proxyID in the ENV on restart
 - Dev mode with no persistence just kills all proxies on shutdown since it can't recover them later
 - Naming things
2018-06-25 12:24:14 -07:00
Mitchell Hashimoto caae034f3b command/connect/proxy: can specify prepared query upstream types 2018-06-25 12:24:13 -07:00
Paul Banks cdc7cfaa36 Abandon daemonize for simpler solution (preserving history):
Reverts:
  - bdb274852ae469c89092d6050697c0ff97178465
  - 2c689179c4f61c11f0016214c0fc127a0b813bfe
  - d62e25c4a7ab753914b6baccd66f88ffd10949a3
  - c727ffbcc98e3e0bf41e1a7bdd40169bd2d22191
  - 31b4d18933fd0acbe157e28d03ad59c2abf9a1fb
  - 85c3f8df3eabc00f490cd392213c3b928a85aa44
2018-06-25 12:24:10 -07:00
Paul Banks ba0fb58a72 Make daemoinze an option on test binary without hacks. Misc fixes for racey or broken tests. Still failing on several though. 2018-06-25 12:24:09 -07:00
Paul Banks 2b377dc624 Run daemon processes as a detached child.
This turns out to have a lot more subtelty than we accounted for. The test suite is especially prone to races now we can only poll the child and many extra levels of indirectoin are needed to correctly run daemon process without it becoming a Zombie.

I ran this test suite in a loop with parallel enabled to verify for races (-race doesn't find any as they are logical inter-process ones not actual data races). I made it through ~50 runs before hitting an error due to timing which is much better than before. I want to go back and see if we can do better though. Just getting this up.
2018-06-25 12:24:08 -07:00
Siva 319a0ae2bf Graceful exits added 2018-06-20 14:42:08 -04:00
Kyle Havlovitz 61d7e38148
Clarify CA commands' help text 2018-06-14 09:42:23 -07:00
Kyle Havlovitz 6ca7543ea6
Add CA CLI commands for getting/setting config 2018-06-14 09:42:22 -07:00
Mitchell Hashimoto 7d24ecd700
command/connect/proxy: register monitor tests 2018-06-14 09:42:22 -07:00
Mitchell Hashimoto eb2a6952ba
address comment feedback 2018-06-14 09:42:22 -07:00
Mitchell Hashimoto db10240bea
command/connect/proxy: register monitor and -register flag 2018-06-14 09:42:22 -07:00
Mitchell Hashimoto 1db42050bd
command/connect/proxy: output information when starting similar to agent 2018-06-14 09:42:21 -07:00
Mitchell Hashimoto 55c6d34ea0
command/connect/proxy: detailed help 2018-06-14 09:42:21 -07:00
Mitchell Hashimoto b1d709fc9f
command/connect/proxy: -service-addr required for -listen 2018-06-14 09:42:21 -07:00
Mitchell Hashimoto 83f2509c6f
command/connect/proxy: can set public listener from flags 2018-06-14 09:42:21 -07:00
Mitchell Hashimoto c93ba83310
command/connect/proxy: tests for configuration 2018-06-14 09:42:21 -07:00
Mitchell Hashimoto 42ee214c8a
command/connect/proxy: accept -service and -upstream 2018-06-14 09:42:21 -07:00
Mitchell Hashimoto 8c713e6104
connect/proxy: don't require proxy ID 2018-06-14 09:42:20 -07:00
Mitchell Hashimoto a69e3087b2
command/intention: address comment feedback 2018-06-14 09:42:20 -07:00
Mitchell Hashimoto be82b94f81
command/intention/create: -replace does an atomic change 2018-06-14 09:42:20 -07:00
Mitchell Hashimoto 6a82e78cb4
command/intention/match 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto 8ffca97596
command/intention/delete: tests 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto 88639b802c
command/intention/check: check tests 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto 971b3c06a1
command/intention/get: tests 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto 66deffafbb
command/intention/match 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto a083870872
command/intentions/check 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto dba937847f
command/intention/create: -replace flag, jank, we should change to PUT 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto 888dc78180
command/intentions/delete 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto 272211e171
command/intention/get: the get command without tests 2018-06-14 09:42:18 -07:00
Mitchell Hashimoto 988d7d984a
command/intention/finder: package for finding based on src/dst 2018-06-14 09:42:18 -07:00
Mitchell Hashimoto 961e9c1eaf
command/intention/create 2018-06-14 09:42:18 -07:00
Mitchell Hashimoto 5d969e3cbb
command/connect/proxy: set ACL token based on proxy token flag 2018-06-14 09:42:14 -07:00