3d6cefe9dd
Tests that call host.backend.get_hostname() to switch on test assertions are likely to fail open. Stop using this in zuul tests and instead add new files for each of the types of zuul hosts where we want to do additional verification. Share the iptables related code between all the tests that perform iptables checks. Also, some extra merger test and some negative assertions are added. Move multi-node-hosts-file to after set-hostname. multi-node-hosts-file is designed to append, and set-hostname is designed to write. When we write the gate version of the inventory, map the nodepool private_ipv4 address as the public_v4 address of the inventory host since that's what is written to /etc/hosts, and is therefore, in the context of a gate job, the "public" address. Change-Id: Id2dad08176865169272a8c135d232c2b58a7a2c1
32 lines
1.0 KiB
Python
32 lines
1.0 KiB
Python
# Copyright 2018 Red Hat, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
import util
|
|
|
|
testinfra_hosts = ['ze01.opendev.org']
|
|
|
|
|
|
def test_iptables(host):
|
|
rules = util.verify_iptables(host)
|
|
|
|
needed_rules = [
|
|
'-A openstack-INPUT -p tcp -m state --state NEW -m tcp --dport 79 -j ACCEPT',
|
|
'-A openstack-INPUT -p tcp -m state --state NEW -m tcp --dport 7900 -j ACCEPT',
|
|
]
|
|
for rule in needed_rules:
|
|
assert rule in rules
|
|
|
|
for rule in rules:
|
|
assert '--dport 4730' not in rule
|