Update unit tests to reflect change to func signature

This commit is contained in:
Matt Keeler 2018-05-31 17:20:16 -04:00
parent 365e8d11ee
commit f300d7bc65
3 changed files with 30 additions and 10 deletions

View File

@ -2206,3 +2206,23 @@ func TestAgent_reloadWatches(t *testing.T) {
t.Fatalf("bad: %s", err) t.Fatalf("bad: %s", err)
} }
} }
func TestAgent_reloadWatchesHTTPS(t *testing.T) {
t.Parallel()
a := TestAgent{Name: t.Name(), UseTLS: true}
a.Start()
defer a.Shutdown()
// Normal watch with http addr set, should succeed
newConf := *a.config
newConf.Watches = []map[string]interface{}{
{
"type": "key",
"key": "asdf",
"args": []interface{}{"ls"},
},
}
if err := a.reloadWatches(&newConf); err != nil {
t.Fatalf("bad: %s", err)
}
}

View File

@ -64,7 +64,7 @@ func TestKeyWatch(t *testing.T) {
wg.Add(1) wg.Add(1)
go func() { go func() {
defer wg.Done() defer wg.Done()
if err := plan.Run(a.HTTPAddr()); err != nil { if err := plan.Run(a.HTTPAddr(), nil); err != nil {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
} }
}() }()
@ -118,7 +118,7 @@ func TestKeyWatch_With_PrefixDelete(t *testing.T) {
wg.Add(1) wg.Add(1)
go func() { go func() {
defer wg.Done() defer wg.Done()
if err := plan.Run(a.HTTPAddr()); err != nil { if err := plan.Run(a.HTTPAddr(), nil); err != nil {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
} }
}() }()
@ -171,7 +171,7 @@ func TestKeyPrefixWatch(t *testing.T) {
wg.Add(1) wg.Add(1)
go func() { go func() {
defer wg.Done() defer wg.Done()
if err := plan.Run(a.HTTPAddr()); err != nil { if err := plan.Run(a.HTTPAddr(), nil); err != nil {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
} }
}() }()
@ -225,7 +225,7 @@ func TestServicesWatch(t *testing.T) {
wg.Add(1) wg.Add(1)
go func() { go func() {
defer wg.Done() defer wg.Done()
if err := plan.Run(a.HTTPAddr()); err != nil { if err := plan.Run(a.HTTPAddr(), nil); err != nil {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
} }
}() }()
@ -276,7 +276,7 @@ func TestNodesWatch(t *testing.T) {
wg.Add(1) wg.Add(1)
go func() { go func() {
defer wg.Done() defer wg.Done()
if err := plan.Run(a.HTTPAddr()); err != nil { if err := plan.Run(a.HTTPAddr(), nil); err != nil {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
} }
}() }()
@ -332,7 +332,7 @@ func TestServiceWatch(t *testing.T) {
wg.Add(1) wg.Add(1)
go func() { go func() {
defer wg.Done() defer wg.Done()
if err := plan.Run(a.HTTPAddr()); err != nil { if err := plan.Run(a.HTTPAddr(), nil); err != nil {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
} }
}() }()
@ -393,7 +393,7 @@ func TestChecksWatch_State(t *testing.T) {
wg.Add(1) wg.Add(1)
go func() { go func() {
defer wg.Done() defer wg.Done()
if err := plan.Run(a.HTTPAddr()); err != nil { if err := plan.Run(a.HTTPAddr(), nil); err != nil {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
} }
}() }()
@ -459,7 +459,7 @@ func TestChecksWatch_Service(t *testing.T) {
wg.Add(1) wg.Add(1)
go func() { go func() {
defer wg.Done() defer wg.Done()
if err := plan.Run(a.HTTPAddr()); err != nil { if err := plan.Run(a.HTTPAddr(), nil); err != nil {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
} }
}() }()
@ -510,7 +510,7 @@ func TestEventWatch(t *testing.T) {
wg.Add(1) wg.Add(1)
go func() { go func() {
defer wg.Done() defer wg.Done()
if err := plan.Run(a.HTTPAddr()); err != nil { if err := plan.Run(a.HTTPAddr(), nil); err != nil {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
} }
}() }()

View File

@ -47,7 +47,7 @@ func TestRun_Stop(t *testing.T) {
errCh := make(chan error, 1) errCh := make(chan error, 1)
go func() { go func() {
errCh <- plan.Run("127.0.0.1:8500") errCh <- plan.Run("127.0.0.1:8500", nil)
}() }()
select { select {