Skip to content
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

Fix auditor #193

Merged
merged 3 commits into from
Mar 10, 2020
Merged

Fix auditor #193

merged 3 commits into from
Mar 10, 2020

Conversation

listx
Copy link
Contributor

@listx listx commented Mar 9, 2020

This is first part of a couple more PRs to fix #191. I need to do this so that I can add unit tests for the Audit() function. After this PR I need to do a similar change (introduction of a wrapper type) for the errorreporting.Client stuff we still have in Audit().

Linus Arver added 3 commits March 9, 2020 12:21
This affects the flag -manifest-based-snapshot-of flag.
Instead of hardcoding the logging client tied to GCP resources, use a
"LoggingFacility" wrapper so that we can in the future use a fake
logging client for unit tests.
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 9, 2020
@listx
Copy link
Contributor Author

listx commented Mar 9, 2020

/hold

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 9, 2020
@k8s-ci-robot k8s-ci-robot requested review from hh and tpepper March 9, 2020 22:55
@k8s-ci-robot k8s-ci-robot added the sig/release Categorizes an issue or PR as relevant to SIG Release. label Mar 9, 2020
@listx
Copy link
Contributor Author

listx commented Mar 9, 2020

/cc @justinsb @thockin @dims @bartsmykla

Please take a look.

@listx
Copy link
Contributor Author

listx commented Mar 9, 2020

For more context, I cannot currently add unit tests for the Audit() function because it has hardcoded dependencies on logging to actual GCP logs and also to Stackdriver Error Reporting on GCP. I need to remove the hard dependencies first before I can think about unit tests.

// all local (stdout), with a FakeLogClient.
func NewFakeLoggingFacility() *LoggingFacility {

logInfo := log.New(os.Stdout, "FAKE-INFO", log.LstdFlags)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's fake, but Stderr is normally the place for logs :-)

// Creates a client.
client, err := logging.NewClient(ctx, projectID)
if err != nil {
klog.Fatalf("Failed to create client: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Looks like you could return the error, at least with the current code structure. But I agree it's probably not worth it.

@justinsb
Copy link
Contributor

Two minor nits that you can ignore, but lgtm

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 10, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justinsb, listx

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@listx
Copy link
Contributor Author

listx commented Mar 10, 2020

Thanks for the review @justinsb !

I will address those nits in the next PR; merging this for now.

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 10, 2020
@k8s-ci-robot k8s-ci-robot merged commit 022877c into kubernetes-sigs:master Mar 10, 2020
k8s-ci-robot added a commit that referenced this pull request Mar 10, 2020
address review comments from #193
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/release Categorizes an issue or PR as relevant to SIG Release. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

auditor fails to parse valid image references
3 participants