-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Introduce logverbose tag for test cases #1054
Conversation
test/e2e/errorcondition_test.go
Outdated
@@ -93,10 +97,10 @@ func TestContainerErrorMsg(t *testing.T) { | |||
t.Fatalf("Failed to get logUrl from revision %s: %v", revisionName, err) | |||
} | |||
|
|||
// TODO(jessiezcc@): actually validate the logURL, but requires kibana setup | |||
// TODO(jessiezcc): actually validate the logURL, but requires kibana setup | |||
log.Printf("LogURL: %s", logURL) |
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.
I mentioned about this log message causing noise in the output, please consider addressing it in this PR.
log.Printf("LogURL: %s", logURL) | ||
|
||
// TODO(jessiezcc@): add the check to validate that Route is not marked as ready once https://github.com/elafros/elafros/issues/990 is fixed | ||
// TODO(jessiezcc): add the check to validate that Route is not marked as ready once https://github.com/elafros/elafros/issues/990 is fixed | ||
} | ||
|
||
// Get revision name from configuration. |
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.
Please also consider fixing the comments of the functions in this PR.
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.
Nevermind, this are not public method anymore.
The following is the coverage report on pkg/. Say
*TestCoverage feature is being tested, do not rely on any info here yet |
/test pull-knative-serving-integration-tests |
The following is the coverage report on pkg/. Say
*TestCoverage feature is being tested, do not rely on any info here yet |
test/e2e_flags.go
Outdated
} | ||
|
||
// VerboseGLog outputs verbose logging with defined logleve 10. | ||
func VerboseGLog(s string) { |
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.
Why not simply Debug?
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.
would like to go with log level so that u can get all logs coming out of k8s libs as well.
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.
I mean calling the method "Debug", just for simplicity sake.
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.
ah, how about Verbose()? Debug is usually meant to be a build flavor, RTL vs. DBG
test/e2e_flags.go
Outdated
if *boolPtr { | ||
flag.Set("alsologtostderr", fmt.Sprintf("%t", true)) | ||
var logLevel string | ||
flag.StringVar(&logLevel, "logLevel", "10", "verbose log level") |
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.
If you're going this path, I suggest defining a constant for the "verbose" output and sticking to it in all the related code.
@bobcatfish I didn't check glog, is it the best approach? I confess I was expecting something simpler to use...
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.
that's the reason that I'm wrapping verbose log in a function to be called by TC.
started with constant, however, couldn't get gLog.V() to work, hence the function.
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.
Sorry, I don't follow. I understand the initialization and the use of V(), but I fail to understand the relation to the wrapping (which I like) and not being able to use a constant for V().
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.
will explain f2f when u are back to desk, easier that way
test/e2e_flags.go
Outdated
@@ -58,3 +60,21 @@ func initializeFlags() *EnvironmentFlags { | |||
|
|||
return &f | |||
} | |||
|
|||
func init() { |
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.
Any reason to not initialize these flags in initializeFlags()
?
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.
No particular reason, can merge into initializeFlags.
test/e2e_flags.go
Outdated
@@ -58,3 +60,21 @@ func initializeFlags() *EnvironmentFlags { | |||
|
|||
return &f | |||
} | |||
|
|||
func init() { | |||
boolPtr := flag.Bool("logVerbose", false, "a bool") |
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.
I'm pretty sure Christie would love seeing "a bool" turned into a way more descriptive text about this flag. :D
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.
yep, definitely
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.
a) Can you do it here? :)
b) Flag usage in the other files use the "test.Flags." aproach, which is cleaner. Can't you use that?
[jessie] fix and pushed
test/e2e_flags.go
Outdated
flag.Parse() | ||
|
||
if *boolPtr { | ||
flag.Set("alsologtostderr", fmt.Sprintf("%t", true)) |
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.
flag.Set("alsologtostderr", "true")
Interesting, I thought glog would output directly to stdout/stderr by default.
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.
Looks like I wasn't clear here: replace fmt.Sprintf() with just "true".
[jessie] fixed
test/e2e_flags.go
Outdated
var logLevel string | ||
flag.StringVar(&logLevel, "logLevel", "10", "verbose log level") | ||
flag.Lookup("v").Value.Set(logLevel) | ||
glog.Info("logVerbose %v", boolPtr) |
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.
boolPtr
will be always true here. What about simply
glog.Info("Logging set to verbose mode")
?
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.
will do
I like the (simple) wrapping approach because it requires less boilerplate code, thus there're (fewer) excuses for not logging things appropriately. |
@bobcatfish, are you ok with function approach? Test case will call test.Verbose(...) . |
also @adrcunha, @bobcatfish , are you fine with 2 PRs approach: |
Verbose func update
test/e2e_flags.go
Outdated
flag.Lookup("v").Value.Set(logLevel) | ||
glog.Info("logVerbose %v", boolPtr) | ||
glog.Infof("Logging set to verbose mode with logleve %d", VerboseLogLevel) |
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.
typo: logLevel
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.
done
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.
Looks like you missed the typo. :)
[Jessie] also fixed
test/e2e_flags.go
Outdated
boolPtr := flag.Bool("logVerbose", false, "a bool") | ||
flag.Parse() | ||
|
||
if *boolPtr { | ||
flag.Set("alsologtostderr", fmt.Sprintf("%t", true)) | ||
var logLevel string | ||
flag.StringVar(&logLevel, "logLevel", "10", "verbose log level") | ||
flag.StringVar(&logLevel, "logLevel", fmt.Sprint(VerboseLogLevel), "verbose log level") |
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.
typo: Sprintf
Would string()
work here?
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.
tried string, didn't work
test/e2e_flags.go
Outdated
// VerboseGLog outputs verbose logging with defined logleve 10. | ||
func VerboseGLog(s string) { | ||
glog.V(10).Infof(s) | ||
// Verbose outputs verbose logging with defined logleve 10. |
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.
typo: logLevel
But I would replace "logLevel 10" with "VerboseLogLevel".
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.
done
test/e2e_flags.go
Outdated
@@ -58,3 +60,21 @@ func initializeFlags() *EnvironmentFlags { | |||
|
|||
return &f | |||
} | |||
|
|||
func init() { | |||
boolPtr := flag.Bool("logVerbose", false, "a bool") |
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.
a) Can you do it here? :)
b) Flag usage in the other files use the "test.Flags." aproach, which is cleaner. Can't you use that?
[jessie] fix and pushed
test/e2e_flags.go
Outdated
flag.Parse() | ||
|
||
if *boolPtr { | ||
flag.Set("alsologtostderr", fmt.Sprintf("%t", true)) |
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.
Looks like I wasn't clear here: replace fmt.Sprintf() with just "true".
[jessie] fixed
test/e2e_flags.go
Outdated
flag.Lookup("v").Value.Set(logLevel) | ||
glog.Info("logVerbose %v", boolPtr) | ||
glog.Infof("Logging set to verbose mode with logleve %d", VerboseLogLevel) |
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.
Looks like you missed the typo. :)
[Jessie] also fixed
/retest |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: adrcunha, jessiezcc 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 |
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.
imo if you also update the e2e scripts so that they enable verbose logging, we can resolve #763 as well :D
var logLevel string | ||
flag.StringVar(&logLevel, "logLevel", fmt.Sprint(VerboseLogLevel), "verbose log level") | ||
flag.Lookup("v").Value.Set(logLevel) | ||
glog.Infof("Logging set to verbose mode with logLevel %d", VerboseLogLevel) |
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.
cool!
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.
I will need to update doc, will include changes for #763 as well.
I still have a different opinion on this but I don't feel strongly! I say go ahead with it and we can see how it turns out, wouldn't be hard to change later if we change our minds. |
/retest |
update err msg with both expected and actual state