-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix some non-Linux test failures #6473
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
Conversation
|
Bwahaha...CLA bites me too. I'll get that taken care of |
101edc6 to
cdbd582
Compare
|
Update: we're looking into doing the company-wide CLA, so it may be a while |
Thanks for the update. Keep us posted! |
|
Update: still waiting on CLA. Mostly just commenting to stop the stale checker from flagging this again 😄 |
|
CLA has been signed on our end, so now just waiting for whatever magic needs to happen on the Canonical side for the CLA checker to be updated. |
Woo hoo! Welcome back! |
|
@TheRealFalcon in prepartion for landing, a couple of hacktoberfest commits landed dropping tests/helpers.py::TestCase which resulted in a merge conflict. I'll make sure I touch base with Canonical CLA folks to ensure the CLA signing is permitted now for your company so we can clear the CI workflow. |
|
Noted, I'll do the rebase once the CLA checker says I'm good. I've just been manually curling it to see. |
holmanb
left a comment
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.
The code changes look good to me. There is a merge conflict, and the CLA job hasn't passed yet, but once those are resolved I'd say that this is ready for a rebase merge.
Thanks @TheRealFalcon!
tests/unittests/conftest.py
Outdated
| from cloudinit import user_data as ud | ||
| from cloudinit import util | ||
| from cloudinit import ( | ||
| util, |
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.
nit: I assume this change wasn't intended? if this is what black wants now, maybe we could just move this up with the import list above this line?
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.
Hrm, isort insists on it. It's because the as ud line has to be called out separately but is ordered before util. Seems like a stupid isort quirk, but I'd rather just leave it rather than try to work around it.
| cmd = [ | ||
| SH, | ||
| "-c", | ||
| 'echo -n "$@"', |
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.
interesting - I didn't realize that this isn't defined in posix
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.
Maybe this fix should be separated in a PR of its own to avoid being buried in this one.
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 wouldn't bother with that. Since this is test code this shouldn't affect the end user in any way or be worth treating differently than this OS compatibility PR.
|
Thanks!
Still waiting on this unfortunately. I believe we submitted it a few weeks ago. Is there something stuck on the Canonical side? |
I've copied internal folks here saying we're blocked with "external" contributors having signed the CLA. My visibility here is that legal has been asked about this directly and they CLA-folks are awaiting a response. I'll bump this topic again so we can unblock. |
|
sigh looks like there's still more to sort on our end. Commenting again to keep the auto-closer quiet |
The "has_gnu_date" function checks "date --help" output, but some versions of "date" don't include a "--help" flag.
`time.strftime()` has platform-specific behavior when dealing with a `gmtime()` struct.
It was removed in canonical#6356, but is still needed in some tests that interact with `/tmp`.
cdbd582 to
73d99a8
Compare
|
Happy new year! CLA check finally passes! I rebased and applied the one comment. I'll clean up the other test failure/linter stuff so we can hopefully finally get this through. |
Many socket attributes are OS-specific, so ensure we have attributes that work for the tests that need them. Also, mock socket calls where needed.
'echo -n' isn't universal
Note that this test wasn't always Linux-specific, but when the pid stuff moved under Distro, the test was changed to test the base class (i.e., Linux) functionality only.
Implementation differences cause different results.
73d99a8 to
2ea6d8d
Compare
|
This should be ready for review again |
holmanb
left a comment
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.
@TheRealFalcon thanks for this! One minor nitpick and then I'm happy to merge it.
| from cloudinit import user_data as ud | ||
| from cloudinit import util | ||
| from cloudinit import ( | ||
| util, |
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.
nit: an import list one item long seems messy. We should be able to include this in the multi-line list starting on line 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.
Not sure if you saw my response on the earlier comment, but
isort insists on it. It's because the
as udline has to be called out separately but is ordered before util. Seems like a stupid isort quirk, but I'd rather just leave it rather than try to work around it.
If I move this one to the other list, the lint fails. Would you rather I leave it or try to silence isort?
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.
Oops, thanks for restating that. It is fine as-is. Thanks!
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.
Oops, thanks for restating that.
That's silly, but it doesn't need to change. I'm fine with it as-is.
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.
Oops, thanks for restating that.
That's silly, but it doesn't need to change. I'm fine with it as-is.
| def cfg(tmp_path, mocker): | ||
| mocker.patch("cloudinit.util.os.chown") | ||
| # root group doesn't exist everywhere | ||
| mocker.patch("cloudinit.util.chownbyname") |
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.
+1, we shouldn't have been depending on that anyways
| cmd = [ | ||
| SH, | ||
| "-c", | ||
| 'echo -n "$@"', |
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 wouldn't bother with that. Since this is test code this shouldn't affect the end user in any way or be worth treating differently than this OS compatibility PR.
| TMPDIR = os.getenv("TMPDIR", "/tmp") | ||
| Path(tmpdir, TMPDIR[1:]).mkdir(exist_ok=True) | ||
| Path(tmpdir, TMPDIR[1:]).mkdir(parents=True, exist_ok=True) | ||
| Path(tmpdir, "tmp").mkdir(exist_ok=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.
I see that setting TMPDIR causes tests to fail before this change. Tests also fail when TMPDIR includes a trailing slash, but fixing that isn't a very high priority in my opinion.
Proposed Commit Message
Additional Context
With these changes (and changes to the default TMPDIR), tests pass for me on a Mac. This PR contains multiple commits and each commit should be independently reviewable. I'll leave it up to whoever merges to decide if they want to squash or not.
Test Steps
Merge type