Merge pull request #4642 from hashicorp/b-vet
Fix vet errors and use newer go version in travis
This commit is contained in:
commit
cc92cd92cd
|
@ -4,7 +4,7 @@ services:
|
|||
language: go
|
||||
|
||||
go:
|
||||
- "1.10.2"
|
||||
- "1.x"
|
||||
|
||||
addons:
|
||||
chrome: stable
|
||||
|
|
|
@ -59,7 +59,7 @@ func (u *AutopilotConfiguration) MarshalJSON() ([]byte, error) {
|
|||
}{
|
||||
LastContactThreshold: u.LastContactThreshold.String(),
|
||||
ServerStabilizationTime: u.ServerStabilizationTime.String(),
|
||||
Alias: (*Alias)(u),
|
||||
Alias: (*Alias)(u),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1575,13 +1575,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,
|
||||
|
|
|
@ -2869,7 +2869,7 @@ func TestAllocation_LastEventTime(t *testing.T) {
|
|||
|
||||
testCases := []testCase{
|
||||
{
|
||||
desc: "nil task state",
|
||||
desc: "nil task state",
|
||||
expectedLastEventTime: t1,
|
||||
},
|
||||
{
|
||||
|
@ -2937,7 +2937,7 @@ func TestAllocation_NextDelay(t *testing.T) {
|
|||
DelayFunction: "constant",
|
||||
Delay: 5 * time.Second,
|
||||
},
|
||||
alloc: &Allocation{},
|
||||
alloc: &Allocation{},
|
||||
expectedRescheduleTime: time.Time{},
|
||||
expectedRescheduleEligible: false,
|
||||
},
|
||||
|
@ -2948,7 +2948,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,
|
||||
},
|
||||
|
|
|
@ -260,14 +260,27 @@ func (c *Device) startRepl() error {
|
|||
c.Ui.Output("> Availabile commands are: exit(), fingerprint(), stop_fingerprint(), stats(), stop_stats(), reserve(id1, id2, ...)")
|
||||
var fingerprintCtx, statsCtx context.Context
|
||||
var fingerprintCancel, statsCancel context.CancelFunc
|
||||
|
||||
for {
|
||||
in, err := c.Ui.Ask("> ")
|
||||
if err != nil {
|
||||
if fingerprintCancel != nil {
|
||||
fingerprintCancel()
|
||||
}
|
||||
if statsCancel != nil {
|
||||
statsCancel()
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
switch {
|
||||
case in == "exit()":
|
||||
if fingerprintCancel != nil {
|
||||
fingerprintCancel()
|
||||
}
|
||||
if statsCancel != nil {
|
||||
statsCancel()
|
||||
}
|
||||
return nil
|
||||
case in == "fingerprint()":
|
||||
if fingerprintCtx != nil {
|
||||
|
@ -301,8 +314,6 @@ func (c *Device) startRepl() error {
|
|||
c.Ui.Error(fmt.Sprintf("> Unknown command %q", in))
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Device) replOutput(ctx context.Context, startFingerprint, startStats <-chan context.Context, reserve <-chan []string) {
|
||||
|
|
|
@ -4357,11 +4357,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",
|
||||
|
|
Loading…
Reference in New Issue