Home | History | Annotate | Line # | Download | only in xfer
      1 # Copyright (C) Internet Systems Consortium, Inc. ("ISC")
      2 #
      3 # SPDX-License-Identifier: MPL-2.0
      4 #
      5 # This Source Code Form is subject to the terms of the Mozilla Public
      6 # License, v. 2.0.  If a copy of the MPL was not distributed with this
      7 # file, you can obtain one at https://mozilla.org/MPL/2.0/.
      8 #
      9 # See the COPYRIGHT file distributed with this work for additional
     10 # information regarding copyright ownership.
     11 
     12 import time
     13 
     14 import isctest
     15 
     16 
     17 def bootstrap():
     18     isctest.log.info("Restart ns1 with -T transferstuck")
     19     with open("ns1/named.args", "w", encoding="utf-8") as argsfile:
     20         argsfile.write(
     21             "-D xfer-ns1 -m record -c named.conf -d 99 -g -T maxcachesize=2097152 -T transferinsecs -T transferstuck"
     22         )
     23     return {
     24         "enable_some_zones": False,
     25         "enable_only_axfr_max_idle_time": True,
     26     }
     27 
     28 
     29 def test_retransfer_with_transferstuck(ns6):
     30     isctest.log.info("Test max-transfer-idle-in with 50 seconds timeout")
     31     start_time = time.time()
     32     with ns6.watch_log_from_here(timeout=60) as watcher:
     33         ns6.rndc("retransfer -force axfr-max-idle-time.")
     34         watcher.wait_for_line("maximum idle time exceeded: timed out")
     35     end_time = time.time()
     36     assert (
     37         50 <= (end_time - start_time) < 59
     38     ), "max-transfer-idle-in did not wait for the expected time"
     39