Commit Graph

1274 Commits

Author SHA1 Message Date
Frank Schroeder 2b627b95dd
agent: fix logging
* use agent logger for consul/serf/raft/dns/agent/...
* support optional id for concurrent tests
2017-05-31 00:29:27 +02:00
Frank Schroeder a433d13b20
test: call t.Fatal() from main go routine 2017-05-31 00:29:27 +02:00
Frank Schroeder 9d4529972e
dns: do not log socket close during shutdown 2017-05-31 00:29:27 +02:00
Frank Schroeder ae5270a1e1
agent: print more useful shutdown message 2017-05-31 00:29:27 +02:00
Frank Schroeder f53b90c16b
test: start sync after agent start 2017-05-31 00:29:27 +02:00
Frank Schroeder bb3b099d60
test: add test name to output 2017-05-31 00:29:27 +02:00
Frank Schroeder 9fbac59f78
test: perform blocking query on agent 2017-05-31 00:29:27 +02:00
Frank Schroeder 36a2312639
test: parallelize dns test 2017-05-31 00:29:26 +02:00
Frank Schroeder d0cb508382
test: remove output to stdout 2017-05-31 00:29:26 +02:00
Frank Schroeder 846fe5d630
test: use cli.NewMockUi instead of new(cli.MockUi)
Use the constructor function to prevent a nil panic
if there was no write to the output buffers.
2017-05-31 00:29:26 +02:00
Frank Schroeder ad153f0e76
test: fix data race with endpoints 2017-05-31 00:29:26 +02:00
Frank Schroeder 449eceec11
agent: shutdown delegate if created
When the TestAgent shuts down a half-started agent
the delegate may not have been created at this point.
2017-05-31 00:29:26 +02:00
Frank Schroeder 6a40fe026e
agent: shutdown dns servers on error 2017-05-31 00:29:26 +02:00
Frank Schroeder 60a47addc7
test: Shutdown half-started agent before retrying 2017-05-31 00:29:25 +02:00
Frank Schroeder d1ee368da9
test: fix data race in MockNotify
42 -> 32 data races
2017-05-31 00:29:25 +02:00
Frank Schroeder 48bff52614
test: address pull request comments 2017-05-31 00:29:25 +02:00
Frank Schroeder b9ae289e34
test: remove ACL options from default test config 2017-05-31 00:29:25 +02:00
Frank Schroeder e8651261f9
test: allocate ports in blocks of 10 2017-05-31 00:29:24 +02:00
Frank Schroeder 26474ce9c2
test: refactor command tests to use TestAgent 2017-05-31 00:29:24 +02:00
Frank Schroeder 98ac791577
test: retry a bit more often 2017-05-31 00:29:24 +02:00
Frank Schroeder 6e7cf8c07e
agent: rename *Config vars to 'cfg' 2017-05-31 00:29:24 +02:00
Frank Schroeder 193eec414f
agent: rename *Command vars to 'cmd'
'c' is ambigious and it conflicts with 'config'.
2017-05-31 00:29:24 +02:00
Frank Schroeder 5cdfd3789f
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 f6cc2c3fbb
test: use less aggressive retry for agent startup 2017-05-31 00:29:24 +02:00
Frank Schroeder 51a56cb973
test: use system temp dir for TestAgent 2017-05-31 00:29:24 +02:00
Frank Schroeder adb994a745
test: a.config -> a.Config 2017-05-31 00:29:23 +02:00
Frank Schroeder d64a21d8dc
test: refactor httpTest with TestAgent 2017-05-31 00:29:23 +02:00
Frank Schroeder a02485462e
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 b05a875119
agent: refactor tests for TestAgent
Refactored tests that use

 * makeAgentXXX
 * makeDNSServerXXX
 * makeHTTPServerXXX
