Fix make check errors

This commit is contained in:
Alex Dadgar 2018-09-04 16:03:52 -07:00
parent 2c2a8322b5
commit c6576ddac1
9 changed files with 39 additions and 32 deletions

View File

@ -59,7 +59,7 @@ func (u *AutopilotConfiguration) MarshalJSON() ([]byte, error) {
}{ }{
LastContactThreshold: u.LastContactThreshold.String(), LastContactThreshold: u.LastContactThreshold.String(),
ServerStabilizationTime: u.ServerStabilizationTime.String(), ServerStabilizationTime: u.ServerStabilizationTime.String(),
Alias: (*Alias)(u), Alias: (*Alias)(u),
}) })
} }

View File

@ -2472,10 +2472,10 @@ func TestDockerDriver_AdvertiseIPv6Address(t *testing.T) {
Name: "nc-demo", Name: "nc-demo",
Driver: "docker", Driver: "docker",
Config: map[string]interface{}{ Config: map[string]interface{}{
"image": "busybox", "image": "busybox",
"load": "busybox.tar", "load": "busybox.tar",
"command": "/bin/nc", "command": "/bin/nc",
"args": []string{"-l", "127.0.0.1", "-p", "0"}, "args": []string{"-l", "127.0.0.1", "-p", "0"},
"advertise_ipv6_address": expectedAdvertise, "advertise_ipv6_address": expectedAdvertise,
}, },
Resources: &structs.Resources{ Resources: &structs.Resources{

View File

@ -264,11 +264,11 @@ func TestConfig_Parse(t *testing.T) {
SyslogFacility: "", SyslogFacility: "",
DisableUpdateCheck: nil, DisableUpdateCheck: nil,
DisableAnonymousSignature: false, DisableAnonymousSignature: false,
Consul: nil, Consul: nil,
Vault: nil, Vault: nil,
TLSConfig: nil, TLSConfig: nil,
HTTPAPIResponseHeaders: nil, HTTPAPIResponseHeaders: nil,
Sentinel: nil, Sentinel: nil,
}, },
false, false,
}, },

View File

@ -310,8 +310,8 @@ func TestConfig_OutgoingTLS_PreferServerCipherSuites(t *testing.T) {
} }
{ {
conf := &Config{ conf := &Config{
VerifyOutgoing: true, VerifyOutgoing: true,
CAFile: cacert, CAFile: cacert,
PreferServerCipherSuites: true, PreferServerCipherSuites: true,
} }
tlsConfig, err := conf.OutgoingTLSConfig() tlsConfig, err := conf.OutgoingTLSConfig()

View File

@ -251,7 +251,7 @@ func (w *deploymentWatcher) PromoteDeployment(
// Create the request // Create the request
areq := &structs.ApplyDeploymentPromoteRequest{ areq := &structs.ApplyDeploymentPromoteRequest{
DeploymentPromoteRequest: *req, DeploymentPromoteRequest: *req,
Eval: w.getEval(), Eval: w.getEval(),
} }
index, err := w.upsertDeploymentPromotion(areq) index, err := w.upsertDeploymentPromotion(areq)

View File

@ -1566,13 +1566,13 @@ func (n *Node) Stub() *NodeListStub {
addr, _, _ := net.SplitHostPort(n.HTTPAddr) addr, _, _ := net.SplitHostPort(n.HTTPAddr)
return &NodeListStub{ return &NodeListStub{
Address: addr, Address: addr,
ID: n.ID, ID: n.ID,
Datacenter: n.Datacenter, Datacenter: n.Datacenter,
Name: n.Name, Name: n.Name,
NodeClass: n.NodeClass, NodeClass: n.NodeClass,
Version: n.Attributes["nomad.version"], Version: n.Attributes["nomad.version"],
Drain: n.Drain, Drain: n.Drain,
SchedulingEligibility: n.SchedulingEligibility, SchedulingEligibility: n.SchedulingEligibility,
Status: n.Status, Status: n.Status,
StatusDescription: n.StatusDescription, StatusDescription: n.StatusDescription,

View File

@ -2745,7 +2745,7 @@ func TestAllocation_LastEventTime(t *testing.T) {
testCases := []testCase{ testCases := []testCase{
{ {
desc: "nil task state", desc: "nil task state",
expectedLastEventTime: t1, expectedLastEventTime: t1,
}, },
{ {
@ -2813,7 +2813,7 @@ func TestAllocation_NextDelay(t *testing.T) {
DelayFunction: "constant", DelayFunction: "constant",
Delay: 5 * time.Second, Delay: 5 * time.Second,
}, },
alloc: &Allocation{}, alloc: &Allocation{},
expectedRescheduleTime: time.Time{}, expectedRescheduleTime: time.Time{},
expectedRescheduleEligible: false, expectedRescheduleEligible: false,
}, },
@ -2824,7 +2824,7 @@ func TestAllocation_NextDelay(t *testing.T) {
Delay: 5 * time.Second, Delay: 5 * time.Second,
Unlimited: true, Unlimited: true,
}, },
alloc: &Allocation{ClientStatus: AllocClientStatusFailed, ModifyTime: now.UnixNano()}, alloc: &Allocation{ClientStatus: AllocClientStatusFailed, ModifyTime: now.UnixNano()},
expectedRescheduleTime: now.UTC().Add(5 * time.Second), expectedRescheduleTime: now.UTC().Add(5 * time.Second),
expectedRescheduleEligible: true, expectedRescheduleEligible: true,
}, },

View File

@ -264,10 +264,10 @@ func (c *Device) startRepl() error {
for { for {
in, err := c.Ui.Ask("> ") in, err := c.Ui.Ask("> ")
if err != nil { if err != nil {
if fingerprintCancel != nil { if fingerprintCancel != nil {
fingerprintCancel() fingerprintCancel()
} }
if statsCancel != nil { if statsCancel != nil {
statsCancel() statsCancel()
} }
return err return err
@ -275,10 +275,10 @@ func (c *Device) startRepl() error {
switch { switch {
case in == "exit()": case in == "exit()":
if fingerprintCancel != nil { if fingerprintCancel != nil {
fingerprintCancel() fingerprintCancel()
} }
if statsCancel != nil { if statsCancel != nil {
statsCancel() statsCancel()
} }
return nil return nil

View File

@ -4189,11 +4189,18 @@ func Test_updateRescheduleTracker(t *testing.T) {
testCases := []testCase{ testCases := []testCase{
{ {
desc: "No past events", desc: "No past events",
prevAllocEvents: nil, prevAllocEvents: nil,
reschedPolicy: &structs.ReschedulePolicy{Unlimited: false, Interval: 24 * time.Hour, Attempts: 2, Delay: 5 * time.Second}, reschedPolicy: &structs.ReschedulePolicy{Unlimited: false, Interval: 24 * time.Hour, Attempts: 2, Delay: 5 * time.Second},
reschedTime: t1, reschedTime: t1,
expectedRescheduleEvents: []*structs.RescheduleEvent{{t1.UnixNano(), prevAlloc.ID, prevAlloc.NodeID, 5 * time.Second}}, expectedRescheduleEvents: []*structs.RescheduleEvent{
{
RescheduleTime: t1.UnixNano(),
PrevAllocID: prevAlloc.ID,
PrevNodeID: prevAlloc.NodeID,
Delay: 5 * time.Second,
},
},
}, },
{ {
desc: "one past event, linear delay", desc: "one past event, linear delay",