diff --git a/Gopkg.lock b/Gopkg.lock index 914577a..f92817e 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -140,6 +140,22 @@ revision = "b65e62901fc1c0d968042419e74789f6af455eb9" version = "v1.4.2" +[[projects]] + digest = "1:eaed935e3637c60ad9897e54ab3419c18b91775d6e3af339dec54aeefb48b8d6" + name = "github.com/hashicorp/errwrap" + packages = ["."] + pruneopts = "" + revision = "7b00e5db719c64d14dd0caaacbd13e76254d02c0" + version = "v1.1.0" + +[[projects]] + digest = "1:c6e569ffa34fcd24febd3562bff0520a104d15d1a600199cb3141debf2e58c89" + name = "github.com/hashicorp/go-multierror" + packages = ["."] + pruneopts = "" + revision = "2004d9dba6b07a5b8d133209244f376680f9d472" + version = "v1.1.0" + [[projects]] digest = "1:2f0c811248aeb64978037b357178b1593372439146bda860cb16f2c80785ea93" name = "github.com/hashicorp/go-version" @@ -366,6 +382,7 @@ "github.com/google/renameio", "github.com/gorilla/mux", "github.com/gorilla/websocket", + "github.com/hashicorp/go-multierror", "github.com/hashicorp/go-version", "github.com/seehuhn/fortuna", "github.com/shirou/gopsutil/host", diff --git a/runtime/registry.go b/runtime/registry.go index 83d17d0..2b7bd31 100644 --- a/runtime/registry.go +++ b/runtime/registry.go @@ -147,7 +147,7 @@ func (r *Registry) Register(keyOrPrefix string, p ValueProvider) (PushFunc, erro func (r *Registry) Get(key string) (record.Record, error) { provider := r.getMatchingProvider(key) if provider == nil { - return nil, nil + return nil, database.ErrNotFound } records, err := provider.Get(key) diff --git a/runtime/registry_test.go b/runtime/registry_test.go index 61343da..fe8b8a6 100644 --- a/runtime/registry_test.go +++ b/runtime/registry_test.go @@ -89,11 +89,11 @@ func TestRegistryGet(t *testing.T) { assert.Equal(t, "p1.3", r.(*testRecord).Value) r, err = reg.Get("p1/v4") - require.NoError(t, err) + require.Error(t, err) assert.Nil(t, r) r, err = reg.Get("no-provider/foo") - require.NoError(t, err) + require.Error(t, err) assert.Nil(t, r) } diff --git a/utils/osdetail/errors.go b/utils/osdetail/errors.go index 367e922..b79ce11 100644 --- a/utils/osdetail/errors.go +++ b/utils/osdetail/errors.go @@ -3,7 +3,10 @@ package osdetail import "errors" var ( + // ErrNotSupported is returned when an operation is not supported on the current platform. ErrNotSupported = errors.New("not supported") - ErrNotFound = errors.New("not found") - ErrEmptyOutput = errors.New("command succeeded with empty output") + // ErrNotFound is returned when the desired data is not found. + ErrNotFound = errors.New("not found") + // ErrEmptyOutput is a special error that is returned when an operation has no error, but also returns to data. + ErrEmptyOutput = errors.New("command succeeded with empty output") ) diff --git a/utils/osdetail/test/.gitignore b/utils/osdetail/test/.gitignore new file mode 100644 index 0000000..35ccb46 --- /dev/null +++ b/utils/osdetail/test/.gitignore @@ -0,0 +1,2 @@ +test +test.exe diff --git a/utils/osdetail/test/test.exe b/utils/osdetail/test/test.exe deleted file mode 100755 index bcc3fe5..0000000 Binary files a/utils/osdetail/test/test.exe and /dev/null differ