Uploaded image for project: 'Libcloud'
  1. Libcloud
  2. LIBCLOUD-349

no tests for list_networks and list_templates in cloudstack driver

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.12.3
    • Fix Version/s: 0.13.0
    • Component/s: Compute
    • Labels:
      None

      Description

      no tests in test_cloudstack.py for list_networks and list_templates, even though the fixtures are there

      1. LIBCLOUD-349.patch
        9 kB
        Philipp Strube

        Activity

        Hide
        pst418 Philipp Strube added a comment -

        This patch adds a list_images unit test as well as changes the NodeImage.driver to be self.connection.driver just like other drivers do.

        Show
        pst418 Philipp Strube added a comment - This patch adds a list_images unit test as well as changes the NodeImage.driver to be self.connection.driver just like other drivers do.
        Hide
        pst418 Philipp Strube added a comment -

        Added patch for list_networks in driver including tests and fixture. Also added the CloudStackNetwork class.

        Show
        pst418 Philipp Strube added a comment - Added patch for list_networks in driver including tests and fixture. Also added the CloudStackNetwork class.
        Hide
        kami Tomaz Muraus added a comment -

        I just tried applied patch onto trunk and it doesn't seem to apply cleanly:

        Applying: Added unittest for the list_images method in the Cloudstack driver
        error: patch failed: libcloud/compute/drivers/cloudstack.py:157
        error: libcloud/compute/drivers/cloudstack.py: patch does not apply
        error: patch failed: libcloud/test/compute/test_cloudstack.py:20
        error: libcloud/test/compute/test_cloudstack.py: patch does not apply
        Patch failed at 0001 Added unittest for the list_images method in the Cloudstack driver
        The copy of the patch that failed is found in:
        /w/lc/libcloud/.git/rebase-apply/patch
        When you have resolved this problem, run "git am --resolved".
        If you prefer to skip this patch, run "git am --skip" instead.
        To restore the original branch and stop patching, run "git am --abort".

        Can you please make sure the patches are generated against the latest trunk version of the code base?

        Show
        kami Tomaz Muraus added a comment - I just tried applied patch onto trunk and it doesn't seem to apply cleanly: Applying: Added unittest for the list_images method in the Cloudstack driver error: patch failed: libcloud/compute/drivers/cloudstack.py:157 error: libcloud/compute/drivers/cloudstack.py: patch does not apply error: patch failed: libcloud/test/compute/test_cloudstack.py:20 error: libcloud/test/compute/test_cloudstack.py: patch does not apply Patch failed at 0001 Added unittest for the list_images method in the Cloudstack driver The copy of the patch that failed is found in: /w/lc/libcloud/.git/rebase-apply/patch When you have resolved this problem, run "git am --resolved". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". Can you please make sure the patches are generated against the latest trunk version of the code base?
        Hide
        kami Tomaz Muraus added a comment -

        Otherwise the patch looks good, but the tests can be improved.

        Tests in the current form do increase the pure code coverage numbers, but that's about it. As far as testing stuff goes, they don't actually test / verify a lot though.

        Instead of doing those type checks it would be better to check, for example, that a single NodeImage instance contains the right attributes. Same goes for the networks.

        For example:

        images = self.driver.list_images()
        self.assertEqual(images[0].name, 'foo')
        ....
        

        Thanks

        Show
        kami Tomaz Muraus added a comment - Otherwise the patch looks good, but the tests can be improved. Tests in the current form do increase the pure code coverage numbers, but that's about it. As far as testing stuff goes, they don't actually test / verify a lot though. Instead of doing those type checks it would be better to check, for example, that a single NodeImage instance contains the right attributes. Same goes for the networks. For example: images = self.driver.list_images() self.assertEqual(images[0].name, 'foo') .... Thanks
        Hide
        pst418 Philipp Strube added a comment -

        I used the Github trunk to clone and do the changes. Thanks for your feedback. I will look into this and also the tests.

        Show
        pst418 Philipp Strube added a comment - I used the Github trunk to clone and do the changes. Thanks for your feedback. I will look into this and also the tests.
        Hide
        kami Tomaz Muraus added a comment -

        Yeah, Github repository is a read-only mirror of https://git-wip-us.apache.org/repos/asf/libcloud.git.

        This mirror is only synced a couple of times per day which means it can be out of sync. You are advised to use official repository (https://git-wip-us.apache.org/repos/asf/libcloud.git) e.g.

        git remote add upstream https://git-wip-us.apache.org/repos/asf/libcloud.git
        git pull upstream trunk

        Show
        kami Tomaz Muraus added a comment - Yeah, Github repository is a read-only mirror of https://git-wip-us.apache.org/repos/asf/libcloud.git . This mirror is only synced a couple of times per day which means it can be out of sync. You are advised to use official repository ( https://git-wip-us.apache.org/repos/asf/libcloud.git ) e.g. git remote add upstream https://git-wip-us.apache.org/repos/asf/libcloud.git git pull upstream trunk
        Hide
        pst418 Philipp Strube added a comment -

        I created a new patch, based on the upstream repository you mentioned. I also combined all changes into one patch this time.

        As for the tests, I have extended them to load the fixture and then compare the data loaded from the fixture in the test with the data parsed into the actual objects. This way the test checks the actual parsing code, classes etc. and that it also returns the same data as in the fixture. I kept the isInstance asserts just because why not.

        Does that work for you?

        Show
        pst418 Philipp Strube added a comment - I created a new patch, based on the upstream repository you mentioned. I also combined all changes into one patch this time. As for the tests, I have extended them to load the fixture and then compare the data loaded from the fixture in the test with the data parsed into the actual objects. This way the test checks the actual parsing code, classes etc. and that it also returns the same data as in the fixture. I kept the isInstance asserts just because why not. Does that work for you?
        Hide
        kami Tomaz Muraus added a comment -

        Yeah, this looks better. In other places we usually just directly compare Libcloud output with a string, because fixtures shouldn't change much, but what you did is also OK.

        Thanks

        Show
        kami Tomaz Muraus added a comment - Yeah, this looks better. In other places we usually just directly compare Libcloud output with a string, because fixtures shouldn't change much, but what you did is also OK. Thanks
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit a6dfaa24ac75a12f0fa9e1dcaadc823f2f4b2dd8 in branch refs/heads/0.12.x from Philipp Strube
        [ https://git-wip-us.apache.org/repos/asf?p=libcloud.git;h=a6dfaa2 ]

        Issue LIBCLOUD-349: Implementation of list_images and list_network for Cloudstack driver.

        Signed-off-by: Tomaz Muraus <tomaz@apache.org>

        Show
        jira-bot ASF subversion and git services added a comment - Commit a6dfaa24ac75a12f0fa9e1dcaadc823f2f4b2dd8 in branch refs/heads/0.12.x from Philipp Strube [ https://git-wip-us.apache.org/repos/asf?p=libcloud.git;h=a6dfaa2 ] Issue LIBCLOUD-349 : Implementation of list_images and list_network for Cloudstack driver. Signed-off-by: Tomaz Muraus <tomaz@apache.org>
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit d285b9a003070a17e61caf6816c71923d14f09a4 in branch refs/heads/trunk from Philipp Strube
        [ https://git-wip-us.apache.org/repos/asf?p=libcloud.git;h=d285b9a ]

        Issue LIBCLOUD-349: Implementation of list_images and list_network for Cloudstack driver.

        Signed-off-by: Tomaz Muraus <tomaz@apache.org>

        Show
        jira-bot ASF subversion and git services added a comment - Commit d285b9a003070a17e61caf6816c71923d14f09a4 in branch refs/heads/trunk from Philipp Strube [ https://git-wip-us.apache.org/repos/asf?p=libcloud.git;h=d285b9a ] Issue LIBCLOUD-349 : Implementation of list_images and list_network for Cloudstack driver. Signed-off-by: Tomaz Muraus <tomaz@apache.org>
        Hide
        kami Tomaz Muraus added a comment -

        Made some Python version compatibility changes and merged it into trunk. Thanks.

        Show
        kami Tomaz Muraus added a comment - Made some Python version compatibility changes and merged it into trunk. Thanks.

          People

          • Assignee:
            kami Tomaz Muraus
            Reporter:
            sebgoa sebastien goasguen
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development