napalm-automation / napalm-base

Apache License 2.0
32 stars 48 forks source link

Devices with no LLDP neighbors fail unit tests #262

Closed bewing closed 7 years ago

bewing commented 7 years ago

When testing devices without the mock driver, if no LLDP neighbors exist, unit tests fail, as it is expected that the LLDP neighbor count is greater than 0. It is possible for a device to have zero LLDP neighbors.

bewing commented 7 years ago

Both get_lldp_neighbors() and get_lldp_neighbors_detail() fail.

dbarrosop commented 7 years ago

Yes, that's done on purpose to avoid rigging the tests but that shouldn't be a big deal, is it? The method should work regardless, this is just for the test. Have you encountered some problem because of this? We could remove the assertion, that's fine.

bewing commented 7 years ago

I've only encounted problems when running unit tests without the mock driver -- IE, when running against a VM with no LLDP neighbors, or against a device with no LLDP neighbors. It's not really major enough to make me mad, though. Was just interested if there was a way to work around.

dbarrosop commented 7 years ago

when running against a VM with no LLDP neighbors, or against a device with no LLDP neighbors

Oh, ok. Misunderstood you. In that case I think we could have a IGNORE_EMPTY envvar we can set to deliberately avoid failing on empty data.