[openstack-dev] Openvswitch agent unit tests

Sławek Kapłoński slawek at kaplonski.pl
Tue Sep 29 21:00:06 UTC 2015


Hello,

Thx for Your tips. So I should focus more on write new functional tests
for ovs agent if there are missing some rather then doing unit tests for
it?

-- 
Best regards / Pozdrawiam
Sławek Kapłoński
slawek at kaplonski.pl

On Mon, 28 Sep 2015, Assaf Muller wrote:

> Generally speaking, testing agent methods that interact with the system
> heavily with unit tests provide very little,
> and arguably negative value to the project. Mocking internal methods and
> asserting that they were called is a
> clear anti-pattern to my mind. In Neutron-land we prefer to test agent code
> with functional tests.
> Since 'functional tests' is a very over-loaded term, what I mean by that is
> specifically running the actual unmocked
> code on the system and asserting the expected behavior.
> 
> Check out:
> neutron/tests/functional/agent/test_ovs_lib
> neutron/tests/functional/agent/test_l2_ovs_agent
> 
> On Mon, Sep 28, 2015 at 3:45 PM, Sławek Kapłoński <slawek at kaplonski.pl>
> wrote:
> 
> > Hello,
> >
> > I'm new developer who want to start contributing to neutron. I have some
> > small experience with neutron already but I didn't do anything which I
> > could push to upstream for now. So I searched for some bug on launchpad
> > and I found such bug which I took:
> > https://bugs.launchpad.net/neutron/+bug/1285893 and I started to
> > checking how I can write new tests (I think that it is quite easy job to
> > do for the beginning but maybe I'm wrong).
> > Now I have some questions to You:
> > 1. From test-coverage I can see that for example there is missing
> > coverage like in lines 349-350 in method _restore_local_vlan_map(self) -
> > should
> > I create new test and call that metod to check if proper exception will
> > be raised? or maybe it is not neccessary at all and such "one lines"
> > missing coverage is not really needed to be checked? Or maybe it should
> > be done in some different way?
> >
> > 2. What about tests for methods like: "_local_vlan_for_flat" which is
> > not checked at all? should be created new test for such method? or maybe
> > it should be covered by some different test?
> >
> > Thanks in advance for any advice and tips how to write such unit tests
> > properly :)
> >
> > --
> > Best regards / Pozdrawiam
> > Sławek Kapłoński
> > slawek at kaplonski.pl
> >
> >
> > __________________________________________________________________________
> > OpenStack Development Mailing List (not for usage questions)
> > Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> >
> >

> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150929/78d48c2a/attachment.pgp>


More information about the OpenStack-dev mailing list