Skip to content

Commit

Permalink
Merge pull request hashicorp#4642 from hashicorp/b-vet
Browse files Browse the repository at this point in the history
Fix vet errors and use newer go version in travis
  • Loading branch information
dadgar authored Sep 5, 2018
2 parents c9b7116 + 786f190 commit a5a26db
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
language: go

go:
- "1.10.2"
- "1.x"

addons:
chrome: stable
Expand Down
2 changes: 1 addition & 1 deletion api/operator_autopilot.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (u *AutopilotConfiguration) MarshalJSON() ([]byte, error) {
}{
LastContactThreshold: u.LastContactThreshold.String(),
ServerStabilizationTime: u.ServerStabilizationTime.String(),
Alias: (*Alias)(u),
Alias: (*Alias)(u),
})
}

Expand Down
8 changes: 4 additions & 4 deletions client/driver/docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
10 changes: 5 additions & 5 deletions command/agent/config_parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
4 changes: 2 additions & 2 deletions helper/tlsutil/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion nomad/deploymentwatcher/deployment_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 7 additions & 7 deletions nomad/structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions nomad/structs/structs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2869,7 +2869,7 @@ func TestAllocation_LastEventTime(t *testing.T) {

testCases := []testCase{
{
desc: "nil task state",
desc: "nil task state",
expectedLastEventTime: t1,
},
{
Expand Down Expand Up @@ -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,
},
Expand All @@ -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,
},
Expand Down
15 changes: 13 additions & 2 deletions plugins/shared/cmd/launcher/command/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down
17 changes: 12 additions & 5 deletions scheduler/generic_sched_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit a5a26db

Please sign in to comment.