Skip to content

Commit 4b1860b

Browse files
committed
test: client returns correct error on unavailable engine
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
1 parent 43c1c5f commit 4b1860b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

client/client_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,23 @@ func Test_ListPlugins(t *testing.T) {
154154
}, result)
155155
})
156156
}
157+
158+
func TestSecretsEngineUnavailable(t *testing.T) {
159+
socketPath := testhelper.RandomShortSocketName()
160+
client, err := New(WithSocketPath(socketPath))
161+
require.NoError(t, err)
162+
_, err = client.ListPlugins(t.Context())
163+
require.ErrorIs(t, err, ErrSecretsEngineNotAvailable)
164+
_, err = client.GetSecrets(t.Context(), secrets.MustParsePattern("**"))
165+
require.ErrorIs(t, err, ErrSecretsEngineNotAvailable)
166+
}
167+
168+
func TestIsDialError(t *testing.T) {
169+
require.True(t, isDialError(&net.OpError{
170+
Op: "dial",
171+
}))
172+
require.True(t, isDialError(&net.OpError{
173+
Op: "connect",
174+
}))
175+
require.False(t, isDialError(nil))
176+
}

0 commit comments

Comments
 (0)