2017-05-31 00:29:23 +02:00
Frank Schroeder 2e829f8917
agent: add TestAgent to replace other mechanisms
TestAgent will replace the following mechanisms to
start test agents in subsequent requests:

 * makeAgentXXX
 * makeDNSServerXXX
 * makeHTTPServerXXX
 * testServer
 * httpTest
2017-05-31 00:29:23 +02:00
Frank Schroeder 76fbe43f56
agent: simplify agent creation
This patch creates an agent with just a config struct
and allows for other fields to be set as required.
2017-05-31 00:29:23 +02:00
Frank Schroeder 8d9f5b9a64
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 b2670b2d59
agent: fix comment 2017-05-31 00:29:22 +02:00
Frank Schroeder efeb7d8535
agent: simplify socket address helper 2017-05-31 00:29:22 +02:00
Frank Schroeder ab1a94977d
agent: replace goto with local function 2017-05-31 00:29:22 +02:00
Frank Schroeder 242ad8bb3a
agent: inline uiDir field
uiDir can be inlined as agent.config.UIDir
2017-05-31 00:29:22 +02:00
Frank Schroeder bc657da280
agent: drop logOutput parameter
agent.logOutput is identical to logOutput
2017-05-31 00:29:22 +02:00
Frank Schroeder 3a9f867b9b
agent: drop config argument
agent.config and config are identical.
2017-05-31 00:29:22 +02:00
Kyle Havlovitz e196576c07 Add settings for upshifting to encrypted gossip (#3079) 2017-05-30 08:51:37 -07:00
James Phillips 8ea5a3f791 Removes obsolete agent API documentation. 2017-05-26 10:24:45 -07:00
Frank Schroeder dd7198e7de
doc: update comments and run goimports 2017-05-24 10:20:28 +02:00
Michael Leow ec81c18006
agent: add RetryJoin support for Azure
Pull #2978 from leowmjw/develop

Resolves #2978
2017-05-24 10:15:38 +02:00
Frank Schroeder 9f4286b1ce
agent: support custom check id and name
This patch adds support for a custom check id and name when
registering a service.

This is achieved by adding a CheckID and a Name field to the
CheckType structure which is used to register checks with a
service and when returning health check definitions.

CheckDefinition is a superset of CheckType which duplicates
some of the fields of CheckType. This patch decouples these
two structures by removing the embedding of CheckType in
CheckDefinition.

Fixes #3047
2017-05-17 20:17:08 +02:00
Frank Schroeder 69125e3a58 agent: move isAddrANY to separate package 2017-05-15 22:44:43 +02:00
Frank Schroeder d6eb1d434f agent: Replace client/server with delegate interface
This patch adds a new internal interface clientServer
which defines the common methods of consul.Client and
consul.Server. This allows to replace the following
code

    if a.server != nil {
        a.server.do()
    } else {
        a.client.do()
    }

with

    a.delegate.do()

In case a specific type is required a type check can
be performed:

    if srv, ok := a.delegate.(*consul.Server); ok {
        srv.doSrv()
    }
2017-05-15 18:35:38 +02:00
Frank Schroeder e350b7aafa agent: allow "::" as IPv6 bind address
Fixes #2285
2017-05-15 17:51:33 +02:00
Frank Schroeder eedf0f3ac5 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 10622b6995 test: suppress osx firewall warning
macOS displays a firewall warning dialog when an unsigned
application is trying to bind to a non-loopback address.

This patch updates some test configurations to ensure binding
to a loopback address where possible to suppress these warnings.
2017-05-12 22:12:47 +02:00
Frank Schroeder 15590a8446 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 3e4dc6e133 agent: use bind address as src unless INADDR_ANY
Use the bind address as source address for outgoing
RPC connections unless it is INADDR_ANY.

The current code uses the advertise address which will
not work in certain environments where the advertise
address is not routable in the network of the agent,
e.g. NAT environment, container... After all, that is
the purpose of the advertise address.

See #2822
2017-05-11 00:34:14 +02:00