-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert cmd/secrets-provider
to unit testable entrypoint
package
#507
Conversation
1687247
to
bf21132
Compare
bf21132
to
2705f81
Compare
@john-odonnell are we going to make changes to make CC happy or just mark these as wontfix? |
@szh Refactored |
6b5fa38
to
90eed68
Compare
90eed68
to
8639050
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
374c7d8
to
a2f9c20
Compare
os.Exit(exitCode) | ||
} | ||
|
||
func startSecretsProviderWithDeps( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function startSecretsProviderWithDeps
has 51 lines of code (exceeds 50 allowed). Consider refactoring.
28b74e0
to
a406ee0
Compare
- Remove defaultStatusUpdater singleton in favor of NewStatusUpdater factory. - Convert RepeatableSecretsProvider, which returns a RepeatableProviderFunc, to RunSecretsProvider, which runs execution logic. - ./bin/test_unit passes all args to go test command.
a406ee0
to
2d70273
Compare
Code Climate has analyzed commit 2d70273 and detected 4 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 82.9% (50% is the threshold). This pull request will bring the total coverage in the repository to 88.2% (-1.0% change). View more on Code Climate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Truly a journey of a thousand miles, thanks for nudging the refactor effort in a good direction
bin/test_unit
Outdated
test_case_cmd="" | ||
if [[ "$test_case" != "" ]]; then | ||
test_case_cmd="--run $test_case" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thoughts on making this more open by just passing along all arguments to this test_unit ...
script to go test ...
Desired Outcome
main
package unit testable.Implemented Changes
conjur
package:SecretRetriever
structNewSecretRetriever
now returns typeRetrieveSecretsFunc
instead of structSecretRetriever
RetrieverFactory
function type, which is implemented byNewSecretRetriever()
secrets
package:ProviderFactory
function type, which is implemented byNewProviderForType()
RepeatableSecretProvider
, which returns a function that wraps a givenProviderFunc
in logic to run Secrets Provider in one of its operating modes. Now, this function is calledRunSecretsProvider
, and the logic is executed instead of returned.StatusUpdaterFactory
function typeNewStatusUpdater()
, which implementsStatusUpdaterFactory
with default values.cmd/secrets-provider/*
to newentrypoint
package.startSecretsProviderWithDeps()
:StartSecretsProvider()
, which callsstartSecretsProviderWithDeps()
with default valuesConnected Issue/Story
CNJR-84
Definition of Done
At least 1 todo must be completed in the sections below for the PR to be
merged.
Changelog
CHANGELOG update
Test coverage
changes, or
Documentation
README
s) were updated in this PRBehavior
Security