当前位置: 首页>>代码示例>>Python>>正文


Python Test.sleep方法代码示例

本文整理汇总了Python中dnstest.test.Test.sleep方法的典型用法代码示例。如果您正苦于以下问题:Python Test.sleep方法的具体用法?Python Test.sleep怎么用?Python Test.sleep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dnstest.test.Test的用法示例。


在下文中一共展示了Test.sleep方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: check_log

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import sleep [as 别名]
t.link(zone, master, slave)
t.start()
slave.stop()
try:
	os.remove(zone_path)
except:
	pass
slave.start()
slave.zone_wait(zone)

#check that the zone file has not been flushed
if os.path.exists(zone_path):
    check_log("Zonefile created too soon: " + str(os.stat(zone_path).st_ctime))
    set_err("SOON FLUSH")

t.sleep(FLUSH_SLEEP) #point of first flush ~ 5s
#check that the zone file has been flushed
if not os.path.exists(zone_path):
    check_log("Zonefile not created")
    set_err("NOT FLUSHED")

prev_mtime = os.stat(zone_path).st_mtime

master.update_zonefile(zone, random=True)
master.reload()
t.sleep(FLUSH_SLEEP) #point of second flush ~ 10s

last_mtime = os.stat(zone_path).st_mtime

#check that the zone file has been flushed after transfer
if prev_mtime == last_mtime:
开发者ID:gitter-badger,项目名称:knot,代码行数:33,代码来源:test.py

示例2: test_expire

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import sleep [as 别名]
EXPIRE_SLEEP = 15

master = t.server("knot")
slave = t.server("knot")
slave.tcp_idle_timeout = "1s"

t.link(zone, master, slave)

t.start()

master.zone_wait(zone)
slave.zone_wait(zone)

# expire by shutting down the master
master.stop()
t.sleep(EXPIRE_SLEEP);
test_expire(zone, slave)

# bring back master (notifies slave)
master.start()
master.zone_wait(zone)
slave.zone_wait(zone)

# expire by breaking AXFR
break_xfrout(master)
master.update_zonefile(zone, version=1)
master.reload()
t.sleep(EXPIRE_SLEEP);
test_expire(zone, slave)

t.stop()
开发者ID:gitter-badger,项目名称:knot,代码行数:33,代码来源:test.py

示例3:

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import sleep [as 别名]
# Enable autosigning.
master.dnssec_enable = True
master.gen_key(zone, ksk=True, alg="NSEC3RSASHA1")
master.gen_key(zone, alg="NSEC3RSASHA1")
master.gen_key(zone, ksk=True, alg="RSASHA256")
master.gen_key(zone, alg="RSASHA256")
master.gen_confile()
master.start()

# Wait for changed zone and flush.
new_serial = master.zone_wait(zone, old_serial)
slave.zone_wait(zone, old_serial)
t.xfr_diff(master, slave, zone)
master.flush()
t.sleep(1)

# Check absence of NSEC3PARAM record.
resp = master.dig(zone, "NSEC3PARAM", dnssec=True)
compare(resp.count(), 0, "NSEC3PARAM count")

# Check presence of DNSKEYs.
resp = master.dig(zone, "DNSKEY", dnssec=True)
compare(resp.count(), 4, "DNSKEY count")

# Check NSEC presence.
master.check_nsec(zone)

master.backup_zone(zone)

# Verify signed zone file.
开发者ID:dnstap,项目名称:knot,代码行数:32,代码来源:test.py

示例4: range

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import sleep [as 别名]
slave = t.server("bind")
zones = t.zone_rnd(5, records=50) + t.zone("wild.") + \
        t.zone("cname-loop.") + t.zone("records.")

t.link(zones, master, slave, ixfr=True)

t.start()

# Wait for AXFR to slave server.
serials_init = master.zones_wait(zones)
slave.zones_wait(zones)

serials_prev = serials_init
for i in range(4):
    # Update zone files on master.
    for zone in zones:
        master.update_zonefile(zone, random=True)

    master.reload()
    t.sleep(5)

    # Wait for IXFR to slave.
    serials = master.zones_wait(zones, serials_prev)
    slave.zones_wait(zones, serials_prev)
    serials_prev = serials

    # Compare IXFR between servers.
    t.xfr_diff(master, slave, zones, serials_init)

t.end()
开发者ID:dnstap,项目名称:knot,代码行数:32,代码来源:test.py

示例5: Test

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import sleep [as 别名]
from dnstest.test import Test
from dnstest.utils import *

t = Test()

master = t.server("bind")
slave = t.server("knot")

zone = t.zone("example.com.", storage=".")
t.link(zone, master, slave)

# Load newer zone to the slave
slave.update_zonefile(zone, version=1)

t.start()

serial_master = master.zone_wait(zone)
serial_slave = slave.zone_wait(zone)

# Check that the slave's serial is larger than master's
assert serial_master <= serial_slave

# Force refresh
slave.ctl("zone-retransfer example.com.")
t.sleep(2)

serial_slave = slave.zone_wait(zone)
compare(serial_slave, serial_master, "Serial after retransfer")

t.end()
开发者ID:idtek,项目名称:knot,代码行数:32,代码来源:test.py

示例6: Test

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import sleep [as 别名]
#!/usr/bin/env python3

'''Test for Knot clean-up after interruption of AXFR from Bind'''

from dnstest.test import Test
from dnstest.utils import *

t = Test()

