SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Practical Glusto
Example
Jonathan Holloway
Principal Quality Engineer - Red Hat Storage
Practical Glusto Example
Very Brief Intro
to Glusto
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)
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.
Practical Glusto Example
Install Glusto
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
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
Practical Glusto Example
Write Tests
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]
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
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
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
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
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
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
setUpClass/tearDownClass
● ...
@runs_on([['distributed', 'replicated'], ['glusterfs', 'nfs']])
class GlusterDemoTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.masternode = g.config['servers'][0]
cls.client = g.config['clients'][0]
cls.mountpoint = '/mnt/gluster-mount'
g.run(cls.masternode, 'service glusterd start')
g.run(cls.masternode, 'gluster volume start glustervol1')
g.run(cls.client, 'mount /mnt/gluster-mount')
...
@classmethod
def tearDownClass(cls):
g.run(cls.client, 'umount %s' % cls.mountpoint)
g.run(cls.masternode, 'gluster volume stop glustervol1')
g.run(cls.masternode, 'service glusterd stop')
setUp/tearDown
● ...
@runs_on([['distributed', 'replicated'], ['glusterfs', 'nfs']])
class GlusterDemoTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
...
def setUp(self):
self.filename = '%s/%s-%s' %
(self.mountpoint, self.volume, self.mount)
print('nCreating file %s' % self.filename)
g.run(self.client, 'touch %s' % self.filename)
...
def tearDown(self):
print('Removing file %s' % self.filename)
g.run(self.client, 'rm -f %s' % self.filename)
@classmethod
def tearDownClass(cls):
...
test_ method(s)
● ...
def setUp(self):
...
def test_mount_type(self):
rcode, _, _ = g.run(self.client,
'mount | grep %s' % self.mount)
self.assertEqual(rcode, 0,
'Mounted volume is not type %s' % self.mount)
@pytest.mark.bvt
def test_create_file_with_touch(self):
print('nTesting file %s' % self.filename)
rcode, rout, rerr = g.run(self.client, 'ls %s' % self.filename)
self.assertEqual(rcode, 0, 'File does not exist')
def tearDown(self):
...
...
Practical Glusto Example
Run Tests
Run via /usr/bin/glusto
● Glusto CLI wrapper provides config file(s) to tests
− $ glusto -c myconfig.yml --pytest='test_demo1.py'
● PyTest provides xUnit style output
− $ glusto -c myconfig.yml 
--pytest='test_demo1.py --junitxml=results.xml'
● Accepts PyTest marker (-m) and filter (-k) parameters
− $ glusto -c myconfig.yml 
--pytest='test_demo1.py -m bvt'
$ glusto -c myconfig.yml 
--pytest='test_demo1.py -k mount'
Practical Glusto Example
Demo
https://asciinema.org/a/7sb4vox7ucasmgbwyeii4rheh
Info
● Contact
− Email: gluster-devel@gluster.org
− IRC: FreeNode #gluster-dev (loadtheacc)
● Libraries and Tests Repo
− git clone http://review.gluster.org/glusto-tests
− Mirrored at http://github.com/gluster/glusto-tests
● Glusto Repo and Docs
− http://github.com/loadtheaccumulator/glusto
− http://glusto.readthedocs.io/

Weitere ähnliche Inhalte

Was ist angesagt?

CoreOS introduction - Johann Romefort
CoreOS introduction - Johann RomefortCoreOS introduction - Johann Romefort
CoreOS introduction - Johann Romefort
Stylight
 

Was ist angesagt? (20)

Gluster d thread_synchronization_using_urcu_lca2016
Gluster d thread_synchronization_using_urcu_lca2016Gluster d thread_synchronization_using_urcu_lca2016
Gluster d thread_synchronization_using_urcu_lca2016
 
Small, Simple, and Secure: Alpine Linux under the Microscope
Small, Simple, and Secure: Alpine Linux under the MicroscopeSmall, Simple, and Secure: Alpine Linux under the Microscope
Small, Simple, and Secure: Alpine Linux under the Microscope
 
Docker 原理與實作
Docker 原理與實作Docker 原理與實作
Docker 原理與實作
 
Containers: What are they, Really?
Containers: What are they, Really?Containers: What are they, Really?
Containers: What are they, Really?
 
