Home | History | Annotate | Line # | Download | only in names
      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 pytest
     13 
     14 pytest.importorskip("dns", minversion="2.7.0")
     15 
     16 import isctest
     17 
     18 
     19 # The query answer sent with compression disabled should have a size that is
     20 # about twice as large as the answer with compression enabled, while
     21 # maintaining identical content.
     22 def test_names():
     23     msg = isctest.query.create("example.", "MX")
     24     # Getting message size with compression enabled
     25     res_enabled = isctest.query.tcp(msg, ip="10.53.0.1", source="10.53.0.1")
     26     # Getting message size with compression disabled
     27     res_disabled = isctest.query.tcp(msg, ip="10.53.0.1", source="10.53.0.2")
     28     # Checking if responses are identical content-wise
     29     isctest.check.rrsets_equal(res_enabled.answer, res_disabled.answer)
     30     # Checking if message with compression disabled is significantly (say 70%) larger
     31     assert len(res_disabled.wire) > len(res_enabled.wire) * 1.7
     32