]>
Commit | Line | Data |
---|---|---|
8c87daac RG |
1 | #!/usr/bin/env python |
2 | import base64 | |
3 | import socket | |
4 | import time | |
5 | import dns | |
6 | from dnsdisttests import DNSDistTest | |
7 | from dnsdistDynBlockTests import DynBlocksTest, waitForMaintenanceToRun, _maintenanceWaitTime | |
8 | ||
9 | class TestDynBlockGroupServFailsRatio(DynBlocksTest): | |
10 | ||
11 | # we need this period to be quite long because we request the valid | |
12 | # queries to be still looked at to reach the 20 queries count! | |
13 | _dynBlockPeriod = 6 | |
14 | _config_params = ['_dynBlockPeriod', '_dynBlockDuration', '_testServerPort'] | |
15 | _config_template = """ | |
16 | local dbr = dynBlockRulesGroup() | |
17 | dbr:setRCodeRatio(DNSRCode.SERVFAIL, 0.2, %d, "Exceeded query rate", %d, 20) | |
18 | ||
19 | function maintenance() | |
20 | dbr:apply() | |
21 | end | |
22 | ||
23 | newServer{address="127.0.0.1:%s"} | |
24 | """ | |
25 | ||
26 | def testDynBlocksServFailRatio(self): | |
27 | """ | |
28 | Dyn Blocks (group): Server Failure Ratio | |
29 | """ | |
30 | name = 'servfailratio.group.dynblocks.tests.powerdns.com.' | |
31 | self.doTestRCodeRatio(name, dns.rcode.SERVFAIL, 10, 10) |