Commit Graph

30 Commits

Author SHA1 Message Date
Frank Schroeder 831d84c940 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 53c1c86ab3
test: refactor command tests to use TestAgent 2017-05-31 00:29:24 +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 3865f14a25
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 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 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 db3599762f test: drop unused code 2017-05-11 17:04:36 +02:00
James Phillips 59a599a14b
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 390f41d8d5
Add advanced autopilot features 2017-03-22 15:25:16 -07:00
Kyle Havlovitz f389b59fd5
Fix up command and api tests 2017-02-28 14:12:55 -08:00
Kyle Havlovitz 8c14f93fb1
Convert reload command to use base.Command 2017-02-09 19:32:22 -05:00
Kyle Havlovitz bd69c6d871 Add reload/leave http endpoints (#2516) 2016-11-30 13:29:42 -05:00
Kyle Havlovitz 338e36cc5d Add logWriter to agent Create() method 2016-11-28 18:36:26 -05:00
James Phillips 925c46f725 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 87ad6d466c
Add kv command stubs 2016-09-26 16:06:53 -07:00
Seth Vargo 8c30edc54e
Add test function for returning an API client 2016-09-26 16:06:52 -07:00
Ryan Uber 2e6ccded2c agent: scada client and HTTP server are tracked separately 2015-08-25 16:59:53 -07:00
Ryan Uber 6f0fecc73c agent: fix test compilation 2015-02-20 18:17:12 -08:00
Ryan Uber 0cafb129ee consul: more tests, remove unused KeyManager() method 2014-11-19 16:37:40 -08:00
Ryan Uber f86904ee59 agent: adjust rpc client tests for keyring 2014-11-19 16:34:17 -08:00
Ryan Uber 90de483871 command/keys: begin tests 2014-11-19 16:30:22 -08:00
Atin Malaviya 61f1d24f39 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 f1f8c88228 Moved TLS Config stuff to tlsutil package 2014-11-18 11:03:36 -05:00
Armon Dadgar 0cd9faf3a2 command/watch: Adding tests 2014-08-21 16:08:21 -07:00
William Tisäter 9e3ad6721c Re-configure `LeaderLeaseTimeout` to pass validation 2014-05-30 20:57:39 +02:00
Armon Dadgar 6fd3f81c48 command: Fixing more tests 2014-04-11 16:34:29 -07:00
Armon Dadgar 356dff3ec6 Adding the various CLI commands 2013-12-31 13:06:33 -08:00