-
Notifications
You must be signed in to change notification settings - Fork 139
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
test_post_requests_2 (storageadmin.tests.test_samba.SambaTests) ... ERROR #2327
Comments
Thanks for finally putting that one "in writing". I remember having a try at it a few months back (trying to correctly mock the right call, for instance), but was hitting a snag as it seemed like the fixture was not taking, for instance... Anyway, thanks a lot for making the effort to open this issue... Hopefully it'll remind me to look into that again. |
@FroggyFlox Yes I thought we had spoken about this and it completely slipped out of my todo list some how. Apologies for the delay and dropping the ball on this one. As I remember this is currently a cosmetic failure introduced by this test falling behind our main code; and not an indication of core function failure. |
The error above can be summarized as follows:
We can thus see that we fail at the rockstor-core/src/rockstor/storageadmin/models/user.py Lines 47 to 60 in f41d786
What's interesting is that the error above seems to indicate that the first We could alternatively mock @mock.patch("storageadmin.models.user.ifp_get_groupname")
# @mock.patch("storageadmin.models.user.grp.getgrgid")
@mock.patch("storageadmin.views.samba.ShareMixin._validate_share")
@mock.patch("storageadmin.views.samba.User")
def test_post_requests_2(self, mock_user, mock_validate_share, mock_ifp_get_groupname):
"""
. Create a samba export for the share that has already been exported
"""
# # Nullify exception of getgrgid via:
# mock_getgrgid.side_effects = None
# Python2
# import grp
# >>> groupname = grp.getgrgid("470")
# >>> print(groupname)
# grp.struct_group(gr_name='ntp', gr_passwd='x', gr_gid=470, gr_mem=[])
# return "testgroup" for all gr_name calls:
# mock_getgrgid.gr_name.return_value = "testgroup"
# Nullify exception of ifp_get_groupname via:
mock_ifp_get_groupname.side_effects = None
mock_ifp_get_groupname.return_value = "testgroup"
mock_validate_share.return_value = self.temp_share_smb ... making
@phillxnet , mocking |
@FroggyFlox Thanks for looking into this a little more.
I think, given there is always more we can, it would be good to have this test back in order: going at least something. We can always return to refine a little more, bit by bit, as we go. And it will likely server us better in some working state than in none. So I say we go with at least getting it doing something. I'd have to take a closer look to say more, just popping in with a quick comment this time around. |
Thanks for the prompt feedback, @phillxnet! I tried a bit more to work out why our previous mock of
I'll get to submitting a PR soon so that we can properly test in Buildbot. Thanks! |
Mock ifp_get_groupname() instead of grp.getgrid() #2327
On a recent source build followed by a full test run on fully updated Leap 15.2 & 15.3 instances (JeOS derived) the following was observed:
Noting here for reference as this was observed while tending to another issue.
The text was updated successfully, but these errors were encountered: