class RsdnsEventletTests(object): """Makes sure the RSDNS client can be used from multiple green threads.""" def assert_record_created(self, index): msg = "Record %d wasn't created!" % index assert_true(index in self.new_records, msg) @before_class(enabled=WHITE_BOX and should_run_rsdns_tests()) def create_driver(self): """Creates the DNS Driver used in subsequent tests.""" self.driver = utils.import_object(FLAGS.dns_driver) self.entry_factory = RsDnsInstanceEntryFactory() self.test_uuid = uuid.uuid4().hex self.new_records = {} def make_record(self, index): """Creates a record with the form 'eventlet-%s-%d'.""" uuid = "eventlet-%s-%d" % (self.test_uuid, index) instance = {'uuid': uuid} entry = self.entry_factory.create_entry(instance) entry.name = uuid + "." + self.entry_factory.default_dns_zone.name entry.content = "123.123.123.123" self.driver.create_entry(entry) self.new_records[index] = True @test(enabled=WHITE_BOX and should_run_rsdns_tests()) def use_dns_from_a_single_thread(self): """Add DNS records one at a time.""" self.new_records = {} for index in range(-1, -5, -1): self.make_record(index) self.assert_record_created(index) @test(enabled=WHITE_BOX and should_run_rsdns_tests()) def use_dns_from_multiple_greenthreads(self): """Add multiple DNS records at once.""" self.new_records = {} def make_record(index): def __cb(): self.make_record(index) self.assert_record_created(index) return index return __cb pile = eventlet.GreenPile() indices = range(1, 4) for index in indices: pile.spawn(make_record(index)) list(pile) # Wait for them to finish for index in indices: self.assert_record_created(index)
"fake.dbaas.api.mgmt.allaccounts" ] proboscis.register(groups=["heavy_blackbox"], depends_on_groups=heavy_black_box_groups) # This is for the old white-box tests... host_ovz_groups = [ "dbaas.guest", compute_reboot.GROUP, "dbaas.guest.dns", SCHEDULER_DRIVER_GROUP, VOLUMES_DRIVER, guest_initialize_failure.GROUP, volume_reaping.GROUP ] if WHITE_BOX and util.should_run_rsdns_tests(): host_ovz_groups += ["rsdns.conversion", "rsdns.domains", "rsdns.eventlet"] proboscis.register(groups=["host.ovz"], depends_on_groups=host_ovz_groups) atexit.register(_clean_up) # Set up pretty colors. from nose import config from nose import core from tests.colorizer import NovaTestResult from tests.colorizer import NovaTestRunner from proboscis.case import TestResult as ProboscisTestResult from proboscis import SkipTest
import httplib2 httplib2.debuglevel = 1 @test def can_auth(self): self.client = create_client_with_flag_values() self.client.authenticate() @test(depends_on=[can_auth]) def list_domains(self): domains = self.client.domains.list() print(domains) @wb_test(groups=["rsdns.domains"], depends_on=[ClientTests], enabled=WHITE_BOX and should_run_rsdns_tests()) class RsDnsDriverTests(object): """Tests the RS DNS Driver.""" def create_domain_if_needed(self): """Adds the domain specified in the flags.""" print("Creating domain %s" % self.driver.default_dns_zone.name) future = self.driver.dns_client.domains.create( self.driver.default_dns_zone.name) while not future.ready: time.sleep(2) print("Got something: %s" % future.resource) with open('/home/vagrant/dns_resource.txt', 'w') as f: f.write('%r\n' % future.result[0].id) global DNS_DOMAIN_ID DNS_DOMAIN_ID = future.result[0].id
"dbaas.api.instances.delete", "dbaas.api.instances.status", "dbaas.api.instances.down", "dbaas.api.mgmt.hosts.update", "fake.dbaas.api.mgmt.instances", "fake.dbaas.api.mgmt.accounts.broken", "fake.dbaas.api.mgmt.allaccounts" ] proboscis.register(groups=["heavy_blackbox"], depends_on_groups=heavy_black_box_groups) # This is for the old white-box tests... host_ovz_groups = [ "dbaas.guest", compute_reboot.GROUP, "dbaas.guest.dns", SCHEDULER_DRIVER_GROUP, VOLUMES_DRIVER, guest_initialize_failure.GROUP, volume_reaping.GROUP ] if WHITE_BOX and util.should_run_rsdns_tests(): host_ovz_groups += [ "rsdns.conversion", "rsdns.domains", "rsdns.eventlet" ] proboscis.register(groups=["host.ovz"], depends_on_groups=host_ovz_groups) atexit.register(_clean_up) # Set up pretty colors. from nose import config from nose import core from tests.colorizer import NovaTestResult from tests.colorizer import NovaTestRunner from proboscis.case import TestResult as ProboscisTestResult
httplib2.debuglevel = 1 @test def can_auth(self): self.client = create_client_with_flag_values() self.client.authenticate() @test(depends_on=[can_auth]) def list_domains(self): domains = self.client.domains.list() print(domains) @wb_test(groups=["rsdns.domains"], depends_on=[ClientTests], enabled=WHITE_BOX and should_run_rsdns_tests()) class RsDnsDriverTests(object): """Tests the RS DNS Driver.""" def create_domain_if_needed(self): """Adds the domain specified in the flags.""" print("Creating domain %s" % self.driver.default_dns_zone.name) future = self.driver.dns_client.domains.create( self.driver.default_dns_zone.name) while not future.ready: time.sleep(2) print("Got something: %s" % future.resource) with open('/home/vagrant/dns_resource.txt', 'w') as f: f.write('%r\n' % future.result[0].id) global DNS_DOMAIN_ID DNS_DOMAIN_ID = future.result[0].id print("The domain should have been created with id=%s" % DNS_DOMAIN_ID)