-
Notifications
You must be signed in to change notification settings - Fork 7
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(windows-agent): No empty agent.yaml #881
Conversation
Using Flutter built-in facilities instead of handcrafting code to trim spaces when the field changes.
As before, it's enabled by default in debug mode. In production model.isSaaSSupported returns false and the option is hidden from the radio group.
Per guidance in UDENG-3818.
This hides the Landscape config option (instead of disabling it). No changes in behaviour nor in how we decide to hide it. Some strings were changed also per guidance provided in #861. Finally I added a little bit more spacing in the top now that the subtitle is one line only. Here's how it looks like when compiled in release mode. ![image](https://github.com/user-attachments/assets/f9bb98aa-b544-44a2-82d2-6d5da2b186e0) Closes #861 --- I'm purposefully basing this PR on top of #873 so I can stress CI to exercise the changes therein introduced. There is no dependency between the two tasks. --- UDENG-3818
Sometimes copy-pasting a pro token comes with trailing spaces. Neither leading, trailing or even middle spaces are alloweable in a token. This PR leverages Flutter builtin mechanisms to filter input supplied to the token text field such that any kind of whitespaces (not only the ASCII ones) are discarded before any further processing. Closes #857 --- I'm purposefully basing this PR on top of #873 so I can stress CI to exercise the changes therein introduced. There is no dependency between the two tasks. --- UDENG-3810
Bumps [file_picker](https://github.com/miguelpruivo/flutter_file_picker) from 8.1.1 to 8.1.2. - [Release notes](https://github.com/miguelpruivo/flutter_file_picker/releases) - [Changelog](https://github.com/miguelpruivo/flutter_file_picker/blob/master/CHANGELOG.md) - [Commits](https://github.com/miguelpruivo/flutter_file_picker/commits) --- updated-dependencies: - dependency-name: file_picker dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]>
…kages/ubuntupro (#876)
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## fix-agent-flakyness #881 +/- ##
======================================================
Coverage ? 88.71%
======================================================
Files ? 105
Lines ? 6866
Branches ? 0
======================================================
Hits ? 6091
Misses ? 601
Partials ? 174 ☔ View full report in Codecov by Sentry. |
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.
Some small fixes to do and some questions!
@@ -47,6 +55,10 @@ func TestNew(t *testing.T) { | |||
|
|||
// We don't assert on specifics, as they are tested in WriteAgentData tests. | |||
path := filepath.Join(publicDir, ".cloud-init", "agent.yaml") | |||
if tc.emptyConfig { |
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 would make that an explicit Want
to separate the predicate (we do have an empty config) to "I want no config file"
@@ -172,6 +191,17 @@ hostagent_uid = landscapeUID1234 | |||
return | |||
} | |||
|
|||
if tc.breakRemovingFile { |
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.
ditto here and below on what we want to be separated from the initial state. That way, we have a clear story on the side effect and what is expected.
...internal/proservices/testdata/TestNew/golden/when_the_config_cannot_check_if_it_is_read-only
Show resolved
Hide resolved
windows-agent/internal/proservices/testdata/TestNew/golden/when_the_subscription_stays_empty
Show resolved
Hide resolved
File mode 0600 was not intended for this specific case, as the setup step expects to be able to list and write into the directory. It was not noticed because the directory was previously created by cloudinit.New. Not that cloudinit won't create the directory if there is nothing to write into, the bug was revealed.
If marshalConfig returns `nil, nil` there is no error but also nothing for cloud-init to do. Thus, there should be no agent.yaml in disk. So, we check for that condition and attempt to remove agent.yaml from the cloudinit dataDir, if it exists. Missing file is not an error.
We previously didn't bother with the contents of agent.yaml But now that it will only exist after the registry notifications reach the cloudinit component, we need to wait for that file to appear before proceeding with any assertion. And now we no longer expect to find an empty file, but a file that matches what was set via the registry.
Using the existence of goldens as the way to signal the test cases that agent.yaml should exist or not.
6ed6be5
to
48ffbf7
Compare
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.
All good from my standpoint now!
Reverts #881 Merged on the wrong branch :(
When the config is empty, the yaml serialization outputs
{}
. We still added some commentary in the agent.yaml, resulting in a bunch of nothing that confused cloud-init, because it's enablement is based on the existence of the files, their contents are only checked later. That wouldn't be a problem per se, as the WSL datasource would recognize there's nothing to do and bail out, but that would have costed unnecesary CPU cicles, and worse than that, the current implementation of cloud-init makes it log as an error the fact that there is nothing to do at this point, which results in more noise if the user see the output ofcloud-init status --long
.The fix is rather simple: do not write an empty object into agent.yaml. If the config is empty we delete that file. This way, if there is nothing from the user nor the agent's perspective, cloud-init will remain trully disabled.
I updated some tests that relied on the fact that cloud-init would create the agent.yaml file unconditionally, which is no longer the case.
UDENG-4169