Skip to content

Instantly share code, notes, and snippets.

@jwreagor
Created November 12, 2017 04:03
Show Gist options
  • Save jwreagor/f0e292409f1ef52c215950d9b35da9a0 to your computer and use it in GitHub Desktop.
Save jwreagor/f0e292409f1ef52c215950d9b35da9a0 to your computer and use it in GitHub Desktop.
=== RUN TestFoo_bar
bootstrap = true: do not enable unless necessary
==> Starting Consul agent...
==> Consul agent running!
Version: 'v1.0.0'
Node ID: 'd4afaaf6-c5fb-ac84-746f-9971f07e465d'
Node name: 'node-d4afaaf6-c5fb-ac84-746f-9971f07e465d'
Datacenter: 'dc1' (Segment: '<all>')
Server: true (Bootstrap: true)
Client Addr: [127.0.0.1] (HTTP: 10002, HTTPS: 10003, DNS: 10001)
Cluster Addr: 127.0.0.1 (LAN: 10004, WAN: 10005)
Encrypt: Gossip: false, TLS-Outgoing: false, TLS-Incoming: false
==> Log data will now stream in as it occurs:
2017/11/11 22:56:48 [INFO] raft: Initial configuration (index=1): [{Suffrage:Voter ID:d4afaaf6-c5fb-ac84-746f-9971f07e465d Address:127.0.0.1:10006}]
2017/11/11 22:56:48 [INFO] raft: Node at 127.0.0.1:10006 [Follower] entering Follower state (Leader: "")
2017/11/11 22:56:48 [INFO] serf: EventMemberJoin: node-d4afaaf6-c5fb-ac84-746f-9971f07e465d.dc1 127.0.0.1
2017/11/11 22:56:48 [INFO] serf: EventMemberJoin: node-d4afaaf6-c5fb-ac84-746f-9971f07e465d 127.0.0.1
2017/11/11 22:56:48 [INFO] consul: Handled member-join event for server "node-d4afaaf6-c5fb-ac84-746f-9971f07e465d.dc1" in area "wan"
2017/11/11 22:56:48 [INFO] consul: Adding LAN server node-d4afaaf6-c5fb-ac84-746f-9971f07e465d (Addr: tcp/127.0.0.1:10006) (DC: dc1)
2017/11/11 22:56:48 [INFO] agent: Started DNS server 127.0.0.1:10001 (tcp)
2017/11/11 22:56:48 [INFO] agent: Started DNS server 127.0.0.1:10001 (udp)
2017/11/11 22:56:48 [INFO] agent: Started HTTP server on 127.0.0.1:10002 (tcp)
2017/11/11 22:56:48 [INFO] agent: Started HTTPS server on 127.0.0.1:10003 (tcp)
2017/11/11 22:56:49 [WARN] raft: Heartbeat timeout from "" reached, starting election
2017/11/11 22:56:49 [INFO] raft: Node at 127.0.0.1:10006 [Candidate] entering Candidate state in term 2
2017/11/11 22:56:49 [DEBUG] raft: Votes needed: 1
2017/11/11 22:56:49 [DEBUG] raft: Vote granted from d4afaaf6-c5fb-ac84-746f-9971f07e465d in term 2. Tally: 1
2017/11/11 22:56:49 [INFO] raft: Election won. Tally: 1
2017/11/11 22:56:49 [INFO] raft: Node at 127.0.0.1:10006 [Leader] entering Leader state
2017/11/11 22:56:49 [INFO] consul: cluster leadership acquired
2017/11/11 22:56:49 [INFO] consul: New leader elected: node-d4afaaf6-c5fb-ac84-746f-9971f07e465d
2017/11/11 22:56:49 [DEBUG] consul: Skipping self join check for "node-d4afaaf6-c5fb-ac84-746f-9971f07e465d" since the cluster is too small
2017/11/11 22:56:49 [INFO] consul: member 'node-d4afaaf6-c5fb-ac84-746f-9971f07e465d' joined, marking health alive
2017/11/11 22:56:49 [INFO] agent: Synced node info
2017/11/11 22:56:49 [DEBUG] http: Request GET /v1/catalog/nodes?index=0 (1.569098618s) from=127.0.0.1:55630
==> Starting Consul agent...
==> Consul agent running!
Version: 'v1.0.0'
Node ID: '065e84be-b060-e5b0-84cb-b66654900ac4'
Node name: 'node-065e84be-b060-e5b0-84cb-b66654900ac4'
Datacenter: 'dc1' (Segment: '<all>')
Server: true (Bootstrap: false)
Client Addr: [127.0.0.1] (HTTP: 10008, HTTPS: 10009, DNS: 10007)
Cluster Addr: 127.0.0.1 (LAN: 10010, WAN: 10011)
Encrypt: Gossip: false, TLS-Outgoing: false, TLS-Incoming: false
==> Log data will now stream in as it occurs:
2017/11/11 22:56:49 [INFO] raft: Initial configuration (index=0): []
2017/11/11 22:56:49 [INFO] raft: Node at 127.0.0.1:10012 [Follower] entering Follower state (Leader: "")
2017/11/11 22:56:49 [INFO] serf: EventMemberJoin: node-065e84be-b060-e5b0-84cb-b66654900ac4.dc1 127.0.0.1
2017/11/11 22:56:49 [INFO] serf: EventMemberJoin: node-065e84be-b060-e5b0-84cb-b66654900ac4 127.0.0.1
2017/11/11 22:56:49 [INFO] consul: Handled member-join event for server "node-065e84be-b060-e5b0-84cb-b66654900ac4.dc1" in area "wan"
2017/11/11 22:56:49 [INFO] consul: Adding LAN server node-065e84be-b060-e5b0-84cb-b66654900ac4 (Addr: tcp/127.0.0.1:10012) (DC: dc1)
2017/11/11 22:56:49 [INFO] agent: Started DNS server 127.0.0.1:10007 (udp)
2017/11/11 22:56:49 [INFO] agent: Started DNS server 127.0.0.1:10007 (tcp)
2017/11/11 22:56:49 [INFO] agent: Started HTTP server on 127.0.0.1:10008 (tcp)
2017/11/11 22:56:49 [INFO] agent: Started HTTPS server on 127.0.0.1:10009 (tcp)
2017/11/11 22:56:49 [DEBUG] http: Request GET /v1/agent/self (1.994382ms) from=127.0.0.1:55635
2017/11/11 22:56:49 [INFO] agent: (LAN) joining: [127.0.0.1:10010]
2017/11/11 22:56:49 [DEBUG] memberlist: Stream connection from=127.0.0.1:55637
2017/11/11 22:56:49 [DEBUG] memberlist: Initiating push/pull sync with: 127.0.0.1:10010
2017/11/11 22:56:49 [INFO] serf: EventMemberJoin: node-d4afaaf6-c5fb-ac84-746f-9971f07e465d 127.0.0.1
2017/11/11 22:56:49 [INFO] serf: EventMemberJoin: node-065e84be-b060-e5b0-84cb-b66654900ac4 127.0.0.1
2017/11/11 22:56:49 [INFO] agent: (LAN) joined: 1 Err: <nil>
2017/11/11 22:56:49 [INFO] consul: Adding LAN server node-d4afaaf6-c5fb-ac84-746f-9971f07e465d (Addr: tcp/127.0.0.1:10006) (DC: dc1)
2017/11/11 22:56:49 [DEBUG] agent: systemd notify failed: No socket
2017/11/11 22:56:49 [INFO] consul: New leader elected: node-d4afaaf6-c5fb-ac84-746f-9971f07e465d
2017/11/11 22:56:49 [DEBUG] http: Request PUT /v1/agent/join/127.0.0.1:10010 (1.696538ms) from=127.0.0.1:55636
2017/11/11 22:56:49 [INFO] consul: Adding LAN server node-065e84be-b060-e5b0-84cb-b66654900ac4 (Addr: tcp/127.0.0.1:10012) (DC: dc1)
2017/11/11 22:56:49 [INFO] raft: Updating configuration with AddNonvoter (065e84be-b060-e5b0-84cb-b66654900ac4, 127.0.0.1:10012) to [{Suffrage:Voter ID:d4afaaf6-c5fb-ac84-746f-9971f07e465d Address:127.0.0.1:10006} {Suffrage:Nonvoter ID:065e84be-b060-e5b0-84cb-b66654900ac4 Address:127.0.0.1:10012}]
2017/11/11 22:56:49 [DEBUG] memberlist: Initiating push/pull sync with: 127.0.0.1:10011
2017/11/11 22:56:49 [DEBUG] memberlist: Stream connection from=127.0.0.1:55639
2017/11/11 22:56:49 [DEBUG] memberlist: Initiating push/pull sync with: 127.0.0.1:10005
2017/11/11 22:56:49 [DEBUG] memberlist: Stream connection from=127.0.0.1:55638
2017/11/11 22:56:49 [INFO] serf: EventMemberJoin: node-d4afaaf6-c5fb-ac84-746f-9971f07e465d.dc1 127.0.0.1
2017/11/11 22:56:49 [INFO] serf: EventMemberJoin: node-065e84be-b060-e5b0-84cb-b66654900ac4.dc1 127.0.0.1
2017/11/11 22:56:49 [INFO] consul: Handled member-join event for server "node-d4afaaf6-c5fb-ac84-746f-9971f07e465d.dc1" in area "wan"
2017/11/11 22:56:49 [INFO] consul: Handled member-join event for server "node-065e84be-b060-e5b0-84cb-b66654900ac4.dc1" in area "wan"
2017/11/11 22:56:49 [DEBUG] consul: Successfully performed flood-join for "node-065e84be-b060-e5b0-84cb-b66654900ac4" at 127.0.0.1:10011
2017/11/11 22:56:49 [DEBUG] consul: Successfully performed flood-join for "node-d4afaaf6-c5fb-ac84-746f-9971f07e465d" at 127.0.0.1:10005
2017/11/11 22:56:49 [INFO] raft: Added peer 065e84be-b060-e5b0-84cb-b66654900ac4, starting replication
2017/11/11 22:56:49 [INFO] consul: member 'node-065e84be-b060-e5b0-84cb-b66654900ac4' joined, marking health alive
2017/11/11 22:56:49 [DEBUG] raft-net: 127.0.0.1:10012 accepted connection from: 127.0.0.1:55641
2017/11/11 22:56:49 [DEBUG] http: Request PUT /v1/kv/foo (977.042µs) from=127.0.0.1:55640
2017/11/11 22:56:49 [WARN] raft: Failed to get previous log: 7 log not found (last: 0)
2017/11/11 22:56:49 [WARN] raft: AppendEntries to {Nonvoter 065e84be-b060-e5b0-84cb-b66654900ac4 127.0.0.1:10012} rejected, sending older logs (next: 1)
2017/11/11 22:56:49 [DEBUG] http: Request PUT /v1/kv/bar (414.287µs) from=127.0.0.1:55642
2017/11/11 22:56:49 [INFO] raft: pipelining replication to peer {Nonvoter 065e84be-b060-e5b0-84cb-b66654900ac4 127.0.0.1:10012}
2017/11/11 22:56:49 [DEBUG] http: Request PUT /v1/kv/baz (422.474µs) from=127.0.0.1:55643
127.0.0.1:10002
Bingo
2017/11/11 22:56:49 [INFO] Caught signal: interrupt
2017/11/11 22:56:49 [INFO] Graceful shutdown disabled. Exiting
2017/11/11 22:56:49 [INFO] agent: Requesting shutdown
2017/11/11 22:56:49 [INFO] consul: shutting down server
2017/11/11 22:56:49 [WARN] serf: Shutdown without a Leave
2017/11/11 22:56:49 [ERR] agent: failed to sync remote state: No cluster leader
2017/11/11 22:56:49 [WARN] serf: Shutdown without a Leave
2017/11/11 22:56:49 [INFO] manager: shutting down
2017/11/11 22:56:49 [INFO] agent: consul server down
2017/11/11 22:56:49 [INFO] agent: shutdown complete
2017/11/11 22:56:49 [INFO] agent: Stopping DNS server 127.0.0.1:10007 (tcp)
2017/11/11 22:56:49 [INFO] agent: Stopping DNS server 127.0.0.1:10007 (udp)
2017/11/11 22:56:49 [INFO] agent: Stopping HTTP server 127.0.0.1:10008 (tcp)
2017/11/11 22:56:49 [INFO] agent: Stopping HTTPS server 127.0.0.1:10009 (tcp)
2017/11/11 22:56:49 [INFO] agent: Waiting for endpoints to shut down
2017/11/11 22:56:49 [INFO] agent: Endpoints down
2017/11/11 22:56:49 [INFO] Exit code: 1
2017/11/11 22:56:49 [INFO] Caught signal: interrupt
2017/11/11 22:56:49 [INFO] Graceful shutdown disabled. Exiting
2017/11/11 22:56:49 [INFO] agent: Requesting shutdown
2017/11/11 22:56:49 [INFO] consul: shutting down server
2017/11/11 22:56:49 [WARN] serf: Shutdown without a Leave
2017/11/11 22:56:49 [WARN] serf: Shutdown without a Leave
2017/11/11 22:56:49 [INFO] manager: shutting down
2017/11/11 22:56:49 [INFO] raft: aborting pipeline replication to peer {Nonvoter 065e84be-b060-e5b0-84cb-b66654900ac4 127.0.0.1:10012}
2017/11/11 22:56:49 [INFO] agent: consul server down
2017/11/11 22:56:49 [INFO] agent: shutdown complete
2017/11/11 22:56:49 [INFO] agent: Stopping DNS server 127.0.0.1:10001 (tcp)
2017/11/11 22:56:49 [INFO] agent: Stopping DNS server 127.0.0.1:10001 (udp)
2017/11/11 22:56:49 [INFO] agent: Stopping HTTP server 127.0.0.1:10002 (tcp)
2017/11/11 22:56:49 [INFO] agent: Stopping HTTPS server 127.0.0.1:10003 (tcp)
2017/11/11 22:56:49 [INFO] agent: Waiting for endpoints to shut down
2017/11/11 22:56:49 [INFO] agent: Endpoints down
2017/11/11 22:56:49 [INFO] Exit code: 1
--- PASS: TestFoo_bar (1.90s)
PASS
ok github.com/joyent/cp-test 1.917s
=== RUN TestWithConsul
--- FAIL: TestWithConsul (0.00s)
panic: Get http://127.0.0.1:7965/6: dial tcp 127.0.0.1:7965: getsockopt: connection refused [recovered]
panic: Get http://127.0.0.1:7965/6: dial tcp 127.0.0.1:7965: getsockopt: connection refused
goroutine 38 [running]:
testing.tRunner.func1(0xc42015a0f0)
/usr/local/Cellar/go/1.9.1/libexec/src/testing/testing.go:711 +0x2d2
panic(0x1331ca0, 0xc4201667e0)
/usr/local/Cellar/go/1.9.1/libexec/src/runtime/panic.go:491 +0x283
github.com/joyent/containerpilot/vendor/github.com/hashicorp/consul/testutil.defaultServerConfig(0xc42015a0f0)
/Users/justinreagor/go/src/github.com/joyent/containerpilot/vendor/github.com/hashicorp/consul/testutil/server.go:116 +0x3a6
github.com/joyent/containerpilot/vendor/github.com/hashicorp/consul/testutil.newTestServerConfigT(0xc42015a0f0, 0x13a4d40, 0x0, 0x0, 0x0)
/Users/justinreagor/go/src/github.com/joyent/containerpilot/vendor/github.com/hashicorp/consul/testutil/server.go:206 +0x135
github.com/joyent/containerpilot/vendor/github.com/hashicorp/consul/testutil.NewTestServerConfigT(0xc42015a0f0, 0x13a4d40, 0xc400000008, 0xc42012c0c0, 0xc420462798)
/Users/justinreagor/go/src/github.com/joyent/containerpilot/vendor/github.com/hashicorp/consul/testutil/server.go:194 +0x35
github.com/joyent/containerpilot/discovery.TestWithConsul(0xc42015a0f0)
/Users/justinreagor/go/src/github.com/joyent/containerpilot/discovery/consul_test.go:84 +0x3b
testing.tRunner(0xc42015a0f0, 0x13a4d48)
/usr/local/Cellar/go/1.9.1/libexec/src/testing/testing.go:746 +0xd0
created by testing.(*T).Run
/usr/local/Cellar/go/1.9.1/libexec/src/testing/testing.go:789 +0x2de
exit status 2
FAIL github.com/joyent/containerpilot/discovery 0.288s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment