Rally can generate load with passed users now!

Finally, I happy to announce that OpenStack Rally team, after more than 1 year of work, finished support of benchmarking with already existing users in OpenStack. This is crucial feature that simplifies adoption of Rally in enterprise world.

Why it’s so important?

There are 2 very important use cases from production world:

  1. It’s simpler to run Rally against production cloud
    Rally can use existing users instead of creating own which is impossible in case of r/o Keystone backends like LDAP and AD.
  2. It’s safer to run Rally against production cloud
    Rally can be run from isolated group of users and if something went wrong it won’t affect rest of the cloud users.

(more…)

Read More

Rally v0.0.3 – What’s new?

Rally v0.0.3

New Features & API changes

  • Add the ability to specify versions for clients in benchmark scenarios
    You can call self.clients(“glance”, “2”) and get client initialized for specific API version.
  •  Add API for tempest uninstall
    $ rally-manage tempest uninstall    # removes fully tempest for active deployment
  • Add a –uuids-only option to rally task list
    $ rally task list –uuids-only    # returns list with only task uuids
  • Adds endpoint to –fromenv deployment creation
    $ rally deployment create –fromenv
    # recognizes standard OS_ENDPOINT environment variable
  • Configure SSL per deployment
    Now SSL information is deployment specific not Rally specific and rally.conf option is deprecated. Take a look at sample.

(more…)

Read More

The simplest way in python to mock open() during unit testing

I believe that the most of python developers are familiar with pretty mock framework. It’s one of the simplest way to avoid unit testing of not interesting parts of your code: such like DB, files, API of other services, some heavy libs like libvirt and so on..

Unfortunately, there is one unclear place (at least for me)  how to mock open() properly especially in case where when with open() in used in code.

I spend a bit of time to resolve this problem and here is the code snippet:

import testtools
import mock


def some(file_path):

    with open(file_path) as f:
        return f.read()


class MyTestCase(testtools.TestCase):

    @mock.patch("open", create=True)
    def test_some(self, mock_open):
        mock_open.side_effect = [
            mock.mock_open(read_data="Data1").return_value,
            mock.mock_open(read_data="Data2").return_value
        ]

        self.assertEqual("Data1", some("fileA"))
        mock_open.assert_called_once_with("fileA")
        mock_open.reset_mock()

        self.assertEqual("Data2", some("fileB"))
        mock_open.assert_called_once_with("fileB")

Read More