From e5fc8db4581d8dcabe74802b434d439cce912bbf Mon Sep 17 00:00:00 2001 From: Chelsea Holland Komlo Date: Wed, 28 Feb 2018 14:32:54 -0500 Subject: [PATCH] go style; update comments --- client/client.go | 2 ++ client/driver/docker.go | 2 +- client/driver/docker_test.go | 2 -- nomad/structs/node.go | 4 ++++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/client/client.go b/client/client.go index 03e1c0045c5..32a3e344919 100644 --- a/client/client.go +++ b/client/client.go @@ -1016,6 +1016,8 @@ func (c *Client) updateNodeFromFingerprint(response *cstructs.FingerprintRespons return c.config.Node } +// updateNodeFromHealthCheck receives a health check response and updates the +// node accordingly func (c *Client) updateNodeFromHealthCheck(response *cstructs.HealthCheckResponse) *structs.Node { c.configLock.Lock() defer c.configLock.Unlock() diff --git a/client/driver/docker.go b/client/driver/docker.go index 07d3afa9553..c5d617c4e8d 100644 --- a/client/driver/docker.go +++ b/client/driver/docker.go @@ -589,7 +589,7 @@ func (d *DockerDriver) HealthCheck(req *cstructs.HealthCheckRequest, resp *cstru // interval at which to do them. func (d *DockerDriver) GetHealthCheckInterval(req *cstructs.HealthCheckIntervalRequest, resp *cstructs.HealthCheckIntervalResponse) error { resp.Eligible = true - resp.Period = 3 * time.Second + resp.Period = 1 * time.Minute return nil } diff --git a/client/driver/docker_test.go b/client/driver/docker_test.go index 60ada85e2bd..570ca3504b6 100644 --- a/client/driver/docker_test.go +++ b/client/driver/docker_test.go @@ -267,8 +267,6 @@ func TestDockerDriver_Check_DockerHealthStatus(t *testing.T) { require := require.New(t) - // This seems fragile, so we might need to reconsider this test if it - // proves flaky expectedAddr, err := sockaddr.GetInterfaceIP("docker0") if err != nil { t.Fatalf("unable to get ip for docker0: %v", err) diff --git a/nomad/structs/node.go b/nomad/structs/node.go index 80daed172f2..7910e1ba7d9 100644 --- a/nomad/structs/node.go +++ b/nomad/structs/node.go @@ -15,12 +15,16 @@ type DriverInfo struct { UpdateTime time.Time } +// MergeHealthCheck merges information from a health check for a drier into a +// node's driver info func (di *DriverInfo) MergeHealthCheck(other *DriverInfo) { di.Healthy = other.Healthy di.HealthDescription = other.HealthDescription di.UpdateTime = other.UpdateTime } +// MergeFingerprint merges information from fingerprinting a node for a driver +// into a node's driver info for that driver. func (di *DriverInfo) MergeFingerprintInfo(other *DriverInfo) { di.Detected = other.Detected di.Attributes = other.Attributes