Commit Graph

1804 Commits

Author SHA1 Message Date
Pierre Souchay e974ebd62e Fixed flaky tests (#4626) 2018-09-04 12:31:51 +01:00
Siva Prasad 59dea9a31f
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 09ff5f7224 Fixed unit test TestCatalogListServicesCommand (#4592) 2018-08-27 13:53:46 -04:00
Pierre Souchay 73824ab65f Fixed unstable test TestRTTCommand_LAN in command/rtt (#4585) 2018-08-27 11:37:13 -04:00
Pierre Souchay 5f603d86ad Fix unstable test TestRegisterMonitor_heartbeat (#4568) 2018-08-24 13:33:58 -04:00
Shubheksha 1afcabb0a2 replace old fork of text package (#4501) 2018-08-14 12:23:18 -07:00
Freddy cbe61dfcec
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 e06cdb5278
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 fd927ea110 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 d0d40a4c34
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 9091f2b108
command/connect/proxy: ignore check doesn't exist on -register 2018-06-29 10:58:06 -07:00
Siva 2182e289a3 Merge branch 'master' of github.com:hashicorp/consul into WinService 2018-06-26 16:49:50 -04:00
Paul Banks ca68136ac7 Refactor to use embedded struct. 2018-06-25 12:25:39 -07:00
Paul Banks 23be6ad1c8 StartupTelemetry => InitTelemetry 2018-06-25 12:25:39 -07:00
Paul Banks 93f346431b WIP 2018-06-25 12:25:38 -07:00
Paul Banks 01594710c6 Fix unreachable code warning from go vet 2018-06-25 12:24:15 -07:00
Paul Banks d140612350 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 692f1ef357 command/connect/proxy: can specify prepared query upstream types 2018-06-25 12:24:13 -07:00
Paul Banks 3bac52480e Abandon daemonize for simpler solution (preserving history):
Reverts:
  - bdb274852ae469c89092d6050697c0ff97178465
  - 2c689179c4f61c11f0016214c0fc127a0b813bfe
  - d62e25c4a7ab753914b6baccd66f88ffd10949a3
  - c727ffbcc98e3e0bf41e1a7bdd40169bd2d22191
  - 31b4d18933fd0acbe157e28d03ad59c2abf9a1fb
  - 85c3f8df3eabc00f490cd392213c3b928a85aa44
2018-06-25 12:24:10 -07:00
Paul Banks e1aca748c4 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 c97db00903 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 e54fbbba51 Graceful exits added 2018-06-20 14:42:08 -04:00
Kyle Havlovitz 33d1d01374
Clarify CA commands' help text 2018-06-14 09:42:23 -07:00
Kyle Havlovitz 96f4ff961c
Add CA CLI commands for getting/setting config 2018-06-14 09:42:22 -07:00
Mitchell Hashimoto 118aa0f00a
command/connect/proxy: register monitor tests 2018-06-14 09:42:22 -07:00
Mitchell Hashimoto 771842255a
address comment feedback 2018-06-14 09:42:22 -07:00
Mitchell Hashimoto 021782c36b
command/connect/proxy: register monitor and -register flag 2018-06-14 09:42:22 -07:00
Mitchell Hashimoto 351a9585e4
command/connect/proxy: output information when starting similar to agent 2018-06-14 09:42:21 -07:00
Mitchell Hashimoto 82ba167757
command/connect/proxy: detailed help 2018-06-14 09:42:21 -07:00
Mitchell Hashimoto 01c3564158
command/connect/proxy: -service-addr required for -listen 2018-06-14 09:42:21 -07:00
Mitchell Hashimoto a750254b28
command/connect/proxy: can set public listener from flags 2018-06-14 09:42:21 -07:00
Mitchell Hashimoto b531919181
command/connect/proxy: tests for configuration 2018-06-14 09:42:21 -07:00
Mitchell Hashimoto 3e8ea58585
command/connect/proxy: accept -service and -upstream 2018-06-14 09:42:21 -07:00
Mitchell Hashimoto b28e2b8622
connect/proxy: don't require proxy ID 2018-06-14 09:42:20 -07:00
Mitchell Hashimoto 1476745bdc
command/intention: address comment feedback 2018-06-14 09:42:20 -07:00
Mitchell Hashimoto 0fe99f4f14
command/intention/create: -replace does an atomic change 2018-06-14 09:42:20 -07:00
Mitchell Hashimoto f03fa81e6a
command/intention/match 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto afbe0c3e6c
command/intention/delete: tests 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto 15ce2643e5
command/intention/check: check tests 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto 8df851c1ea
command/intention/get: tests 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto 50e179c3af
command/intention/match 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto 5ed57b393c
command/intentions/check 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto e055f40612
command/intention/create: -replace flag, jank, we should change to PUT 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto 4caeaaaa21
command/intentions/delete 2018-06-14 09:42:19 -07:00
Mitchell Hashimoto aead9cd422
command/intention/get: the get command without tests 2018-06-14 09:42:18 -07:00
Mitchell Hashimoto 77d0360de1
command/intention/finder: package for finding based on src/dst 2018-06-14 09:42:18 -07:00
Mitchell Hashimoto a1a7eaa876
command/intention/create 2018-06-14 09:42:18 -07:00
Mitchell Hashimoto 4100c9567f
command/connect/proxy: set ACL token based on proxy token flag 2018-06-14 09:42:14 -07:00
Mitchell Hashimoto 9435d8088c
command/connect/proxy: set proxy ID from env var if set 2018-06-14 09:42:14 -07:00
Paul Banks 153808db7c
Don't allow connect watches in agent/cli yet 2018-06-14 09:42:06 -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 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
Paul Banks 51b1bc028d
Rework connect/proxy and command/connect/proxy. End to end demo working again 2018-06-14 09:41:57 -07:00
Paul Banks 800deb693c
Original proxy and connect.Client implementation. Working end to end. 2018-06-14 09:41:56 -07:00
Paul Banks 2973dd6a68
Merge pull request #4194 from hashicorp/fix-kv-del-validation
Fix KV del command validation error
2018-06-05 16:58:14 +01:00
Matt Keeler e043621dd3
Merge pull request #4156 from hashicorp/enterprise-coexistence
Enterprise/Licensing Cleanup
2018-06-05 10:50:32 -04:00
Paul Banks 0b9ff5c2b9
Fix KV del command validation error
This has an explcit unit test already which somehow passes at least some of the time. I suspect it passes because under some conditions the actual KV delete fails and returns non-zero as well as printing the warning which is what is being checked for in the test.

For some reason despite working for quite some time like this, I now have a branch in which this test fails consistently. It may be a timing/env issue where another process running an agent causes the delete to be successful so the command returns a 0 by chance. Either way this is clearly wrong and fixing it stops the test being flaky in my branch.
2018-06-05 13:18:16 +01:00
Kyle Havlovitz 1e47c757c2
command/agent: don't re-parse the flags on reload 2018-05-31 16:59:51 -07:00
Matt Keeler 34c84aabb5 Move data source loading into a command helpers function 2018-05-24 10:34:08 -04:00
Paul Banks 06e1a62653
Merge pull request #4016 from pierresouchay/support_for_prometheus
Support for prometheus for metrics endpoint
2018-04-24 16:14:43 +01:00
Matt Keeler 3026ac4198
Merge pull request #4024 from jen20/signal-notify-once
Only call signal.Notify once during agent startup
2018-04-20 12:37:01 -04:00
Kyle Havlovitz be10300d06
Update make static-assets goal and run format 2018-04-13 09:57:25 -07:00
James Nugent e96b2b8d09 Only call signal.Notify once during agent startup
Calling twice appears to have no adverse effects, however serves to
confuse as to what the semantics of such code may be! This seems like it
was probably introduced while resolving conflicts during the merge of
the fix for #2404.
2018-04-10 20:44:50 -05:00
Pierre Souchay 2e495ec8a6 Now use prometheus_retention_time > 0 to enable prometheus support 2018-04-06 14:21:05 +02:00
Pierre Souchay 583744d8c5 Added support exposing metrics in Prometheus format 2018-04-06 09:18:06 +02:00
Matt Keeler 8a9240ff78 Address PR feedback 2018-04-02 09:23:01 -04:00
Matt Keeler 5ddca9633f Update unit-tests to use requirements instead of manual checks. 2018-03-30 10:55:21 -04:00
Matt Keeler 3cefdd63d7 Update case of member in comment 2018-03-29 15:06:48 -04:00
Matt Keeler 7753fa25f6 Formatting update 2018-03-29 14:35:49 -04:00
Matt Keeler 0bf8adfbe0 GH-3996: Add config-format flag to validate subcommand 2018-03-29 14:30:05 -04:00
Guido Iaquinti 244fc72b05 Add package name to log output 2018-03-21 15:56:14 +00:00
Josh Soref 1dd8c378b9 Spelling (#3958)
* spelling: another

* spelling: autopilot

* spelling: beginning

* spelling: circonus

* spelling: default

* spelling: definition

* spelling: distance

* spelling: encountered

* spelling: enterprise

* spelling: expands

* spelling: exits

* spelling: formatting

* spelling: health

* spelling: hierarchy

* spelling: imposed

* spelling: independence

* spelling: inspect

* spelling: last

* spelling: latest

* spelling: client

* spelling: message

* spelling: minimum

* spelling: notify

* spelling: nonexistent

* spelling: operator

* spelling: payload

* spelling: preceded

* spelling: prepared

* spelling: programmatically

* spelling: required

* spelling: reconcile

* spelling: responses

* spelling: request

* spelling: response

* spelling: results

* spelling: retrieve

* spelling: service

* spelling: significantly

* spelling: specifies

* spelling: supported

* spelling: synchronization

* spelling: synchronous

* spelling: themselves

* spelling: unexpected

* spelling: validations

* spelling: value
2018-03-19 16:56:00 +00:00
Paul Banks 69ebbf3e79
Fixes #3891: agent monitor no longer unresponsive before logs stream.
The root cause is actually that the agent's streaming HTTP API didn't flush until the first log line was found which commonly was pretty soon since the default level is INFO. In cases where there were no logs immediately due to level for instance, the client gets stuck in the HTTP code waiting on a response packet from the server before we enter the loop that checks the shutdown channel from the signal handler.

This fix flushes the initial status immediately on the streaming endpoint which lets the client code get into it's expected state where it's listening for shutdown or log lines.
2018-02-19 21:53:10 +00:00
Kyle Havlovitz 7f3a1c1175
Pull http config flag merge into public method 2018-02-05 15:00:04 -08:00
Veselkov Konstantin 05666113a4 remove golint warnings 2018-01-28 22:40:13 +04:00
Chad Whitacre 923e2c8535 Fix typo 2018-01-05 15:24:44 -05:00
Kyle Havlovitz 6b58df5898
Merge pull request #3737 from hashicorp/autopilot-refactor
Move autopilot to a standalone package
2017-12-15 14:09:40 -08:00
James Phillips 6cfb74d5bd
Adds -base64 support to kv get command.
Fixes #3736
2017-12-14 17:28:04 -08:00
Kyle Havlovitz 8546a1d3c6
Move autopilot to a standalone package 2017-12-11 16:45:33 -08:00
James Phillips 8fb08c7ede
Adds a registry mechanism for CLI commands. 2017-11-29 18:36:52 -08:00
Kyle Havlovitz fb464a8c0d
Fix a panic in snapshot inspect command 2017-10-30 14:51:08 -07:00
Frank Schroeder 1dab004335
Decouple the code that executes checks from the agent 2017-10-25 11:18:07 +02:00
Frank Schroeder a57e5acbf2
agent: fix TestRetryJoin 2017-10-24 20:35:37 +02:00
Frank Schroeder f398fe83b7
agent: fix TestRetryJoinFail 2017-10-24 20:35:37 +02:00
Frank Schroeder 8defdddf31
agent: fix TestRetryJoinWanFail 2017-10-24 20:35:36 +02:00
Frank Schroeder c624c72d5c
config: return error on extra command line arguments (#3397)
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 08:07:48 +02:00
James Phillips 60af465b4e
Updates documentation for consul validate.
This makes it clear that you need to pass the full configuration,
and that the command won't work with config fragments.

Closes #3591
2017-10-19 18:59:05 -07:00
Frank Schroeder 3a5ac6f7cc
commands: add shorter helper vars to keep fmt sane 2017-10-18 02:39:10 +02:00
Frank Schroeder 4f6abf1e72
commands: cleanup init 2017-10-18 02:39:10 +02:00
Frank Schroeder 8f58a603ea commands: get HTTP API flags for usage automatically 2017-10-18 00:08:45 +02:00
Frank Schroeder cb8faa3559 commands: drop http server flags from reload command 2017-10-18 00:08:45 +02:00
Frank Schroeder a00f8721fb commands: drop http server flags from leave command 2017-10-18 00:08:45 +02:00
Frank Schroeder c877b3001b commands: drop http server flags from keyring command 2017-10-18 00:08:45 +02:00
Frank Schroeder 6032fe1407 commands: drop http server flags from force-leave command 2017-10-18 00:08:45 +02:00
Frank Schroeder c10885f828 commands: run all tests in parallel (again) 2017-10-18 00:08:45 +02:00
Frank Schroeder efab66e616 commands: cleanup help and synopsis.
* move Help and Synopsis to bottom
* make help and synopsis constants
* make sure help output is formatted
2017-10-18 00:08:45 +02:00
Frank Schroeder a3a805d7b8 commands: do not run cmd tests in parallel
Package level parallelization is sufficient.
2017-10-18 00:08:45 +02:00
Frank Schroeder a1a1a6971d commands: add missing noTabs test 2017-10-18 00:08:45 +02:00
Frank Schroeder a6d912adb4 commands: cleanup test names 2017-10-18 00:08:45 +02:00
Frank Schroeder 0e059248e7 commands: cleanup catalog list services tests 2017-10-18 00:08:45 +02:00