[libvirt] [PATCH v2 07/10] viriscsitest: Test virISCSIConnectionLogin

Michal Privoznik mprivozn at redhat.com
Tue Jul 24 08:25:36 UTC 2018


On 07/23/2018 03:55 PM, John Ferlan wrote:
> 
> 
> On 07/23/2018 08:34 AM, Michal Prívozník wrote:
>> On 07/23/2018 02:12 PM, John Ferlan wrote:
>>>
>>>
>>> On 07/23/2018 04:01 AM, Michal Prívozník wrote:
>>>> On 07/17/2018 09:14 PM, John Ferlan wrote:
>>>>>
>>>>>
>>>>> On 07/04/2018 05:23 AM, Michal Privoznik wrote:
>>>>>> Introduce one basic test that tests the simplest case:
>>>>>> logging into portal without any IQN.
>>>>>>
>>>>>> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>>>>>> ---
>>>>>>  tests/viriscsitest.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
>>>>>>  1 file changed, 46 insertions(+)
>>>>>>
>>>>>> diff --git a/tests/viriscsitest.c b/tests/viriscsitest.c
>>>>>> index 3bb3993196..a7287069ba 100644
>>>>>> --- a/tests/viriscsitest.c
>>>>>> +++ b/tests/viriscsitest.c
>>>>>> @@ -94,6 +94,16 @@ static void testIscsiadmCb(const char *const*args,
>>>>>>                 args[8] && STREQ(args[8], "nonpersistent") &&
>>>>>>                 args[9] == NULL) {
>>>>>>          ignore_value(VIR_STRDUP(*output, iscsiadmSendtargetsOutput));
>>>
>>> here we do some sort of comparison
>>
>> What comparison? The only comparison I see is "args[X] && STREQ(args[X],
>> ...)".
>>
>> If you're referring to VIR_STRDUP() that is setting the pretended output
>> of the iscsiadm command. It's not comparing anything.
>>
> 
> Can you just indicate rather than "nada" what the actual deal is here?

Okay, how about "/* no output */" instead of "nada"?

> That is, in our mocked environment when running this command we don't
> expect to get any output from iscsiadm. If this were a real command then
> the following would be returned:
> > ...
> 
> In my saved iSCSI output file, I have for example:
> 
> iscsiadm -m node -T iqn.2013-12.com.example:iscsi-chap-pool -p
> 192.168.122.1 --login
> 
> returning:
> 
> Logging in to [iface: default, target:
> iqn.2013-12.com.example:iscsi-chap-pool, portal: 192.168.122.1,3260]
> (multiple)
> Login to [iface: default, target:
> iqn.2013-12.com.example:iscsi-chap-pool, portal: 192.168.122.1,3260]
> successful.

But this output is never processed by our code, therefore it doesn't
make much sense for our 'mock' to produce any.

Michal




More information about the libvir-list mailing list