system-config/testinfra/test_zuul_scheduler.py
Clark Boylan 7ad3125814 Add robots.txt to Zuul web
This adds a robots.txt that kindly asks bots to not crawl anything on
zuul. We've seen soem bots crawling which leads to them trolling the
build logs which seems like overkill and increases bandwidth usage in
our donor clouds. Ask them to stop and quiet everything down a bit.

Change-Id: I88d85c7a51159b5b020aa179e24acec55fb42931
2024-04-03 13:31:06 -07:00

35 lines
1.1 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
import socket
testinfra_hosts = ['zuul02.opendev.org']
def test_iptables(host):
rules = util.verify_iptables(host)
ips = util.get_ips('ze01.opendev.org', socket.AF_INET)
assert len(ips) > 0
for rule in rules:
assert '--dport 7900' not in rule
def test_zuul_robots(host):
cmd = host.run('curl --insecure '
'--resolve zuul.opendev.org:443:127.0.0.1 '
'https://zuul.opendev.org/robots.txt')
assert 'Disallow: /' in cmd.stdout