op-node: Fix logging flags with incorrect prefix#5234
Conversation
|
✅ Deploy Preview for opstack-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## develop #5234 +/- ##
===========================================
- Coverage 40.35% 36.59% -3.76%
===========================================
Files 372 218 -154
Lines 23676 19187 -4489
Branches 832 0 -832
===========================================
- Hits 9555 7022 -2533
+ Misses 13395 11471 -1924
+ Partials 726 694 -32
Flags with carried forward coverage won't be shown. Click here to find out more.
|
ajsutton
left a comment
There was a problem hiding this comment.
It took me quite a bit of digging to work out why it had to be this way since this looks very much like a no-op. Would be great to add a test to cover this. You may come up with something better but I got to:
func TestCorrectEnvVarPrefix(t *testing.T) {
for _, flag := range Flags {
values := reflect.ValueOf(flag)
envVarValue := values.FieldByName("EnvVar")
if envVarValue == (reflect.Value{}) {
t.Errorf("Failed to find EnvVar for flag %v", flag.GetName())
continue
}
envVar := envVarValue.String()
if envVar[:len("OP_NODE_")] != "OP_NODE_" {
t.Errorf("Flag %v env var (%v) does not start with OP_NODE_", flag.GetName(), envVar)
}
if strings.Contains(envVar, "__") {
t.Errorf("Flag %v env var (%v) has duplicate underscores", flag.GetName(), envVar)
}
}
}|
@ajsutton I found this after noticing that the flag (as an env var) wasn't working on the internal devnet. I had tested this locally with the flag value. EnvVars are way harder to test because it's not an error to have undefined env vars. |
We could just skip things with undefined env vars - though currently that test passes with your fix. I've come across a few bugs with our CLI flags so would be good to start improving testing around them even if it's not perfect to start with. |
|
This PR has been added to the merge queue, and will be merged soon. |
|
This PR is next in line to be merged, and will be merged as soon as checks pass. |
1 similar comment
|
This PR is next in line to be merged, and will be merged as soon as checks pass. |
Description
During the migration to using shared logging flags in PR #5085 the env var flags for the logging options got messed up for just the op-node. They had an extra underscore between the
OP_NODEprefix and theLOG_FLAGvalue.TODOs