-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: refactor and add unit tests to watcher (#1253)
Signed-off-by: realanna <[email protected]>
- Loading branch information
Showing
19 changed files
with
1,057 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package certificates | ||
|
||
import ( | ||
"crypto/x509" | ||
"encoding/pem" | ||
) | ||
|
||
//go:generate moq -pkg fake -skip-ensure -out ./fake/certificatehandler_mock.go . ICertificateHandler | ||
type ICertificateHandler interface { | ||
Decode(data []byte) (p *pem.Block, rest []byte) | ||
Parse(der []byte) (*x509.Certificate, error) | ||
} | ||
|
||
type defaultCertificateHandler struct { | ||
} | ||
|
||
func (c defaultCertificateHandler) Decode(data []byte) (p *pem.Block, rest []byte) { | ||
return pem.Decode(data) | ||
} | ||
func (c defaultCertificateHandler) Parse(der []byte) (*x509.Certificate, error) { | ||
return x509.ParseCertificate(der) | ||
} |
116 changes: 116 additions & 0 deletions
116
metrics-operator/cmd/certificates/fake/certificatehandler_mock.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.