chore(ci): Ensure null http override values aren't set via tests#182
chore(ci): Ensure null http override values aren't set via tests#182elizabethhealy wants to merge 1 commit intomainfrom
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request updates the HTTP server option tests to assert that 'idleTimeout' and 'readHeaderTimeout' are absent from the configuration. However, feedback indicates that these assertions will fail because the current Helm template renders null values explicitly as 'key: null'. A suggestion was provided to revert the assertions to maintain compatibility with the existing template logic.
| s.NotContains(data, "idleTimeout", "server.http.idleTimeout should not be present") | ||
| s.NotContains(data, "readHeaderTimeout", "server.http.readHeaderTimeout should not be present") |
There was a problem hiding this comment.
These assertions will fail with the current Helm template for config.yaml. The template at charts/platform/templates/config.yaml on line 82 uses toYaml on the entire .Values.server.http object. Since idleTimeout and readHeaderTimeout have null as their default value in values.yaml, they will be rendered into the config as idleTimeout: null and readHeaderTimeout: null, causing these NotContains assertions to fail.
To fix this, the template should be updated to filter out null values. If changing the template is not intended in this PR, these assertions should be reverted to check for the presence of key: null.
| s.NotContains(data, "idleTimeout", "server.http.idleTimeout should not be present") | |
| s.NotContains(data, "readHeaderTimeout", "server.http.readHeaderTimeout should not be present") | |
| s.Require().Contains(data, "idleTimeout: null", "idleTimeout should be null in the config file") | |
| s.Require().Contains(data, "readHeaderTimeout: null", "readHeaderTimeout should be null in the config file") |
There was a problem hiding this comment.
/gemini you said "To fix this, the template should be updated to filter out null values." -- does this really matter in the context of yaml? whether its null or not present in the map?
There was a problem hiding this comment.
In many YAML parsers, key: null and the key being absent are functionally equivalent. However, in the context of Go applications (which often use gopkg.in/yaml.v3 or similar), unmarshaling key: null into a struct field can result in the field being set to its zero value (e.g., 0 for an int or time.Duration), whereas omitting the key allows the application to retain its default value or handle the absence explicitly. If your application logic relies on checking if a value was provided (e.g., using a pointer type *time.Duration to distinguish between 'unset' and 'zero'), having key: null in the config can cause unexpected behavior by overriding defaults with zero values. Therefore, omitting the key is generally cleaner and safer for configuration management.
|
closing - not necessary as null and empty are evaled the same in the platform code |
The values shouldnt be null they should be unset
Summary by CodeRabbit