Commit Graph

78 Commits

Author SHA1 Message Date
Frank Schroeder 9956bc9b47 agent: LastContact cannot be negative (#3067)
The X-Consul-LastContact header cannot be negative.

Fixes #3067
2017-06-01 18:20:12 +02:00
Frank Schroeder 141efd9588
test: rename *Config vars to 'cfg'
'c' is ambigous since Command also uses this
and we want to use 'config' as a package name.
2017-05-31 00:29:24 +02:00
Frank Schroeder 0c905a0df8
test: a.config -> a.Config 2017-05-31 00:29:23 +02:00
Frank Schroeder 0be63d7060
test: refactor httpTest with TestAgent 2017-05-31 00:29:23 +02:00
Frank Schroeder 308f9929b3
test: run agent tests in parallel
This brings down the test run from 108 sec to 15 sec.

There is an occasional port conflict because of the nature
the next port is chosen. So far it seems rare enough to live
with it.
2017-05-31 00:29:23 +02:00
Frank Schroeder 23a6ff383c
agent: refactor tests for TestAgent
Refactored tests that use

 * makeAgentXXX
 * makeDNSServerXXX
 * makeHTTPServerXXX
2017-05-31 00:29:23 +02:00
Frank Schroeder 82650f73e3
agent: move http/dns endpoints into agent
Move the HTTP and DNS endpoints into the agent and control
their lifespan via the agent.

This removes the requirement to manage HTTP and DNS servers
indpendent of the agent since the agent is mostly useless
without an endpoint and the endpoints without the agent.
2017-05-31 00:29:23 +02:00
Frank Schroeder b42916e1ff
agent: simplify socket address helper 2017-05-31 00:29:22 +02:00
Frank Schroeder 8f381d62f6
agent: drop logOutput parameter
agent.logOutput is identical to logOutput
2017-05-31 00:29:22 +02:00
Frank Schroeder c47db2c922
agent: drop config argument
agent.config and config are identical.
2017-05-31 00:29:22 +02:00
Frank Schroeder 65b5c51ec7 test: add helper for ioutil.TempDir/TempFile
This creates a simplified helper for temporary directories and files.
All path names are prefixed with the name of the current test.
All files and directories are stored either in /tmp/consul-test
or /tmp if the former could not be created.

Using the system temp dir breaks some tests on macOS where the unix
socket path becomes too long.
2017-05-12 22:12:47 +02:00
Frank Schroeder 3522a41bad test: include test name in temp file/dir
This helps identifying hanging tests by looking
at the process list.
2017-05-12 22:12:47 +02:00
Frank Schroeder 6eba69fbfe agent: drop atlas/scada code 2017-05-10 23:06:36 +02:00
Frank Schroeder d711b9bba0 test: inline request body encoding 2017-05-10 17:42:38 +02:00
Frank Schroeder 82cb9c50ad test: add helper for permission denied check 2017-05-10 17:42:38 +02:00
Frank Schroeder 1e89692cc1 test: drop error check on http.NewRequest
Most URLs are static so the error check is redundant.
The subsequent test wouldn't work if the url is wrong.
2017-05-10 17:42:38 +02:00
Frank Schroeder 48fa2962eb Revert "test: Run command/agent tests in parallel"
This reverts commit 17be40a733.
2017-04-27 14:39:04 -07:00
Frank Schroeder 17be40a733 test: Run command/agent tests in parallel 2017-04-27 10:34:30 -07:00
Frank Schroeder cf3ec1cf5c golint: Rename fields and structs 2017-04-25 09:26:13 -07:00
Frank Schroeder 5a3961f31f golint: Replace a += 1 with a++ 2017-04-25 09:26:13 -07:00
Frank Schroeder eddb1af603 Remove duplicate constants
This patch removes duplicate internal copies of constants in the structs
package which are also defined in the api package. The api.KVOp type
with all its values for the TXN endpoint and the api.HealthXXX constants
are now used throughout the codebase.

This resulted in some circular dependencies in the testutil package
which have been resolved by copying code and constants and moving the
WaitForLeader function into a separate testrpc package.
2017-04-20 09:54:49 -07:00
Jeff Mitchell 73035f9ef8 Update TestHTTPServer_UnixSocket with DialContext 2017-02-10 21:29:42 -05:00
James Phillips 4ffd824547
Adds a leader wait when testing with ACLs. 2016-12-14 16:18:17 -08:00
James Phillips 01b6766099
Adds complete ACL support for agent utility endpoints. 2016-12-14 11:12:55 -08:00
Kyle Havlovitz 338e36cc5d Add logWriter to agent Create() method 2016-11-28 18:36:26 -05:00
Kyle Havlovitz 124f907063 Add monitor http endpoint 2016-11-28 18:36:26 -05:00
James Phillips 9f7a973ace
Adds an `X-Consul-Translate-Addresses` to signal translation is enabled. 2016-08-16 11:31:41 -07:00
James Phillips 0f5aabcbbd Merge pull request #2028 from hashicorp/f-atomic-kv
Adds support for atomic transactions spanning multiple KV entries.
2016-05-15 13:46:05 -07:00
Sean Chittenden 92298e3d02
Speling police 2016-05-15 09:13:52 -07:00
James Phillips 1fefdcb962 Terminates pretty responses with a newline. 2016-05-10 20:02:36 -07:00
Chavez 416c578f7a Retry http server connecting in agent/http_test 2016-04-01 19:17:38 -07:00
Ryan Uber 3cf6a173a5 agent: static UI is configurable 2015-12-24 22:21:34 -05:00
Ryan Uber 2d7ced22b3 agent: initial web assets 2015-12-24 22:21:34 -05:00
James Phillips 088603949c Runs go fmt (sorts new go-cleanhttp imports). 2015-10-23 17:14:35 -07:00
James Phillips 9c9195746f Changes ?near=self to a safer ?near=_agent, which is also clearer about what it does. 2015-10-23 15:23:01 -07:00
James Phillips e47eea3f3a Adds a magic "self" node name to distance queries. 2015-10-23 15:23:01 -07:00
James Phillips 89c7203f31 Adds coordinate sorting support to catalog queries for nodes and service nodes. 2015-10-23 15:23:01 -07:00
Armon Dadgar 6a350d5d19 Merge pull request #1318 from daveadams/f-http-header-token
Allow specifying Consul token in an HTTP request header
2015-10-22 13:33:47 -07:00
Jeff Mitchell 1e3840b044 Update cleanhttp repo location 2015-10-22 14:14:22 -04:00
Jeff Mitchell 9a5fd5424a Use cleanhttp to get rid of DefaultTransport 2015-10-22 10:47:50 -04:00
David Adams b7bcb2a414 Add HTTP request header X-Consul-Token
Add support for an X-Consul-Token HTTP request header to specify the
token with which this request should be fulfilled. The header would have
precedence over the responding Agent's default token, but would have
lower precedence than a token specified in the query string.
2015-10-19 11:26:01 -05:00
Ryan Uber 52a7206ff3 agent: test scada HTTP server creation 2015-08-25 18:51:04 -07:00
Ryan Uber 2e6ccded2c agent: scada client and HTTP server are tracked separately 2015-08-25 16:59:53 -07:00
Ryan Uber ee5659858a agent: hide tokens from logs and monitor 2015-04-12 11:17:31 -07:00
Michael Fraenkel 8c26836783 Support SesionTTLMin configuration
- Allow setting SessionTTLMin
- Validate on the Server
2015-03-27 05:13:57 -07:00
Armon Dadgar ad3016100c agent: Test ACL token resolution 2015-02-18 15:12:15 -08:00
Armon Dadgar 85a47ba584 agent: Adding atlas_join configuration 2015-02-18 15:12:14 -08:00
Ryan Uber c958824bb6 agent: use squash mapstructure tag to properly decode embedded structs 2015-01-20 21:10:58 -08:00
Ryan Uber b1dae530d4 agent: use interface for file permissions 2015-01-20 18:53:18 -08:00
Ryan Uber 145c56b47d agent: test Unix domain socket permission settings 2015-01-20 14:32:15 -08:00