Commit Graph

60 Commits

Author SHA1 Message Date
Kyle Havlovitz af4be34a2a
Update make static-assets goal and run format 2018-04-13 09:57:25 -07:00
Paul Banks 9b97bebc95
Merge pull request #3903 from hashicorp/build-fixes
[WIP] Attempt to find some low-hanging fruit for CI failures
2018-02-23 13:12:45 +00:00
Kyle Havlovitz 1e11082709
Use GOTAGS in the vet make goal 2018-02-22 15:57:09 -08:00
Paul Banks 7b85f09d59
Travis evaluates ENV before cloning git repo and cding so we need to delay gathering packages until the makefile 2018-02-21 12:54:23 +00:00
Paul Banks 41ae19c677
Split the heavy test packages out to their own Jobs. 2018-02-21 12:20:33 +00:00
Paul Banks 29feb66fbd
Portability! 2018-02-20 15:48:18 +00:00
Paul Banks 6f266a0103
Only output sparse lines to keep Travis happy while logging verbosely to disk 2018-02-20 15:33:36 +00:00
Paul Banks e416f828dc
Output from test as we run to stop travis killing us and try no parallelism to avoid timing issues on their contended CPUs 2018-02-20 13:16:53 +00:00
James Phillips fbfe0c65a7
Switches to HashiCorp fork of jteeuwen/go-bindata.
This was reported in #3868. We make a HashiCorp hard fork of the
jteeuwen/go-bindata hard fork that was replaced and diffed the code
against a Dec 1, 2015 copy of the original repository we had as a
cross-check of that hard fork.

This replaces references to jteeuwen/go-bindata to point to the
HashiCorp fork.

Fixes #3868
2018-02-07 07:39:10 -08:00
Chad Whitacre d11a664e25 Allow for default GOPATH 2018-01-04 14:38:20 -05:00
James Phillips 5d574e7fc7
Gets rid of full log in Travis for now. 2017-11-08 19:39:02 -08:00
Frank Schroeder c94751ad43 test: replace porter tool with freeport lib
This patch removes the porter tool which hands out free ports from a
given range with a library which does the same thing. The challenge for
acquiring free ports in concurrent go test runs is that go packages are
tested concurrently and run in separate processes. There has to be some
inter-process synchronization in preventing processes allocating the
same ports.

