Example #1
0
    def export_domain(self):
        """This runs the entire export domain sequence:

            1. POST /zones/ID/tasks/export
            2. GET /zones/tasks/exports/ID (poll for COMPLETED)
            3. GET /zones/tasks/export (Accept: text/dns)
        """
        gevent.spawn(
            GreenletManager.get().tracked_greenlet,
            lambda: self._do_export_domain(),
        )
Example #2
0
    def export_domain(self):
        """This runs the entire export domain sequence:

            1. POST /zones/ID/tasks/export
            2. GET /zones/tasks/exports/ID (poll for COMPLETED)
            3. GET /zones/tasks/export (Accept: text/dns)
        """
        gevent.spawn(
            GreenletManager.get().tracked_greenlet,
            lambda: self._do_export_domain(),
        )
Example #3
0
 def create_record(self):
     """POST /zones/ID/recordsets"""
     gevent.spawn(
         GreenletManager.get().tracked_greenlet,
         lambda: self._do_create_record(),
     )
Example #4
0
 def remove_record(self):
     """DELETE /zones/ID/recordsets/ID"""
     gevent.spawn(
         GreenletManager.get().tracked_greenlet,
         lambda: self._do_remove_record(),
     )
Example #5
0
 def modify_record(self):
     gevent.spawn(
         GreenletManager.get().tracked_greenlet,
         lambda: self._do_modify_record(),
     )
Example #6
0
 def modify_domain(self):
     """PATCH /zones/ID"""
     gevent.spawn(
         GreenletManager.get().tracked_greenlet,
         lambda: self._do_modify_domain(),
     )
Example #7
0
 def import_zone(self):
     """POST /zones/tasks/import, Content-type: text/dns"""
     gevent.spawn(
         GreenletManager.get().tracked_greenlet,
         lambda: self._do_import_zone(),
     )
Example #8
0
 def create_domain(self):
     """POST /zones"""
     gevent.spawn(
         GreenletManager.get().tracked_greenlet,
         lambda: self._do_create_domain(),
     )
Example #9
0
 def remove_domain(self):
     """DELETE /zones/ID"""
     gevent.spawn(
         GreenletManager.get().tracked_greenlet,
         lambda: self._do_remove_domain(),
     )
Example #10
0
 def import_zone(self):
     """POST /zones/tasks/import, Content-type: text/dns"""
     gevent.spawn(
         GreenletManager.get().tracked_greenlet,
         lambda: self._do_import_zone(),
     )
Example #11
0
 def modify_domain(self):
     """PATCH /zones/ID"""
     gevent.spawn(
         GreenletManager.get().tracked_greenlet,
         lambda: self._do_modify_domain(),
     )
Example #12
0
 def create_domain(self):
     """POST /zones"""
     gevent.spawn(
         GreenletManager.get().tracked_greenlet,
         lambda: self._do_create_domain(),
     )
Example #13
0
if not insight.is_master():
    # TODO: the tenant id is actually the username. it should be named so.
    SMALL_TENANTS = [Tenant(id=id, api_key=api_key, type=Tenant.SMALL)
                      for id, api_key in CONFIG.small_tenants]
    LARGE_TENANTS = [Tenant(id=id, api_key=api_key, type=Tenant.LARGE)
                     for id, api_key in CONFIG.large_tenants]
    ALL_TENANTS = SMALL_TENANTS + LARGE_TENANTS

    # the greenlet_manager keeps track of greenlets spawned for polling
    # todo: it's hard to ensure cleanup_greenlets gets run before the stats
    # are persisted to a file...

    # ensure cleanup when the test is stopped
    locust.events.locust_stop_hatching += \
        lambda: GreenletManager.get().cleanup_greenlets()
    # ensure cleanup on interrupts
    locust.events.quitting += \
        lambda: GreenletManager.get().cleanup_greenlets()

class LargeTasks(ZoneTasks, RecordsetTasks):

    tasks = {
        ZoneTasks.get_domain_by_id:   CONFIG.large_weights.get_domain_by_id,
        ZoneTasks.get_domain_by_name: CONFIG.large_weights.get_domain_by_name,
        ZoneTasks.list_domains:       CONFIG.large_weights.list_domain,
        ZoneTasks.import_zone:        CONFIG.large_weights.import_zone,
        ZoneTasks.export_domain:      CONFIG.large_weights.export_domain,
        ZoneTasks.create_domain:      CONFIG.large_weights.create_domain,
        ZoneTasks.modify_domain:      CONFIG.large_weights.modify_domain,
        ZoneTasks.remove_domain:      CONFIG.large_weights.remove_domain,
Example #14
0
 def create_record(self):
     """POST /zones/ID/recordsets"""
     gevent.spawn(
         GreenletManager.get().tracked_greenlet,
         lambda: self._do_create_record(),
     )
Example #15
0
 def modify_record(self):
     gevent.spawn(
         GreenletManager.get().tracked_greenlet,
         lambda: self._do_modify_record(),
     )
Example #16
0
        Tenant(id=id, api_key=api_key, type=Tenant.SMALL)
        for id, api_key in CONFIG.small_tenants
    ]
    LARGE_TENANTS = [
        Tenant(id=id, api_key=api_key, type=Tenant.LARGE)
        for id, api_key in CONFIG.large_tenants
    ]
    ALL_TENANTS = SMALL_TENANTS + LARGE_TENANTS

    # the greenlet_manager keeps track of greenlets spawned for polling
    # todo: it's hard to ensure cleanup_greenlets gets run before the stats
    # are persisted to a file...

    # ensure cleanup when the test is stopped
    locust.events.locust_stop_hatching += \
        lambda: GreenletManager.get().cleanup_greenlets()
    # ensure cleanup on interrupts
    locust.events.quitting += \
        lambda: GreenletManager.get().cleanup_greenlets()


class LargeTasks(ZoneTasks, RecordsetTasks):

    tasks = {
        ZoneTasks.get_domain_by_id: CONFIG.large_weights.get_domain_by_id,
        ZoneTasks.get_domain_by_name: CONFIG.large_weights.get_domain_by_name,
        ZoneTasks.list_domains: CONFIG.large_weights.list_domain,
        ZoneTasks.import_zone: CONFIG.large_weights.import_zone,
        ZoneTasks.export_domain: CONFIG.large_weights.export_domain,
        ZoneTasks.create_domain: CONFIG.large_weights.create_domain,
        ZoneTasks.modify_domain: CONFIG.large_weights.modify_domain,