Hi John
In my cursory first pass at the review, I didn't look at the bug itself.
It appears this is the bug regarding the unit test failures (similar
cause anyway). My response changes slightly based on that.
The unit tests should not assume that installadm (and the associated
system/install/server SMF service) are directly installed on the system
running the tests.
I can think of two approaches to this:
1) Modify the AImDNS constructor and class such that the calls to
libaimdns.getXYZproperty(...) reference a self.service_instance
property, rather than common.SRVINST. In the test cases, create a
temporary dummy service with/without given properties, and construct an
AImDNS object pointing to the dummy service.
2) Inject a different libaimdns "module" into the aimdns module for the
duration of the test. This would look something like:
class MockLibAImDNS(object):
def getstring_property(...):
...
def getboolean_property(...):
...
# etc.
def setUp():
...
self.orig_libaimdns = aimdns.libaimdns
self.mock_libaimdns = MockLibAImDNS()
aimdns.libaimdns = self.mock_libaimdns
def tearDown():
...
aimdns.libaimdns = self.orig_libaimdns
# Run tests per normal. Use the reference to self.mock_libaimdns
# (and appropriate instance variables in the class definition)
# to manipulate what the AImDNS object will get back from
# the calls to libaimdns.getastring_property(...)
I'm sure I'm brushing over a few details here; let me know and I'll clarify.
A combination of 1 & 2 could be used for maximum effect.
- Keith
On 11/17/10 01:54 PM, John Fischer wrote:
Keith,
Probably. But I am not sure how to test that case. Would I get the
original properties, delete them, make the assertion and then restore
the original properties? Or something else?
Thanks,
John
On 11/17/10 12:32 PM, Keith Mitchell wrote:
Hi John,
Would it make sense to add an additional test case to cover this
scenario?
- Keith
On 11/17/10 11:11 AM, John Fischer wrote:
All,
During the original code review for aimdns I removed the exception
handling for
retrieving the value of the networks SMF property. This was in
error as shown
during testing. I have filled the following bug:
7000918 missing SMF property causes aimdns to fail to register
mDNS records
Please review the changes for this issue at:
http://cr.opensolaris.org/~johnfisc/aimdns-7000918/
Thanks,
John
_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss
_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss