Allow users to define what extensions CA certs will have (#120)

* 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:
Renán I. Del Valle 2020-02-26 08:24:41 -08:00 committed by GitHub
parent 3dc3b09a8e
commit ea8e48f3b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 75 additions and 22 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{}{".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)
})
}