Skip to content

Commit

Permalink
chore: Bump all deps
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Castell committed Mar 12, 2020
1 parent 007912d commit 0bc5c32
Show file tree
Hide file tree
Showing 9 changed files with 336 additions and 61 deletions.
3 changes: 1 addition & 2 deletions builtin/bins/dkron-executor-shell/shell_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ func Test_buildCmd(t *testing.T) {
// test not shell command
cmd, err = buildCmd("date && echo 'success'", false, []string{}, "")
assert.NoError(t, err)
out, err = cmd.CombinedOutput()
assert.Error(t, err)
assert.Len(t, cmd.Args, 1)
}

func Test_buildCmdWithCustomEnvironmentVariables(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (p *Plugins) pluginFactory(path string, pluginType string) (interface{}, er
config.Plugins = dkplugin.PluginMap
config.SyncStdout = os.Stdout
config.SyncStderr = os.Stderr
config.Logger = &dkron.HCLogAdapter{Log: dkron.InitLogger(p.LogLevel, p.NodeName), Name: "plugins"}
config.Logger = &dkron.HCLogAdapter{Logger: dkron.InitLogger(p.LogLevel, p.NodeName), LoggerName: "plugins"}

switch pluginType {
case dkplugin.ProcessorPluginName:
Expand Down
43 changes: 32 additions & 11 deletions dkron/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ func TestAgentCommand_runForElection(t *testing.T) {

a1Name := "test1"
a2Name := "test2"
a1Addr := testutil.GetBindAddr().String()
a2Addr := testutil.GetBindAddr().String()
ip1, returnFn1 := testutil.TakeIP()
a1Addr := ip1.String()
defer returnFn1()
ip2, returnFn2 := testutil.TakeIP()
a2Addr := ip2.String()
defer returnFn2()

shutdownCh := make(chan struct{})
defer close(shutdownCh)
Expand Down Expand Up @@ -72,7 +76,9 @@ func TestAgentCommand_runForElection(t *testing.T) {

// Start another agent
c = DefaultConfig()
c.BindAddr = testutil.GetBindAddr().String()
ip3, returnFn3 := testutil.TakeIP()
defer returnFn3()
c.BindAddr = ip3.String()
c.StartJoin = []string{a1Addr + ":8946"}
c.NodeName = "test3"
c.Server = true
Expand Down Expand Up @@ -103,8 +109,13 @@ func Test_processFilteredNodes(t *testing.T) {
require.NoError(t, err)
defer os.RemoveAll(dir)

a1Addr := testutil.GetBindAddr().String()
a2Addr := testutil.GetBindAddr().String()
ip1, returnFn1 := testutil.TakeIP()
defer returnFn1()
a1Addr := ip1.String()

ip2, returnFn2 := testutil.TakeIP()
defer returnFn2()
a2Addr := ip2.String()

c := DefaultConfig()
c.BindAddr = a1Addr
Expand Down Expand Up @@ -166,8 +177,11 @@ func TestEncrypt(t *testing.T) {
require.NoError(t, err)
defer os.RemoveAll(dir)

ip1, returnFn1 := testutil.TakeIP()
defer returnFn1()

c := DefaultConfig()
c.BindAddr = testutil.GetBindAddr().String()
c.BindAddr = ip1.String()
c.NodeName = "test1"
c.Server = true
c.Tags = map[string]string{"role": "test"}
Expand All @@ -190,10 +204,12 @@ func Test_getRPCAddr(t *testing.T) {
require.NoError(t, err)
defer os.RemoveAll(dir)

a1Addr := testutil.GetBindAddr()
ip1, returnFn1 := testutil.TakeIP()
defer returnFn1()
a1Addr := ip1.String()

c := DefaultConfig()
c.BindAddr = a1Addr.String() + ":5000"
c.BindAddr = a1Addr + ":5000"
c.NodeName = "test1"
c.Server = true
c.Tags = map[string]string{"role": "test"}
Expand All @@ -207,7 +223,7 @@ func Test_getRPCAddr(t *testing.T) {
time.Sleep(2 * time.Second)

getRPCAddr := a.getRPCAddr()
exRPCAddr := a1Addr.String() + ":6868"
exRPCAddr := a1Addr + ":6868"

assert.Equal(t, exRPCAddr, getRPCAddr)
a.Stop()
Expand All @@ -218,10 +234,15 @@ func TestAgentConfig(t *testing.T) {
require.NoError(t, err)
defer os.RemoveAll(dir)

advAddr := testutil.GetBindAddr().String()
ip1, returnFn1 := testutil.TakeIP()
defer returnFn1()
advAddr := ip1.String()

ip2, returnFn2 := testutil.TakeIP()
defer returnFn2()

c := DefaultConfig()
c.BindAddr = testutil.GetBindAddr().String()
c.BindAddr = ip2.String()
c.AdvertiseAddr = advAddr
c.LogLevel = logLevel
c.DataDir = dir
Expand Down
5 changes: 4 additions & 1 deletion dkron/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ func setupAPITest(t *testing.T, port string) (dir string, a *Agent) {
dir, err := ioutil.TempDir("", "dkron-test")
require.NoError(t, err)

ip1, returnFn1 := testutil.TakeIP()
defer returnFn1()

c := DefaultConfig()
c.BindAddr = testutil.GetBindAddr().String()
c.BindAddr = ip1.String()
c.HTTPAddr = fmt.Sprintf("127.0.0.1:%s", port)
c.NodeName = "test"
c.Server = true
Expand Down
4 changes: 3 additions & 1 deletion dkron/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ func TestGRPCExecutionDone(t *testing.T) {

viper.Reset()

aAddr := testutil.GetBindAddr().String()
ip1, returnFn1 := testutil.TakeIP()
defer returnFn1()
aAddr := ip1.String()

c := DefaultConfig()
c.BindAddr = aAddr
Expand Down
32 changes: 23 additions & 9 deletions dkron/hclog_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ import (
// HCLogAdapter implements the hclog interface, and wraps it
// around a Logrus entry
type HCLogAdapter struct {
Log logrus.FieldLogger
Name string
Logger logrus.FieldLogger
LoggerName string
}

// Log Emit a message and key/value pairs at a provided log level
func (*HCLogAdapter) Log(level hclog.Level, msg string, args ...interface{}) {
}

// Trace HCLog has one more level than we do. As such, we will never
Expand Down Expand Up @@ -77,14 +81,19 @@ func (a *HCLogAdapter) SetLevel(hclog.Level) {
// With returns a new instance with the specified options
func (a *HCLogAdapter) With(args ...interface{}) hclog.Logger {
e := a.CreateEntry(args)
return &HCLogAdapter{Log: e}
return &HCLogAdapter{Logger: e}
}

// Name returns the Name of the logger
func (a *HCLogAdapter) Name() string {
return a.LoggerName
}

// Named returns a named logger
func (a *HCLogAdapter) Named(name string) hclog.Logger {
var newName bytes.Buffer
if a.Name != "" {
newName.WriteString(a.Name)
if a.LoggerName != "" {
newName.WriteString(a.Name())
newName.WriteString(".")
}
newName.WriteString(name)
Expand All @@ -96,7 +105,7 @@ func (a *HCLogAdapter) Named(name string) hclog.Logger {
func (a *HCLogAdapter) ResetNamed(name string) hclog.Logger {
fields := []interface{}{"subsystem_name", name}
e := a.CreateEntry(fields)
return &HCLogAdapter{Log: e, Name: name}
return &HCLogAdapter{Logger: e, LoggerName: name}
}

// StandardWriter return a value that conforms to io.Writer, which can be passed into log.SetOutput()
Expand All @@ -115,12 +124,12 @@ func (a *HCLogAdapter) StandardWriter(opts *hclog.StandardLoggerOptions) io.Writ
//
// Apologies to those who find themselves here.
func (a *HCLogAdapter) StandardLogger(opts *hclog.StandardLoggerOptions) *golog.Logger {
entry := a.Log.WithFields(logrus.Fields{})
entry := a.Logger.WithFields(logrus.Fields{})
return golog.New(entry.WriterLevel(logrus.InfoLevel), "", 0)
}

func (a *HCLogAdapter) shouldEmit(level logrus.Level) bool {
currentLevel := a.Log.WithFields(logrus.Fields{}).Level
currentLevel := a.Logger.WithFields(logrus.Fields{}).Level
if currentLevel >= level {
return true
}
Expand All @@ -143,5 +152,10 @@ func (a *HCLogAdapter) CreateEntry(args []interface{}) *logrus.Entry {
fields[k] = v
}

return a.Log.WithFields(fields)
return a.Logger.WithFields(fields)
}

// ImpliedArgs returns With key/value pairs
func (a *HCLogAdapter) ImpliedArgs() []interface{} {
return nil
}
4 changes: 3 additions & 1 deletion dkron/queries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ func TestRunQuery(t *testing.T) {
require.NoError(t, err)
defer os.RemoveAll(dir)

advAddr := testutil.GetBindAddr().String()
ip1, returnFn1 := testutil.TakeIP()
defer returnFn1()
advAddr := ip1.String()

c := DefaultConfig()
c.BindAddr = advAddr + ":5000"
Expand Down
64 changes: 29 additions & 35 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,53 +1,47 @@
module github.com/distribworks/dkron/v2

require (
github.com/DataDog/datadog-go v0.0.0-20170427165718-0ddda6bee211 // indirect
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da
github.com/aws/aws-sdk-go v1.16.23 // indirect
github.com/boltdb/bolt v1.3.1 // indirect
github.com/dgraph-io/badger/v2 v2.0.1
github.com/dnaeon/go-vcr v1.0.1 // indirect
github.com/gin-contrib/expvar v0.0.0-20180827025536-251166f58ff2
github.com/gin-contrib/multitemplate v0.0.0-20170922032617-bbc6daf6024b
github.com/DataDog/datadog-go v3.4.1+incompatible // indirect
github.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2
github.com/armon/go-metrics v0.3.3
github.com/aws/aws-sdk-go v1.29.22 // indirect
github.com/dgraph-io/badger/v2 v2.0.2
github.com/gin-contrib/expvar v0.0.1
github.com/gin-contrib/multitemplate v0.0.0-20200226145339-3e397ee01bc6
github.com/gin-gonic/gin v1.5.0
github.com/gogo/protobuf v1.2.0 // indirect
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6
github.com/golang/protobuf v1.3.2
github.com/hashicorp/go-discover v0.0.0-20190522154730-8aba54d36e17
github.com/hashicorp/go-hclog v0.8.0
github.com/gogo/protobuf v1.3.1 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e
github.com/golang/protobuf v1.3.4
github.com/hashicorp/go-discover v0.0.0-20200108194735-7698de1390a1
github.com/hashicorp/go-hclog v0.12.1
github.com/hashicorp/go-immutable-radix v1.1.0 // indirect
github.com/hashicorp/go-plugin v1.0.1
github.com/hashicorp/go-plugin v1.1.0
github.com/hashicorp/go-sockaddr v1.0.2
github.com/hashicorp/go-syslog v1.0.0
github.com/hashicorp/go-version v1.2.0
github.com/hashicorp/golang-lru v0.5.1 // indirect
github.com/hashicorp/memberlist v0.1.3
github.com/hashicorp/raft v1.0.1
github.com/hashicorp/raft-boltdb v0.0.0-20171010151810-6e5ba93211ea
github.com/hashicorp/serf v0.8.2
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/memberlist v0.2.0
github.com/hashicorp/raft v1.1.2
github.com/hashicorp/raft-boltdb v0.0.0-20191021154308-4207f1bf0617
github.com/hashicorp/serf v0.9.0
github.com/hashicorp/yamux v0.0.0-20190923154419-df201c70410d // indirect
github.com/jordan-wright/email v0.0.0-20180115032944-94ae17dedda2
github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1
github.com/mattn/go-shellwords v0.0.0-20160315040826-525bedee691b
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0
github.com/mattn/go-shellwords v1.0.10
github.com/mitchellh/go-testing-interface v1.0.0 // indirect
github.com/pascaldekloe/goe v0.1.0 // indirect
github.com/robfig/cron/v3 v3.0.1-0.20191125210756-b7cc47d857a8
github.com/robfig/cron/v3 v3.0.1
github.com/ryanuber/columnize v2.1.0+incompatible
github.com/sirupsen/logrus v1.2.0
github.com/sirupsen/logrus v1.4.2
github.com/soheilhy/cmux v0.1.4
github.com/spf13/cobra v0.0.5
github.com/spf13/pflag v1.0.3
github.com/spf13/viper v1.3.2
github.com/stretchr/testify v1.4.0
github.com/spf13/cobra v0.0.6
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.6.2
github.com/stretchr/testify v1.5.1
golang.org/x/crypto v0.0.0-20200311171314-f7b00557c8c4 // indirect
golang.org/x/net v0.0.0-20200301022130-244492dfa37a
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 // indirect
golang.org/x/text v0.3.2 // indirect
google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107 // indirect
google.golang.org/grpc v1.19.1
gopkg.in/go-playground/validator.v8 v8.18.2 // indirect
google.golang.org/grpc v1.28.0
)

replace github.com/hashicorp/mdns => github.com/hashicorp/mdns v1.0.1

go 1.13
Loading

0 comments on commit 0bc5c32

Please sign in to comment.