Commit 3e241b1f authored by Geoff Simmons's avatar Geoff Simmons

Test nil checks for GetMgmtAddr() and GetSecretPath().

parent b2a13a2f
...@@ -237,6 +237,15 @@ func TestGet(t *testing.T) { ...@@ -237,6 +237,15 @@ func TestGet(t *testing.T) {
if foobar != "" { if foobar != "" {
t.Error("Expected empty string for Get(foo, bar), got:", foobar) t.Error("Expected empty string for Get(foo, bar), got:", foobar)
} }
var n *VSM
if _, err = n.Get("foo", "bar"); err == nil {
t.Error("expected nil.Get() to fail")
}
uninit := new(VSM)
if _, err = uninit.Get("foo", "bar"); err == nil {
t.Error("expected uninitialized.Status() to fail")
}
} }
func TestGetMgmtAddr(t *testing.T) { func TestGetMgmtAddr(t *testing.T) {
...@@ -259,6 +268,15 @@ func TestGetMgmtAddr(t *testing.T) { ...@@ -259,6 +268,15 @@ func TestGetMgmtAddr(t *testing.T) {
if addr == "" { if addr == "" {
t.Error("Got empty string for GetMgmtAddr()") t.Error("Got empty string for GetMgmtAddr()")
} }
var n *VSM
if _, err = n.GetMgmtAddr(); err == nil {
t.Error("expected nil.GetMgmtAddr() to fail")
}
uninit := new(VSM)
if _, err = uninit.GetMgmtAddr(); err == nil {
t.Error("expected uninitialized.GetMgmtAddr() to fail")
}
} }
func TestGetSecretPath(t *testing.T) { func TestGetSecretPath(t *testing.T) {
...@@ -281,4 +299,13 @@ func TestGetSecretPath(t *testing.T) { ...@@ -281,4 +299,13 @@ func TestGetSecretPath(t *testing.T) {
if path == "" { if path == "" {
t.Error("Got empty string for GetSecretPath()") t.Error("Got empty string for GetSecretPath()")
} }
var n *VSM
if _, err = n.GetSecretPath(); err == nil {
t.Error("expected nil.GetSecretPath() to fail")
}
uninit := new(VSM)
if _, err = uninit.GetSecretPath(); err == nil {
t.Error("expected uninitialized.GetSecretPath() to fail")
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment