Commit Graph

30 Commits

Author SHA1 Message Date
Frank Schroeder 62c77d70f0 build: make tests independent of build tags
When the metadata server is scanning the agents for potential servers
it is parsing the version number which the agent provided when it
joined. This version number has to conform to a certain format, i.e.
'n.n.n'. Without this version number properly set some tests fail with
error messages that disguise the root cause.

The default version number is currently set to 'unknown' in
version/version.go which does not parse and triggers the tests to fail.
The work around is to use a build tag 'consul' which will use the
version number set in version_base.go instead which has the correct
format and is set to the current release version.

In addition, some parts of the code also require the version number to
be of a certain value. Setting it to '0.0.0' for example makes some
tests pass and others fail since they don't pass the semantic check.

When using go build/install/test one has to remember to use '-tags
consul' or tests will fail with non-obvious error messages.

Using build tags makes the build process more complex and error prone
since it prevents the use of the plain go toolchain and - at least in
its current form - introduces subtle build and test issues. We should
try to eliminate build tags for anything else but platform specific
code.

This patch removes all references to specific version numbers in the
code and tests and sets the default version to '9.9.9' which is
syntactically correct and passes the semantic check. This solves the
issue of running go build/install/test without tags for the OSS build.
2017-08-30 13:40:18 +02:00
Frank Schroeder 26474ce9c2
test: refactor command tests to use TestAgent 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 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 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
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 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 49c71f923b test: drop unused code 2017-05-11 17:04:36 +02:00
James Phillips 424d70ba5d
Cleans up a stray mark and fixes unit tests.
Ended up removing the leader_test.go server address change test as part
of this. The join was failing becase we were using a new node name with
the new logic here, but realized this was hitting some of the memberlist
conflict logic and not working as we expected. We need some additional
work to fully support address changes, so removed the test for now.
2017-03-27 01:28:54 -07:00
Kyle Havlovitz 37ea20cb44
Add advanced autopilot features 2017-03-22 15:25:16 -07:00
Kyle Havlovitz 01fe3fb399
Fix up command and api tests 2017-02-28 14:12:55 -08:00
Kyle Havlovitz 520edc2e49
Convert reload command to use base.Command 2017-02-09 19:32:22 -05:00
Kyle Havlovitz dd05afb32e Add reload/leave http endpoints (#2516) 2016-11-30 13:29:42 -05:00
Kyle Havlovitz ccab51b07c Add logWriter to agent Create() method 2016-11-28 18:36:26 -05:00
James Phillips ea95e8f40d Moves logger setup into its own package. (#2471)
* Moves logger setup into its own package.

* Removes a stray regex mark in the test locator.
2016-11-03 21:14:56 -07:00
Seth Vargo cd8ac28a87
Add kv command stubs 2016-09-26 16:06:53 -07:00
Seth Vargo ec16f75124
Add test function for returning an API client 2016-09-26 16:06:52 -07:00
Ryan Uber 1378fd93b0 agent: scada client and HTTP server are tracked separately 2015-08-25 16:59:53 -07:00
Ryan Uber 92794ded6e agent: fix test compilation 2015-02-20 18:17:12 -08:00
Ryan Uber 2661bbfa27 consul: more tests, remove unused KeyManager() method 2014-11-19 16:37:40 -08:00
Ryan Uber 6277a76a9d agent: adjust rpc client tests for keyring 2014-11-19 16:34:17 -08:00
Ryan Uber 109a3604da command/keys: begin tests 2014-11-19 16:30:22 -08:00
Atin Malaviya 2bd0e8c745 consul.Config() helper to generate the tlsutil.Config{} struct, 30 second keepalive, use keepalive for HTTP and HTTPS 2014-11-18 17:56:48 -05:00
Atin Malaviya b4424a1a50 Moved TLS Config stuff to tlsutil package 2014-11-18 11:03:36 -05:00
Armon Dadgar 9e061a3886 command/watch: Adding tests 2014-08-21 16:08:21 -07:00
William Tisäter 2c13f8a03e Re-configure `LeaderLeaseTimeout` to pass validation 2014-05-30 20:57:39 +02:00
Armon Dadgar 969d2a6c20 command: Fixing more tests 2014-04-11 16:34:29 -07:00
Armon Dadgar 5d3a3e41fe Adding the various CLI commands 2013-12-31 13:06:33 -08:00