Docker / Ansible
Docker / AnsibleDocker / Ansible
Docker / Ansible
 
Docker n co
Docker n coDocker n co
Docker n co
 
Gluster and Kubernetes
Gluster and KubernetesGluster and Kubernetes
Gluster and Kubernetes
 
Docker 1.11 @ Docker SF Meetup
Docker 1.11 @ Docker SF MeetupDocker 1.11 @ Docker SF Meetup
Docker 1.11 @ Docker SF Meetup
 
CoreOS introduction - Johann Romefort
CoreOS introduction - Johann RomefortCoreOS introduction - Johann Romefort
CoreOS introduction - Johann Romefort
 
Container (Docker) Orchestration Tools
Container (Docker) Orchestration ToolsContainer (Docker) Orchestration Tools
Container (Docker) Orchestration Tools
 
Gluster containers!
Gluster containers!Gluster containers!
Gluster containers!
 
CoreOS Intro
CoreOS IntroCoreOS Intro
CoreOS Intro
 
Scalability and Performance of CNS 3.6
Scalability and Performance of CNS 3.6Scalability and Performance of CNS 3.6
Scalability and Performance of CNS 3.6
 
CoreOS intro
CoreOS introCoreOS intro
CoreOS intro
 
Networking and Go: An Engineer's Journey (Strangeloop 2019)
Networking and Go: An Engineer's Journey (Strangeloop 2019)Networking and Go: An Engineer's Journey (Strangeloop 2019)
Networking and Go: An Engineer's Journey (Strangeloop 2019)
 
はじめてのGlusterFS
はじめてのGlusterFSはじめてのGlusterFS
はじめてのGlusterFS
 
Declare your infrastructure: InfraKit, LinuxKit and Moby
Declare your infrastructure: InfraKit, LinuxKit and MobyDeclare your infrastructure: InfraKit, LinuxKit and Moby
Declare your infrastructure: InfraKit, LinuxKit and Moby
 
What Have Syscalls Done for you Lately?
What Have Syscalls Done for you Lately?What Have Syscalls Done for you Lately?
What Have Syscalls Done for you Lately?
 
Integrating gluster fs,_qemu_and_ovirt-vijay_bellur-linuxcon_eu_2013
Integrating gluster fs,_qemu_and_ovirt-vijay_bellur-linuxcon_eu_2013Integrating gluster fs,_qemu_and_ovirt-vijay_bellur-linuxcon_eu_2013
Integrating gluster fs,_qemu_and_ovirt-vijay_bellur-linuxcon_eu_2013
 
OSBConf 2015 | Scale out backups with bareos and gluster by niels de vos
OSBConf 2015 | Scale out backups with bareos and gluster by niels de vosOSBConf 2015 | Scale out backups with bareos and gluster by niels de vos
OSBConf 2015 | Scale out backups with bareos and gluster by niels de vos
 

Andere mochten auch

Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...
Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...
Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...
Gluster.org
 

Andere mochten auch (20)

Ten quick tips for building muscle!
Ten quick tips for building muscle!Ten quick tips for building muscle!
Ten quick tips for building muscle!
 
Resume 2016C
Resume 2016CResume 2016C
Resume 2016C
 
Gsummit apis-2012
Gsummit apis-2012Gsummit apis-2012
Gsummit apis-2012
 
Architecture in-the-small-slides
Architecture in-the-small-slidesArchitecture in-the-small-slides
Architecture in-the-small-slides
 
Seek and ye shall find - 28.10.2016
Seek and ye shall find - 28.10.2016Seek and ye shall find - 28.10.2016
Seek and ye shall find - 28.10.2016
 
Magento_2.0_-_Digital_Commerce_Architecture_-_White_Paper_-_Nov2015-2016-02-0...
Magento_2.0_-_Digital_Commerce_Architecture_-_White_Paper_-_Nov2015-2016-02-0...Magento_2.0_-_Digital_Commerce_Architecture_-_White_Paper_-_Nov2015-2016-02-0...
Magento_2.0_-_Digital_Commerce_Architecture_-_White_Paper_-_Nov2015-2016-02-0...
 
Deterministic releases and how to get there with Nigel Babu
Deterministic releases and how to get there with Nigel BabuDeterministic releases and how to get there with Nigel Babu
Deterministic releases and how to get there with Nigel Babu
 
