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
storaged: Fix writing fstab when modifying NFS mounts #18169
Conversation
|
Without the fix, the test fails like this, reproducing the bug: |
test/verify/check-storage-nfs
Outdated
| @@ -58,8 +60,9 @@ class TestStorageNfs(StorageCase): | |||
| b.wait_text_not("#nfs-mounts tr:contains(/mnt/test) .pf-c-progress__status", "") | |||
|
|
|||
| # Should be saved to fstab | |||
| self.assertEqual(m.execute("grep -w nfs /etc/fstab").strip(), | |||
| "127.0.0.1:/home/foo /mnt/test nfs defaults") | |||
| self.maxDiff = None | |||
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.
is maxDiff used anywhere?
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.
This line should be removed, I think.
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 kept it in as otherwise you don't get a diff like in the comment above, but just a message that gives you the first few characters and a "if you want to see the full diff, set maxDiff".
I don't feel strongly about it at all, though -- I'm happy to take it out, and we can put it back in locally if we need to debug it.
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.
Ich hab es outgetaked. 😁
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.
Ahh, it's a unittest thing? I didn't know that, I thought it's some debugging leftovers.
So, up to you, really. But if we keep it in, it needs a comment.
(Inheritance is wonderful... :-)
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.
So, up to you, really. But if we keep it in, it needs a comment.
Per IRC, let's not.
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 good in general, thanks!
readlines() keeps the `\n` line endings, so joining the array with `\n` caused extra empty lines to be inserted between each existing line. Move to splitlines() instead, which strips the `\n` and also makes the `del` special case obsolete. Make the integration test much more picky: Don't just assert the single line we expect to get added, but the full file. This will catch not only extra empty lines, but also accidental removals or unexpected ordering. https://bugzilla.redhat.com/show_bug.cgi?id=2160256
readlines() keeps the
\nline endings, so joining the array with\ncaused extra empty lines to be inserted between each existing line. Move to splitlines() instead, which strips the\nand also makes thedelspecial case obsolete.Make the integration test much more picky: Don't just assert the single line we expect to get added, but the full file. This will catch not only extra empty lines, but also accidental removals or unexpected ordering.
https://bugzilla.redhat.com/show_bug.cgi?id=2160256