master = t.server("bind")
slave = t.server("knot")
zones = t.zone_rnd(1, dnssec=False, records=50000)

t.link(zones, master, slave)

t.start()

t.sleep(2)
check_log("Killing master %s" % master.name)
master.proc.kill()
t.sleep(5)

t.end()
开发者ID:dnstap,项目名称:knot,代码行数:25,代码来源:test.py

示例7: check_log

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import sleep [as 别名]
# parameters
ZONE = "example.com"
KEYID = "712d0d0d57fa0aa006b5e20cd84e23941e5f3ab2"
WAIT_SIGN = 2

#
# Common cases
#

check_log("Common cases")

# key not published, not active
key_set(knot, ZONE, KEYID, publish="+10y", active="+10y")
t.start()
t.sleep(WAIT_SIGN)
check_zone(knot, False, False, "not published, not active")

# key published, not active
key_set(knot, ZONE, KEYID, publish="-10y")
knot.reload()
t.sleep(WAIT_SIGN)
check_zone(knot, True, False, "published, not active")

# key published, active
key_set(knot, ZONE, KEYID, active="-10y")
knot.reload()
t.sleep(WAIT_SIGN)
check_zone(knot, True, True, "published, active")

# key published, inactive
开发者ID:gitter-badger,项目名称:knot,代码行数:32,代码来源:test.py

示例8: flood

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import sleep [as 别名]
# set journal limit for one of the slaves
slaves[0].ixfr_fslimit = "500k"

for s in slaves:
    t.link(zone, master, s, ddns=True, ixfr=True)

t.start()

for s in slaves + [master]:
    s.zone_wait(zone)

# flood server with updates
last_rr = flood(master, zone)

# wait for update and ixfr processing
t.sleep(10)

# restart servers and dig for last change
for s in slaves + [master]:
    s.stop()
    s.start()
    s.zone_wait(zone)
    resp = s.dig(last_rr[0], "TXT")
    resp.check(rdata = last_rr[3])

# check journal sizes
st = os.stat(master.dir + "/" + zone[0].name.lower() + "diff.db")
if st.st_size > 1050 * 1024:
    detail_log("Journal too big, should be max 800k, is: " + str(st.st_size // 1024) + "k")
    set_err("JOURNAL SIZE OVERFLOW")
开发者ID:jkadlec,项目名称:knot-dns-zoneapi,代码行数:32,代码来源:test.py

示例9: key_settime

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import sleep [as 别名]
shutil.copytree(os.path.join(t.data_dir, "keys"), knot.keydir)

# parameters
key_file = os.path.join(knot.keydir, "test.private")
date_past = "19700101000001"
date_future = "20400101000000"
WAIT_SIGN = 0

#
# Common cases
#

# key not published, not active
key_settime(key_file, Publish=date_future, Activate=date_future)
t.start()
t.sleep(WAIT_SIGN)
check_zone(knot, False, False)

# key published, not active
key_settime(key_file, Publish=date_past)
knot.reload()
t.sleep(WAIT_SIGN)
check_zone(knot, True, False)

# key published, active
key_settime(key_file, Activate=date_past)
knot.reload()
t.sleep(WAIT_SIGN)
check_zone(knot, True, True)

# key published, inactive
开发者ID:dnstap,项目名称:knot,代码行数:33,代码来源:test.py

示例10: compare

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import sleep [as 别名]
t.link(nsec3_zone, master)

t.start()

# Get zone serial.
old_nsec_serial = master.zone_wait(nsec_zone)
old_nsec3_serial = master.zone_wait(nsec3_zone)

# Enable autosigning.
master.dnssec_enable = True
master.use_keys(nsec_zone)
master.use_keys(nsec3_zone)
master.gen_confile()
master.reload()

t.sleep(4)

new_nsec_serial = master.zone_wait(nsec_zone)
new_nsec3_serial = master.zone_wait(nsec3_zone)

# Check if the zones are resigned.
if compare(old_nsec_serial, new_nsec_serial,
           "%s SOA serial (NSEC)" % nsec_zone[0].name):
    resp = master.dig(nsec_zone, "IXFR", serial=old_nsec_serial)
    for rr in resp.resp:
        detail_log(rr)

if compare(old_nsec3_serial, new_nsec3_serial,
           "%s SOA serial (NSEC3)" % nsec3_zone[0].name):
    resp = master.dig(nsec3_zone, "IXFR", serial=old_nsec3_serial)
    for rr in resp.resp:
开发者ID:dnstap,项目名称:knot,代码行数:33,代码来源:test.py

示例11: Test

# 需要导入模块: from dnstest.test import Test [as 别名]
# 或者: from dnstest.test.Test import sleep [as 别名]
t = Test()

master = t.server("bind")
slave = t.server("knot")
zones = t.zone_rnd(400, records=10, dnssec=False)

t.link(zones, master, slave, ixfr=True)

t.start()

# Wait for AXFR to slave server.
serials_init = master.zones_wait(zones)
slave.zones_wait(zones)

# Update zone files on master.
for zone in zones:
    master.update_zonefile(zone, random=True)

master.reload()

t.sleep(30)

# Wait for IXFR to slave.
master.zones_wait(zones, serials_init)
slave.zones_wait(zones, serials_init)

# Compare IXFR between servers.
t.xfr_diff(master, slave, zones, serials_init)

t.end()
开发者ID:dnstap,项目名称:knot,代码行数:32,代码来源:test.py


注:本文中的dnstest.test.Test.sleep方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。