Meet us by turkish team
Meet us by turkish teamMeet us by turkish team
Meet us by turkish team
 
Dados e Serviços Remotos via DataSnap
Dados e Serviços Remotos via DataSnapDados e Serviços Remotos via DataSnap
Dados e Serviços Remotos via DataSnap
 
Microservices: next-steps
Microservices: next-stepsMicroservices: next-steps
Microservices: next-steps
 
Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...
Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...
Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...
 
On demand file-caching_-_gustavo_brand
On demand file-caching_-_gustavo_brandOn demand file-caching_-_gustavo_brand
On demand file-caching_-_gustavo_brand
 
Gluster fs current_features_and_roadmap
Gluster fs current_features_and_roadmapGluster fs current_features_and_roadmap
Gluster fs current_features_and_roadmap
 
los principios del sistema democratico
los principios del sistema democraticolos principios del sistema democratico
los principios del sistema democratico
 
Turkish food
Turkish foodTurkish food
Turkish food
 
Agile Product Management
Agile Product ManagementAgile Product Management
Agile Product Management
 
The Amazon Web Services support
The Amazon Web Services supportThe Amazon Web Services support
The Amazon Web Services support
 
Mage Titans USA 2016 - Kimberely Thomas - Adopting Scrum and Agile for Develo...
Mage Titans USA 2016 - Kimberely Thomas - Adopting Scrum and Agile for Develo...Mage Titans USA 2016 - Kimberely Thomas - Adopting Scrum and Agile for Develo...
Mage Titans USA 2016 - Kimberely Thomas - Adopting Scrum and Agile for Develo...
 
Mage Titans USA 2016 - Brendan Falkowski Designing the B2B Experience
Mage Titans USA 2016 -  Brendan Falkowski Designing the B2B ExperienceMage Titans USA 2016 -  Brendan Falkowski Designing the B2B Experience
Mage Titans USA 2016 - Brendan Falkowski Designing the B2B Experience
 
Deploy Magento Shops with Capistrano v3
Deploy Magento Shops with Capistrano  v3Deploy Magento Shops with Capistrano  v3
Deploy Magento Shops with Capistrano v3
 

Ähnlich wie Practical Glusto Example

Plone testingdzug tagung2010
Plone testingdzug tagung2010Plone testingdzug tagung2010
Plone testingdzug tagung2010
Timo Stollenwerk
 

Ähnlich wie Practical Glusto Example (20)

Gradle For Beginners (Serbian Developer Conference 2013 english)
Gradle For Beginners (Serbian Developer Conference 2013 english)Gradle For Beginners (Serbian Developer Conference 2013 english)
Gradle For Beginners (Serbian Developer Conference 2013 english)
 
Presto Testing Tools: Benchto & Tempto (Presto Boston Meetup 10062015)
Presto Testing Tools: Benchto & Tempto (Presto Boston Meetup 10062015)Presto Testing Tools: Benchto & Tempto (Presto Boston Meetup 10062015)
Presto Testing Tools: Benchto & Tempto (Presto Boston Meetup 10062015)
 
Intro to Testing in Zope, Plone
Intro to Testing in Zope, PloneIntro to Testing in Zope, Plone
Intro to Testing in Zope, Plone
 
N Unit Presentation
N Unit PresentationN Unit Presentation
N Unit Presentation
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java Developers
 
LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager
 
Cli jbug
Cli jbugCli jbug
Cli jbug
 
AS7 and CLI
AS7 and CLIAS7 and CLI
AS7 and CLI
 
Bgoug 2019.11 test your pl sql - not your patience
Bgoug 2019.11   test your pl sql - not your patienceBgoug 2019.11   test your pl sql - not your patience
Bgoug 2019.11 test your pl sql - not your patience
 
POUG2019 - Test your PL/SQL - your database will love you
POUG2019 - Test your PL/SQL - your database will love youPOUG2019 - Test your PL/SQL - your database will love you
POUG2019 - Test your PL/SQL - your database will love you
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
 
Pyunit
PyunitPyunit
Pyunit
 
Unit testing
Unit testingUnit testing
Unit testing
 
