From c6576ddac171833c54825d5ec2a2b7edd6e60212 Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Tue, 4 Sep 2018 16:03:52 -0700 Subject: [PATCH] Fix make check errors --- api/operator_autopilot.go | 2 +- client/driver/docker_test.go | 8 ++++---- command/agent/config_parse_test.go | 10 +++++----- helper/tlsutil/config_test.go | 4 ++-- nomad/deploymentwatcher/deployment_watcher.go | 2 +- nomad/structs/structs.go | 14 +++++++------- nomad/structs/structs_test.go | 6 +++--- plugins/shared/cmd/launcher/command/device.go | 8 ++++---- scheduler/generic_sched_test.go | 17 ++++++++++++----- 9 files changed, 39 insertions(+), 32 deletions(-) diff --git a/api/operator_autopilot.go b/api/operator_autopilot.go index c6e7e4bb4..fd06bd4c7 100644 --- a/api/operator_autopilot.go +++ b/api/operator_autopilot.go @@ -59,7 +59,7 @@ func (u *AutopilotConfiguration) MarshalJSON() ([]byte, error) { }{ LastContactThreshold: u.LastContactThreshold.String(), ServerStabilizationTime: u.ServerStabilizationTime.String(), - Alias: (*Alias)(u), + Alias: (*Alias)(u), }) } diff --git a/client/driver/docker_test.go b/client/driver/docker_test.go index 207bbc1fc..2b1d7c46f 100644 --- a/client/driver/docker_test.go +++ b/client/driver/docker_test.go @@ -2472,10 +2472,10 @@ func TestDockerDriver_AdvertiseIPv6Address(t *testing.T) { Name: "nc-demo", Driver: "docker", Config: map[string]interface{}{ - "image": "busybox", - "load": "busybox.tar", - "command": "/bin/nc", - "args": []string{"-l", "127.0.0.1", "-p", "0"}, + "image": "busybox", + "load": "busybox.tar", + "command": "/bin/nc", + "args": []string{"-l", "127.0.0.1", "-p", "0"}, "advertise_ipv6_address": expectedAdvertise, }, Resources: &structs.Resources{ diff --git a/command/agent/config_parse_test.go b/command/agent/config_parse_test.go index 43638befd..5dfb03e7f 100644 --- a/command/agent/config_parse_test.go +++ b/command/agent/config_parse_test.go @@ -264,11 +264,11 @@ func TestConfig_Parse(t *testing.T) { SyslogFacility: "", DisableUpdateCheck: nil, DisableAnonymousSignature: false, - Consul: nil, - Vault: nil, - TLSConfig: nil, - HTTPAPIResponseHeaders: nil, - Sentinel: nil, + Consul: nil, + Vault: nil, + TLSConfig: nil, + HTTPAPIResponseHeaders: nil, + Sentinel: nil, }, false, }, diff --git a/helper/tlsutil/config_test.go b/helper/tlsutil/config_test.go index 992af302b..249b6470e 100644 --- a/helper/tlsutil/config_test.go +++ b/helper/tlsutil/config_test.go @@ -310,8 +310,8 @@ func TestConfig_OutgoingTLS_PreferServerCipherSuites(t *testing.T) { } { conf := &Config{ - VerifyOutgoing: true, - CAFile: cacert, + VerifyOutgoing: true, + CAFile: cacert, PreferServerCipherSuites: true, } tlsConfig, err := conf.OutgoingTLSConfig() diff --git a/nomad/deploymentwatcher/deployment_watcher.go b/nomad/deploymentwatcher/deployment_watcher.go index f8c9e3247..7550b5a94 100644 --- a/nomad/deploymentwatcher/deployment_watcher.go +++ b/nomad/deploymentwatcher/deployment_watcher.go @@ -251,7 +251,7 @@ func (w *deploymentWatcher) PromoteDeployment( // Create the request areq := &structs.ApplyDeploymentPromoteRequest{ DeploymentPromoteRequest: *req, - Eval: w.getEval(), + Eval: w.getEval(), } index, err := w.upsertDeploymentPromotion(areq) diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index 969f11338..808a331b8 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -1566,13 +1566,13 @@ func (n *Node) Stub() *NodeListStub { addr, _, _ := net.SplitHostPort(n.HTTPAddr) return &NodeListStub{ - Address: addr, - ID: n.ID, - Datacenter: n.Datacenter, - Name: n.Name, - NodeClass: n.NodeClass, - Version: n.Attributes["nomad.version"], - Drain: n.Drain, + Address: addr, + ID: n.ID, + Datacenter: n.Datacenter, + Name: n.Name, + NodeClass: n.NodeClass, + Version: n.Attributes["nomad.version"], + Drain: n.Drain, SchedulingEligibility: n.SchedulingEligibility, Status: n.Status, StatusDescription: n.StatusDescription, diff --git a/nomad/structs/structs_test.go b/nomad/structs/structs_test.go index 391a73f13..0fc6e3744 100644 --- a/nomad/structs/structs_test.go +++ b/nomad/structs/structs_test.go @@ -2745,7 +2745,7 @@ func TestAllocation_LastEventTime(t *testing.T) { testCases := []testCase{ { - desc: "nil task state", + desc: "nil task state", expectedLastEventTime: t1, }, { @@ -2813,7 +2813,7 @@ func TestAllocation_NextDelay(t *testing.T) { DelayFunction: "constant", Delay: 5 * time.Second, }, - alloc: &Allocation{}, + alloc: &Allocation{}, expectedRescheduleTime: time.Time{}, expectedRescheduleEligible: false, }, @@ -2824,7 +2824,7 @@ func TestAllocation_NextDelay(t *testing.T) { Delay: 5 * time.Second, Unlimited: true, }, - alloc: &Allocation{ClientStatus: AllocClientStatusFailed, ModifyTime: now.UnixNano()}, + alloc: &Allocation{ClientStatus: AllocClientStatusFailed, ModifyTime: now.UnixNano()}, expectedRescheduleTime: now.UTC().Add(5 * time.Second), expectedRescheduleEligible: true, }, diff --git a/plugins/shared/cmd/launcher/command/device.go b/plugins/shared/cmd/launcher/command/device.go index 1f276c125..9e58f1c91 100644 --- a/plugins/shared/cmd/launcher/command/device.go +++ b/plugins/shared/cmd/launcher/command/device.go @@ -264,10 +264,10 @@ func (c *Device) startRepl() error { for { in, err := c.Ui.Ask("> ") if err != nil { - if fingerprintCancel != nil { + if fingerprintCancel != nil { fingerprintCancel() } - if statsCancel != nil { + if statsCancel != nil { statsCancel() } return err @@ -275,10 +275,10 @@ func (c *Device) startRepl() error { switch { case in == "exit()": - if fingerprintCancel != nil { + if fingerprintCancel != nil { fingerprintCancel() } - if statsCancel != nil { + if statsCancel != nil { statsCancel() } return nil diff --git a/scheduler/generic_sched_test.go b/scheduler/generic_sched_test.go index d72241784..41cd741f5 100644 --- a/scheduler/generic_sched_test.go +++ b/scheduler/generic_sched_test.go @@ -4189,11 +4189,18 @@ func Test_updateRescheduleTracker(t *testing.T) { testCases := []testCase{ { - desc: "No past events", - prevAllocEvents: nil, - reschedPolicy: &structs.ReschedulePolicy{Unlimited: false, Interval: 24 * time.Hour, Attempts: 2, Delay: 5 * time.Second}, - reschedTime: t1, - expectedRescheduleEvents: []*structs.RescheduleEvent{{t1.UnixNano(), prevAlloc.ID, prevAlloc.NodeID, 5 * time.Second}}, + desc: "No past events", + prevAllocEvents: nil, + reschedPolicy: &structs.ReschedulePolicy{Unlimited: false, Interval: 24 * time.Hour, Attempts: 2, Delay: 5 * time.Second}, + reschedTime: t1, + expectedRescheduleEvents: []*structs.RescheduleEvent{ + { + RescheduleTime: t1.UnixNano(), + PrevAllocID: prevAlloc.ID, + PrevNodeID: prevAlloc.NodeID, + Delay: 5 * time.Second, + }, + }, }, { desc: "one past event, linear delay",