From e7a469133caf37bb5056677ac47f495c52abfbf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicki=20K=C5=99=C3=AD=C5=BEek?= Date: Wed, 28 Aug 2024 15:03:27 +0200 Subject: [PATCH] Test cipher-suites after zone transfers complete Ensure the zone transfers have completed (successfully or not) before running the test cases, because they assume zone transfers have been done. (cherry picked from commit 23fb6159636241c1e7e66ba16d5728c28bcd6b97) --- .gitlab-ci.yml | 2 +- .../system/cipher-suites/tests_cipher_suites.py | 16 +++++++++++++++- bin/tests/system/vulture_ignore_list.py | 13 +++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 bin/tests/system/vulture_ignore_list.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d0722c7921..a6c4584cfc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -587,7 +587,7 @@ pylint: script: - pylint --rcfile $CI_PROJECT_DIR/.pylintrc $(git ls-files '*.py' | grep -vE '(ans\.py|dangerfile\.py|^bin/tests/system/|^contrib/)') # Ignore Pylint wrong-import-position error in system test to enable use of pytest.importorskip - - pylint --rcfile $CI_PROJECT_DIR/.pylintrc --disable=wrong-import-position $(git ls-files 'bin/tests/system/*.py' | grep -vE 'ans\.py') + - pylint --rcfile $CI_PROJECT_DIR/.pylintrc --disable=wrong-import-position $(git ls-files 'bin/tests/system/*.py' | grep -vE '(ans\.py|vulture_ignore_list\.py)') reuse: <<: *precheck_job diff --git a/bin/tests/system/cipher-suites/tests_cipher_suites.py b/bin/tests/system/cipher-suites/tests_cipher_suites.py index 255fc326ac..1be3aafbbc 100644 --- a/bin/tests/system/cipher-suites/tests_cipher_suites.py +++ b/bin/tests/system/cipher-suites/tests_cipher_suites.py @@ -9,6 +9,8 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. +import re + import pytest pytest.importorskip("dns", minversion="2.5.0") @@ -26,6 +28,17 @@ pytestmark = pytest.mark.extra_artifacts( ) +@pytest.fixture(scope="module") +def transfers_complete(servers): + for zone in ["example", "example-aes-128", "example-aes-256", "example-chacha-20"]: + pattern = re.compile( + f"transfer of '{zone}/IN' from 10.53.0.1#[0-9]+: Transfer completed" + ) + for ns in ["ns2", "ns3", "ns4", "ns5"]: + with servers[ns].watch_log_from_start() as watcher: + watcher.wait_for_line(pattern) + + @pytest.mark.requires_zones_loaded("ns1", "ns2", "ns3", "ns4", "ns5") @pytest.mark.parametrize( "qname,ns,rcode", @@ -69,7 +82,8 @@ pytestmark = pytest.mark.extra_artifacts( ), ], ) -def test_cipher_suites_tls_xfer(qname, ns, rcode): +# pylint: disable=redefined-outer-name,unused-argument +def test_cipher_suites_tls_xfer(qname, ns, rcode, transfers_complete): msg = dns.message.make_query(qname, "AXFR") ans = isctest.query.tls(msg, f"10.53.0.{ns}") assert ans.rcode() == rcode diff --git a/bin/tests/system/vulture_ignore_list.py b/bin/tests/system/vulture_ignore_list.py new file mode 100644 index 0000000000..7682a478e6 --- /dev/null +++ b/bin/tests/system/vulture_ignore_list.py @@ -0,0 +1,13 @@ +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# SPDX-License-Identifier: MPL-2.0 +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at https://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +transfers_complete # unused function (cipher-suites/tests_cipher_suites.py:31) +transfers_complete # unused variable (cipher-suites/tests_cipher_suites.py:86)