Plone testingdzug tagung2010
Plone testingdzug tagung2010Plone testingdzug tagung2010
Plone testingdzug tagung2010
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best Practices
 
Testing Django APIs
Testing Django APIsTesting Django APIs
Testing Django APIs
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
 
UPC Testing talk 2
UPC Testing talk 2UPC Testing talk 2
UPC Testing talk 2
 
Testing Django Applications
Testing Django ApplicationsTesting Django Applications
Testing Django Applications
 
CMake Tutorial
CMake TutorialCMake Tutorial
CMake Tutorial
 

Mehr von Gluster.org

nfusr: a new userspace NFS client based on libnfs - Shreyas Siravara
nfusr: a new userspace NFS client based on libnfs - Shreyas Siravaranfusr: a new userspace NFS client based on libnfs - Shreyas Siravara
nfusr: a new userspace NFS client based on libnfs - Shreyas Siravara
Gluster.org
 
Facebook’s upstream approach to GlusterFS - David Hasson
Facebook’s upstream approach to GlusterFS  - David HassonFacebook’s upstream approach to GlusterFS  - David Hasson
Facebook’s upstream approach to GlusterFS - David Hasson
Gluster.org
 

Mehr von Gluster.org (20)

Automating Gluster @ Facebook - Shreyas Siravara
Automating Gluster @ Facebook - Shreyas SiravaraAutomating Gluster @ Facebook - Shreyas Siravara
Automating Gluster @ Facebook - Shreyas Siravara
 
nfusr: a new userspace NFS client based on libnfs - Shreyas Siravara
nfusr: a new userspace NFS client based on libnfs - Shreyas Siravaranfusr: a new userspace NFS client based on libnfs - Shreyas Siravara
nfusr: a new userspace NFS client based on libnfs - Shreyas Siravara
 
Facebook’s upstream approach to GlusterFS - David Hasson
Facebook’s upstream approach to GlusterFS  - David HassonFacebook’s upstream approach to GlusterFS  - David Hasson
Facebook’s upstream approach to GlusterFS - David Hasson
 
Throttling Traffic at Facebook Scale
Throttling Traffic at Facebook ScaleThrottling Traffic at Facebook Scale
Throttling Traffic at Facebook Scale
 
GlusterFS w/ Tiered XFS
GlusterFS w/ Tiered XFS  GlusterFS w/ Tiered XFS
GlusterFS w/ Tiered XFS
 
Gluster Metrics: why they are crucial for running stable deployments of all s...
Gluster Metrics: why they are crucial for running stable deployments of all s...Gluster Metrics: why they are crucial for running stable deployments of all s...
Gluster Metrics: why they are crucial for running stable deployments of all s...
 
Data Reduction for Gluster with VDO
Data Reduction for Gluster with VDOData Reduction for Gluster with VDO
Data Reduction for Gluster with VDO
 
Releases: What are contributors responsible for
Releases: What are contributors responsible forReleases: What are contributors responsible for
Releases: What are contributors responsible for
 
RIO Distribution: Reconstructing the onion - Shyamsundar Ranganathan
RIO Distribution: Reconstructing the onion - Shyamsundar RanganathanRIO Distribution: Reconstructing the onion - Shyamsundar Ranganathan
RIO Distribution: Reconstructing the onion - Shyamsundar Ranganathan
 
Native Clients, more the merrier with GFProxy!
Native Clients, more the merrier with GFProxy!Native Clients, more the merrier with GFProxy!
Native Clients, more the merrier with GFProxy!
 
Gluster: a SWOT Analysis
Gluster: a SWOT Analysis Gluster: a SWOT Analysis
Gluster: a SWOT Analysis
 
GlusterD-2.0: What's Happening? - Kaushal Madappa
GlusterD-2.0: What's Happening? - Kaushal MadappaGlusterD-2.0: What's Happening? - Kaushal Madappa
GlusterD-2.0: What's Happening? - Kaushal Madappa
 
What Makes Us Fail
What Makes Us FailWhat Makes Us Fail
What Makes Us Fail
 
Gluster as Native Storage for Containers - past, present and future
Gluster as Native Storage for Containers - past, present and futureGluster as Native Storage for Containers - past, present and future
Gluster as Native Storage for Containers - past, present and future
 
