From d42796378487ff0e8ace87ed76ffdd63ecd7b949 Mon Sep 17 00:00:00 2001 From: Avinash Sridharan Date: Tue, 4 Apr 2017 16:49:48 +0000 Subject: [PATCH] libcni: Fixed tests that were checking error strings. Checking error strings makes these tests flaky, especially if the error string is changed in libcni. Have gone ahead an introduced a new error type `NoConfigsFoundError` and the Match is against the error type making it more deterministic. --- libcni/conf_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libcni/conf_test.go b/libcni/conf_test.go index b9bd64ef..40e0ca02 100644 --- a/libcni/conf_test.go +++ b/libcni/conf_test.go @@ -61,7 +61,7 @@ var _ = Describe("Loading configuration from disk", func() { It("returns a useful error", func() { _, err := libcni.LoadConf(configDir, "some-plugin") - Expect(err).To(MatchError("no net configurations found")) + Expect(err).To(MatchError(libcni.NoConfigsFoundError{Dir: configDir})) }) }) @@ -244,7 +244,7 @@ var _ = Describe("Loading configuration from disk", func() { It("returns a useful error", func() { _, err := libcni.LoadConfList(configDir, "some-plugin") - Expect(err).To(MatchError("no net configurations found")) + Expect(err).To(MatchError(libcni.NoConfigsFoundError{Dir: configDir})) }) })