freeport allocates blocks of ports from a range expected to be not in
heavy use and implements a system-wide mutex by binding to the first
port of that block for the lifetime of the application. Ports are then
provided sequentially from that block and are tested on localhost before
being returned as available.
2017-10-21 22:01:09 +02:00
Frank Schroeder a61929a597 build: add changelogfmt target to format [GH-xxxx] references to links 2017-10-04 21:14:16 +02:00
Frank Schröder 12216583a1 New config parser, HCL support, multiple bind addrs (#3480)
* new config parser for agent

This patch implements a new config parser for the consul agent which
makes the following changes to the previous implementation:

 * add HCL support
 * all configuration fragments in tests and for default config are
   expressed as HCL fragments
 * HCL fragments can be provided on the command line so that they
   can eventually replace the command line flags.
 * HCL/JSON fragments are parsed into a temporary Config structure
   which can be merged using reflection (all values are pointers).
   The existing merge logic of overwrite for values and append
   for slices has been preserved.
 * A single builder process generates a typed runtime configuration
   for the agent.

The new implementation is more strict and fails in the builder process
if no valid runtime configuration can be generated. Therefore,
additional validations in other parts of the code should be removed.

The builder also pre-computes all required network addresses so that no
address/port magic should be required where the configuration is used
and should therefore be removed.

* Upgrade github.com/hashicorp/hcl to support int64

* improve error messages

* fix directory permission test

* Fix rtt test

* Fix ForceLeave test

* Skip performance test for now until we know what to do

* Update github.com/hashicorp/memberlist to update log prefix

* Make memberlist use the default logger

* improve config error handling

* do not fail on non-existing data-dir

* experiment with non-uniform timeouts to get a handle on stalled leader elections

* Run tests for packages separately to eliminate the spurious port conflicts

* refactor private address detection and unify approach for ipv4 and ipv6.

Fixes #2825

* do not allow unix sockets for DNS

* improve bind and advertise addr error handling

* go through builder using test coverage

* minimal update to the docs

* more coverage tests fixed

* more tests

* fix makefile

* cleanup

* fix port conflicts with external port server 'porter'

* stop test server on error

* do not run api test that change global ENV concurrently with the other tests

* Run remaining api tests concurrently

* no need for retry with the port number service

* monkey patch race condition in go-sockaddr until we understand why that fails

* monkey patch hcl decoder race condidtion until we understand why that fails

* monkey patch spurious errors in strings.EqualFold from here

* add test for hcl decoder race condition. Run with go test -parallel 128

* Increase timeout again

* cleanup

* don't log port allocations by default

* use base command arg parsing to format help output properly

* handle -dc deprecation case in Build

* switch autopilot.max_trailing_logs to int

* remove duplicate test case

* remove unused methods

* remove comments about flag/config value inconsistencies

* switch got and want around since the error message was misleading.

* Removes a stray debug log.

* Removes a stray newline in imports.

* Fixes TestACL_Version8.

* Runs go fmt.

* Adds a default case for unknown address types.

* Reoders and reformats some imports.

* Adds some comments and fixes typos.

* Reorders imports.

* add unix socket support for dns later

* drop all deprecated flags and arguments

* fix wrong field name

* remove stray node-id file

* drop unnecessary patch section in test

* drop duplicate test

* add test for LeaveOnTerm and SkipLeaveOnInt in client mode

* drop "bla" and add clarifying comment for the test

* split up tests to support enterprise/non-enterprise tests

* drop raft multiplier and derive values during build phase

* sanitize runtime config reflectively and add test

* detect invalid config fields

* fix tests with invalid config fields

* use different values for wan sanitiziation test

* drop recursor in favor of recursors

* allow dns_config.udp_answer_limit to be zero

* make sure tests run on machines with multiple ips

* Fix failing tests in a few more places by providing a bind address in the test

* Gets rid of skipped TestAgent_CheckPerformanceSettings and adds case for builder.

* Add porter to server_test.go to make tests there less flaky

* go fmt
2017-09-25 11:40:42 -07:00
James Phillips 3b1eebd502 Gets rid of spurious $(GOTEST_FLAGS) in the log file name. 2017-09-07 12:32:58 -07:00
James Phillips b1a15e0c3d
Adds open source side of network segments (feature is Enterprise-only). 2017-08-30 11:58:29 -07:00
Frank Schroeder f25632d6a1 build: drop 'consul' build tag for OSS build 2017-08-30 13:40:18 +02:00
James Phillips bddca46d0e
Revert "Rename GNUMakefile to Makefile (#3348)"
This reverts commit b0adb8af92.
2017-08-03 09:50:04 -07:00
Seth Vargo b0adb8af92 Rename GNUMakefile to Makefile (#3348) 2017-08-02 10:46:03 -07:00
Frank Schroeder 2959b16baa
build: fix travis build 2017-07-18 09:24:40 +02:00
Frank Schroeder ad9029b017 build: use vendorfmt to make vendor.json more merge friendly 2017-07-18 09:15:25 +02:00
Frank Schroeder 9e83a034e3
build: run vet on make test 2017-07-11 16:16:57 -07:00
Frank Schroeder 61ca9b02d4 build: build all packages together
Build all packages together with a global timeout. Locally,
the tests pass within 40 sec. On travis, we complete within
3-4 min.

travis truncates the logs after 4MB which we are hitting so
show the relevant information first and then whatever is left.
2017-07-07 09:22:34 +02:00
Maciej Stępyra b775a85624 Missing tools in makefile (#3205) 2017-06-29 12:55:01 +02:00
Preetha Appan d5d79d0ad3 fix type in make file 2017-06-28 09:48:00 -05:00
preetapan 99f93cd4e7 make test should fail fast on test compilation errors (#3172) 2017-06-21 14:47:08 -07:00
James Phillips 0e695aef94 Fixes checked in web assets and associated build scripts. (#3173) 2017-06-21 14:43:07 -07:00
Preetha Appan cf5006c4f4 Fixed static asset build target and checked in new executable for assetfs 2017-06-12 12:57:02 -05:00
Frank Schroeder 1c75cf1af5 pkg refactor
command/agent/*                  -> agent/*
    command/consul/*                 -> agent/consul/*
    command/agent/command{,_test}.go -> command/agent{,_test}.go
    command/base/command.go          -> command/base.go
    command/base/*                   -> command/*
    commands.go                      -> command/commands.go

The script which did the refactor is:

(
	cd $GOPATH/src/github.com/hashicorp/consul
	git mv command/agent/command.go command/agent.go
	git mv command/agent/command_test.go command/agent_test.go
	git mv command/agent/flag_slice_value{,_test}.go command/
	git mv command/agent .
	git mv command/base/command.go command/base.go
	git mv command/base/config_util{,_test}.go command/
	git mv commands.go command/
	git mv consul agent
	rmdir command/base/

	gsed -i -e 's|package agent|package command|' command/agent{,_test}.go
	gsed -i -e 's|package agent|package command|' command/flag_slice_value{,_test}.go
	gsed -i -e 's|package base|package command|' command/base.go command/config_util{,_test}.go
	gsed -i -e 's|package main|package command|' command/commands.go

	gsed -i -e 's|base.Command|BaseCommand|' command/commands.go
	gsed -i -e 's|agent.Command|AgentCommand|' command/commands.go
	gsed -i -e 's|\tCommand:|\tBaseCommand:|' command/commands.go
	gsed -i -e 's|base\.||' command/commands.go
	gsed -i -e 's|command\.||' command/commands.go

	gsed -i -e 's|command|c|' main.go
	gsed -i -e 's|range Commands|range command.Commands|' main.go
	gsed -i -e 's|Commands: Commands|Commands: command.Commands|' main.go

	gsed -i -e 's|base\.BoolValue|BoolValue|' command/operator_autopilot_set.go
	gsed -i -e 's|base\.DurationValue|DurationValue|' command/operator_autopilot_set.go
	gsed -i -e 's|base\.StringValue|StringValue|' command/operator_autopilot_set.go
	gsed -i -e 's|base\.UintValue|UintValue|' command/operator_autopilot_set.go

	gsed -i -e 's|\bCommand\b|BaseCommand|' command/base.go
	gsed -i -e 's|BaseCommand Options|Command Options|' command/base.go
	gsed -i -e 's|base.Command|BaseCommand|' command/*.go
	gsed -i -e 's|c\.Command|c.BaseCommand|g' command/*.go
	gsed -i -e 's|\tCommand:|\tBaseCommand:|' command/*_test.go
	gsed -i -e 's|base\.||' command/*_test.go

	gsed -i -e 's|\bCommand\b|AgentCommand|' command/agent{,_test}.go
	gsed -i -e 's|cmd.AgentCommand|cmd.BaseCommand|' command/agent.go

	gsed -i -e 's|cli.AgentCommand = new(Command)|cli.Command = new(AgentCommand)|' command/agent_test.go
	gsed -i -e 's|exec.AgentCommand|exec.Command|' command/agent_test.go
	gsed -i -e 's|exec.BaseCommand|exec.Command|' command/agent_test.go
	gsed -i -e 's|NewTestAgent|agent.NewTestAgent|' command/agent_test.go
	gsed -i -e 's|= TestConfig|= agent.TestConfig|' command/agent_test.go
	gsed -i -e 's|: RetryJoin|: agent.RetryJoin|' command/agent_test.go

	gsed -i -e 's|\.\./\.\./|../|' command/config_util_test.go

	gsed -i -e 's|\bverifyUniqueListeners|VerifyUniqueListeners|' agent/config{,_test}.go command/agent.go
	gsed -i -e 's|\bserfLANKeyring\b|SerfLANKeyring|g' agent/{agent,keyring,testagent}.go command/agent.go
	gsed -i -e 's|\bserfWANKeyring\b|SerfWANKeyring|g' agent/{agent,keyring,testagent}.go command/agent.go
	gsed -i -e 's|\bNewAgent\b|agent.New|g' command/agent{,_test}.go
	gsed -i -e 's|\bNewAgent|New|' agent/{acl_test,agent,testagent}.go

	gsed -i -e 's|\bAgent\b|agent.&|g' command/agent{,_test}.go
	gsed -i -e 's|\bBool\b|agent.&|g' command/agent{,_test}.go
	gsed -i -e 's|\bConfig\b|agent.&|g' command/agent{,_test}.go
	gsed -i -e 's|\bDefaultConfig\b|agent.&|g' command/agent{,_test}.go
	gsed -i -e 's|\bDevConfig\b|agent.&|g' command/agent{,_test}.go
	gsed -i -e 's|\bMergeConfig\b|agent.&|g' command/agent{,_test}.go
	gsed -i -e 's|\bReadConfigPaths\b|agent.&|g' command/agent{,_test}.go
	gsed -i -e 's|\bParseMetaPair\b|agent.&|g' command/agent{,_test}.go
	gsed -i -e 's|\bSerfLANKeyring\b|agent.&|g' command/agent{,_test}.go
	gsed -i -e 's|\bSerfWANKeyring\b|agent.&|g' command/agent{,_test}.go

	gsed -i -e 's|circonus\.agent|circonus|g' command/agent{,_test}.go
	gsed -i -e 's|logger\.agent|logger|g' command/agent{,_test}.go
	gsed -i -e 's|metrics\.agent|metrics|g' command/agent{,_test}.go
	gsed -i -e 's|// agent.Agent|// agent|' command/agent{,_test}.go
	gsed -i -e 's|a\.agent\.Config|a.Config|' command/agent{,_test}.go

	gsed -i -e 's|agent\.AppendSliceValue|AppendSliceValue|' command/{configtest,validate}.go

	gsed -i -e 's|consul/consul|agent/consul|' GNUmakefile

	gsed -i -e 's|\.\./test|../../test|' agent/consul/server_test.go

	# fix imports
	f=$(grep -rl 'github.com/hashicorp/consul/command/agent' * | grep '\.go')
	gsed -i -e 's|github.com/hashicorp/consul/command/agent|github.com/hashicorp/consul/agent|' $f
	goimports -w $f

	f=$(grep -rl 'github.com/hashicorp/consul/consul' * | grep '\.go')
	gsed -i -e 's|github.com/hashicorp/consul/consul|github.com/hashicorp/consul/agent/consul|' $f
	goimports -w $f

	goimports -w command/*.go main.go
)
2017-06-10 18:52:45 +02:00
James Phillips e9ee136baf
Makes test target fail based on return code from go test. 2017-06-02 15:09:07 -07:00
Frank Schroeder 68cac3d40c
Revert "test: run all tests together again"
This reverts commit e48df7b572.
2017-06-02 07:52:21 +02:00
Frank Schroeder e48df7b572
test: run all tests together again
Looks like I have eliminated the troublesome tests for now.
2017-05-31 10:00:10 +02:00
Frank Schroeder 205cbe5fc8
build: update makefile
* capture all output to test.log only and print only failures
* always print output on travis
* test github.com/hashicorp/consul/consul separately until we've
  found the interactions with the other packages during testing.
2017-05-31 00:29:28 +02:00
Frank Schroeder 53fd15070d
build: add target for running tests with race detector 2017-05-31 00:29:25 +02:00
Frank Schroeder 2a39c480b9
test: capture stderr in test.log 2017-05-31 00:29:18 +02:00
Frank Schroeder 9993095448 test: simplify makefile 2017-05-12 22:12:47 +02:00
Frank Schroeder 57622c518a
Add make target for linux binary 2017-05-04 13:31:56 +02:00
James Phillips f37303401a Merge pull request #2987 from sean-/b-fix-dev-paths
Fix `make dev` when the `bin/` directory doesn't exist.
2017-04-28 16:44:25 -07:00
Sean Chittenden 047576148e
Fix `make dev` when the `bin/` directory doesn't exist.
Without this patch you end up with a nifty consul build named `bin`,
not `bin/consul`.
2017-04-28 16:40:50 -07:00
Frank Schroeder 3cc7a55a9a
build: Use bash for building 2017-04-27 11:49:43 -07:00
Frank Schroeder 76b9e257e3
build: Do not swallow go test exit code 2017-04-27 11:17:58 -07:00
Frank Schroeder 9c632e4eb7 build: Simplify make test and log output 2017-04-27 10:34:30 -07:00
Frank Schröder b6ae9f187c Faster dev builds (#2924)
This patch runs 'go install' instead of gox which runs 'go build' for
'make dev' and copies the binary into ./bin and ./pkg/${GOOS}_${GOARCH}
to mimick the previous behavior. This reduces the roundtrip times
for a dev build from 11 sec to 500ms if there weren't any changes.
2017-04-18 15:03:51 -07:00
Seth Vargo 0a04d23f50
Modernize makefile a bit 2017-03-23 20:29:32 -04:00
Sean Chittenden 35fd064a79
Revert `97904cec95f1a1fafd18405f0dd143eb63d595a9` 2017-02-01 16:32:30 -08:00
Sean Chittenden 97904cec95
Catch cross-compiliation build failures at Travis. 2017-02-01 10:22:27 -08:00
James Phillips bc47511d26
Runs the static asset packaging inside the container; updates assets. 2016-11-08 15:14:08 -08:00
James Phillips 9f2c965a63
Makes vendor pattern more generic. 2016-11-02 17:33:56 -07:00
James Phillips 2a950f3897 Adds basic build tag support with different versions. (#2463) 2016-11-02 17:27:49 -07:00
James Phillips 1468930c93 Adds a UI build in a Docker container. (#2462) 2016-11-02 15:53:02 -07:00