Heketi Functionality into Glusterd2
Heketi Functionality into Glusterd2Heketi Functionality into Glusterd2
Heketi Functionality into Glusterd2
 
Architecture of the High Availability Solution for Ganesha and Samba with Kal...
Architecture of the High Availability Solution for Ganesha and Samba with Kal...Architecture of the High Availability Solution for Ganesha and Samba with Kal...
Architecture of the High Availability Solution for Ganesha and Samba with Kal...
 
Challenges with Gluster and Persistent Memory with Dan Lambright
Challenges with Gluster and Persistent Memory with Dan LambrightChallenges with Gluster and Persistent Memory with Dan Lambright
Challenges with Gluster and Persistent Memory with Dan Lambright
 
Sharding: Past, Present and Future with Krutika Dhananjay
Sharding: Past, Present and Future with Krutika DhananjaySharding: Past, Present and Future with Krutika Dhananjay
Sharding: Past, Present and Future with Krutika Dhananjay
 
State of Gluster Performance
State of Gluster PerformanceState of Gluster Performance
State of Gluster Performance
 
Integration of Glusterfs in to commvault simpana
Integration of Glusterfs in to commvault simpanaIntegration of Glusterfs in to commvault simpana
Integration of Glusterfs in to commvault simpana
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Kürzlich hochgeladen (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

Practical Glusto Example

  • 1. Practical Glusto Example Jonathan Holloway Principal Quality Engineer - Red Hat Storage
  • 2. Practical Glusto Example Very Brief Intro to Glusto
  • 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
  • 16. setUpClass/tearDownClass ● ... @runs_on([['distributed', 'replicated'], ['glusterfs', 'nfs']]) class GlusterDemoTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.masternode = g.config['servers'][0] cls.client = g.config['clients'][0] cls.mountpoint = '/mnt/gluster-mount' g.run(cls.masternode, 'service glusterd start') g.run(cls.masternode, 'gluster volume start glustervol1') g.run(cls.client, 'mount /mnt/gluster-mount') ... @classmethod def tearDownClass(cls): g.run(cls.client, 'umount %s' % cls.mountpoint) g.run(cls.masternode, 'gluster volume stop glustervol1') g.run(cls.masternode, 'service glusterd stop')
  • 17. setUp/tearDown ● ... @runs_on([['distributed', 'replicated'], ['glusterfs', 'nfs']]) class GlusterDemoTest(unittest.TestCase): @classmethod def setUpClass(cls): ... def setUp(self): self.filename = '%s/%s-%s' % (self.mountpoint, self.volume, self.mount) print('nCreating file %s' % self.filename) g.run(self.client, 'touch %s' % self.filename) ... def tearDown(self): print('Removing file %s' % self.filename) g.run(self.client, 'rm -f %s' % self.filename) @classmethod def tearDownClass(cls): ...
  • 18. test_ method(s) ● ... def setUp(self): ... def test_mount_type(self): rcode, _, _ = g.run(self.client, 'mount | grep %s' % self.mount) self.assertEqual(rcode, 0, 'Mounted volume is not type %s' % self.mount) @pytest.mark.bvt def test_create_file_with_touch(self): print('nTesting file %s' % self.filename) rcode, rout, rerr = g.run(self.client, 'ls %s' % self.filename) self.assertEqual(rcode, 0, 'File does not exist') def tearDown(self): ... ...
  • 20. Run via /usr/bin/glusto ● Glusto CLI wrapper provides config file(s) to tests − $ glusto -c myconfig.yml --pytest='test_demo1.py' ● PyTest provides xUnit style output − $ glusto -c myconfig.yml --pytest='test_demo1.py --junitxml=results.xml' ● Accepts PyTest marker (-m) and filter (-k) parameters − $ glusto -c myconfig.yml --pytest='test_demo1.py -m bvt' $ glusto -c myconfig.yml --pytest='test_demo1.py -k mount'
  • 22. Info ● Contact − Email: gluster-devel@gluster.org − IRC: FreeNode #gluster-dev (loadtheacc) ● Libraries and Tests Repo − git clone http://review.gluster.org/glusto-tests − Mirrored at http://github.com/gluster/glusto-tests ● Glusto Repo and Docs − http://github.com/loadtheaccumulator/glusto − http://glusto.readthedocs.io/