3. Glusto is...
● Glusto is a “framework” or collection of commonly used tools
for developing scripts and tests for distributed systems.
● Primary components
− A class combining a collection of tools in a single, easy-to-use interface.
− Command-line wrapper to make dynamic config files available to test frameworks
● Built on open source and standard tools.
− (e.g., Python modules, RPyC, SSH, REST, PyUnit, PyTest, Nose, etc.)
● Provides flexibility minus complexity during development.
− Simple import into existing scripts
− Access to functionality via Python Interactive Interpreter
− Code/Test/Code with IDE (e.g., Eclipse via PyDev)
4. Key Features
● Remote calls via SSH
● Remote calls via RPyC
● Read and store config files in yaml, json, and ini formats
● Logging
● Templates
● Provides a wrapper for unit test discovery and configuration
● Works with multiple unit test frameworks (PyUnit, PyTest, Nose)
● Simple REST client
● Accessible via Python module, Python Interactive Interpreter, and a CLI
client.
6. Installing Glusto
● Installs via setuptools
− Directly from github with pip command
− # pip install –upgrade
git+git://github.com/loadtheaccumulator/glusto.git
− Via setuptools with python setup.py
− # git clone https://github.com/loadtheaccumulator/glusto.git
# cd glusto
# python setup.py install
● Docker container
− docker.io/loadtheaccumulator/glusto
7. Installing glustolibs-gluster
● Installs via setuptools
− Directly from github with pip command
− # pip install –upgrade
git+git://github.com/glusto-tests/glustolibs/glusto.git
− Via setuptools with python setup.py
− # git clone https://github.com/gluster/glusto-tests.git
# cd glusto-tests/glustolibs-gluster
# python setup.py install
● Docker container
− Contains both Glusto and glustolibs-gluster libraries
− May be available by the time you see this
9. Test Scripts with Glusto
● Standard PyUnit, PyTest, or Nose format
● Extendable via standard Python subclassing.
● Glusto just plugs in via import without dependency on
Glusto to run basic tests.
− from glusto.core import Glusto as g
● YAML config file containing the hosts
● clients: [192.168.1.225]
servers: [192.168.1.221, 192.168.1.222, 192.168.1.223, 192.168.1.224]
10. Basic PyUnit Script Format
● import unittest
class MyTestClass(unittest.TestCase):
@classmethod
def setUpClass(cls):
# runs before all test_ methods in the class
def setUp(self):
# runs before each test_ method in the class
def test_example1(self):
# test method representing a test case
def test_example2(self):
# test method representing a test case
def tearDown(self):
# runs after each test_ method in the class
@classmethod
def tearDownClass(cls):
# runs after all test_ methods in the class
11. Basic PyUnit Script Format
● import unittest
class MyTestClass(unittest.TestCase):
@classmethod
def setUpClass(cls):
# runs before all test_ methods in the class
def setUp(self):
# runs before each test_ method in the class
def test_example1(self):
# test method representing a test case
def test_example2(self):
# test method representing a test case
def tearDown(self):
# runs after each test_ method in the class
@classmethod
def tearDownClass(cls):
# runs after all test_ methods in the class
12. Basic PyUnit Script Format
● import unittest
class MyTestClass(unittest.TestCase):
@classmethod
def setUpClass(cls):
# runs before all test_ methods in the class
def setUp(self):
# runs before each test_ method in the class
def test_example1(self):
# test method representing a test case
def test_example2(self):
# test method representing a test case
def tearDown(self):
# runs after each test_ method in the class
@classmethod
def tearDownClass(cls):
# runs after all test_ methods in the class
13. Basic PyUnit Script Format
● import unittest
class MyTestClass(unittest.TestCase):
@classmethod
def setUpClass(cls):
# runs before all test_ methods in the class
def setUp(self):
# runs before each test_ method in the class
def test_example1(self):
# test method representing a test case
def test_example2(self):
# test method representing a test case
def tearDown(self):
# runs after each test_ method in the class
@classmethod
def tearDownClass(cls):
# runs after all test_ methods in the class
14. Basic PyUnit Script Format
● import unittest
class MyTestClass(unittest.TestCase):
@classmethod
def setUpClass(cls):
# runs before all test_ methods in the class
def setUp(self):
# runs before each test_ method in the class
def test_example1(self):
# test method representing a test case
def test_example2(self):
# test method representing a test case
def tearDown(self):
# runs after each test_ method in the class
@classmethod
def tearDownClass(cls):
# runs after all test_ methods in the class
15. import and class definition
● import unittest
import pytest
from glusto.core import Glusto as g
from gluster_base_class import runs_on
@runs_on([['distributed', 'replicated'], ['glusterfs', 'nfs']])
class GlusterDemoTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
# runs before all test_ methods in the class
def setUp(self):
# runs before each test_ method in the class
...
def tearDown(self):
# runs after each test_ method in the class
@classmethod
def tearDownClass(cls):
# runs after all test_ methods in the class