Allow users to define what extensions CA certs will have. Skip any files that don't have the right extension.

This commit is contained in:
Renan DelValle 2020-02-24 16:12:56 -08:00
parent 3fa2a20fe4
commit 6cdcbcb5db
No known key found for this signature in database
GPG key ID: C240AD6D6F443EC9
3 changed files with 67 additions and 21 deletions

View file

@ -100,3 +100,15 @@ func TestCurrentBatchCalculator(t *testing.T) {
assert.Equal(t, 0, curBatch)
})
}
func TestCertPoolCreator(t *testing.T) {
extensions := map[string]struct{}{"key": {}, "pem": {}, "crt": {}}
_, err := createCertPool("examples/certs", extensions)
assert.NoError(t, err)
t.Run("badDir", func(t *testing.T) {
_, err := createCertPool("idontexist", extensions)
assert.Error(t, err)
})
}