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

SDA-6670 | feat: add formating function to retrieve output logs #182

Merged
merged 1 commit into from
Apr 25, 2023

Conversation

gdbranco
Copy link
Contributor

@gdbranco gdbranco commented Apr 25, 2023

Related issue: https://issues.redhat.com/browse/SDA-6670

What

Adds a formatted string output from logs instead of directly printing to stdout, clients can consume the raw string

Why

Clients currently have no access to the debug logs

@openshift-ci openshift-ci bot requested review from bng0y and boranx April 25, 2023 18:09
@codecov-commenter
Copy link

Codecov Report

Merging #182 (8313cd0) into main (c4170ae) will increase coverage by 0.05%.
The diff coverage is 0.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #182      +/-   ##
==========================================
+ Coverage   10.03%   10.08%   +0.05%     
==========================================
  Files          17       17              
  Lines        1146     1140       -6     
==========================================
  Hits          115      115              
+ Misses       1021     1015       -6     
  Partials       10       10              
Impacted Files Coverage Δ
examples/aws/verify_egress.go 0.00% <0.00%> (ø)
pkg/output/output.go 43.75% <0.00%> (+5.56%) ⬆️

}

// Parse returns the data being stored on output
// - failures as []error
// - exceptions as []error
// - errors as []error
func (o *Output) Parse() ([]error, []error, []error) {
return o.failures, o.exceptions, o.errors
func (o *Output) Parse() ([]error, []error, []error, []string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would rather that we create a new function to retrieve debug logs from this output struct rather than continue to extend this Parse() function.

However, maybe I don't understand the problem - what is missing that this PR hopes to achieve? The description isn't super clear

Copy link
Contributor Author

@gdbranco gdbranco Apr 25, 2023

Choose a reason for hiding this comment

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

Oh, sorry. We actually don't really need the Parse at all, we could just not use it. I was mostly aligning it so we can have debug logs access

The goal is to be able to access debug logs from clients, CS for instance. As currently it has no access
Also adding a formatted string output instead of printing to stdout so it is easier to consume the logs and the control of the format can be handled within network verifier itself.

Just easing support so we can move forward uploading logs to s3 buckets

Copy link
Contributor

Choose a reason for hiding this comment

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

Gotcha, yeah if Format() is all you need that would be great. If we find that we need Parse() I think we had better consider just making separate functions for each of:

	debugLogs []string
	// failures represents the failed validation tests
	failures []error
	// exceptions is to show edge cases where a verifier test couldn't be ran as expected
	exceptions []error
	// errors is collection of unhandled errors
	errors []error

or just making all of them public members in the struct

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool, removed Parse changes for now. We can handle it later if necessary

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 25, 2023

@gdbranco: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Copy link
Contributor

@mjlshen mjlshen left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 25, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 25, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gdbranco, mjlshen

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 25, 2023
@openshift-merge-robot openshift-merge-robot merged commit ee383d0 into openshift:main Apr 25, 2023
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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants