Bug 1148528 - Add buildbot-configs test to prevent removing build builders without removing their associated testers. r=rail
authorArmen Zambrano Gasparnian <armenzg@mozilla.com>
Fri, 27 Mar 2015 16:59:29 -0400
changeset 11857 05c0f42e3e6770655fb9ec7b4c5bd79fdad64042
parent 11856 73a7bd03095232f2d04ac4f1018206e5fc3b5373
child 11858 df468d1dc88d4f0612be16b6894deaa5294e29d4
push id3
push userahalberstadt@mozilla.com
push dateWed, 29 Apr 2015 14:58:39 +0000
reviewersrail
bugs1148528
Bug 1148528 - Add buildbot-configs test to prevent removing build builders without removing their associated testers. r=rail
test/test_no_testers_without_builders.py
tox.ini
tox_env.sh
new file mode 100644
--- /dev/null
+++ b/test/test_no_testers_without_builders.py
@@ -0,0 +1,28 @@
+'''
+This script generates a list of buildbot test builders that do not
+have a build to trigger it.
+'''
+import os
+
+from mozci.platforms import determine_upstream_builder
+from mozci.sources.allthethings import fetch_allthethings_data
+
+
+def test_no_testers_without_builders():
+    # We need to assert that allthethings.json has been generated
+    # before running this test rather than fetching the one from the server
+    # This is important as we want to test against the latest list of builders
+    assert os.path.exists("allthethings.json")
+
+    orphan_builders = []
+
+    j = fetch_allthethings_data(verify=False)
+    builders = j["builders"].keys()
+    assert builders is not None, "The list of builders cannot be empty."
+
+    for builder in sorted(builders):
+        if determine_upstream_builder(builder) is None:
+            orphan_builders.append(builder)
+
+    assert len(orphan_builders) == 0, \
+        "There are downstream builders without upstream builders to trigger them."
--- a/tox.ini
+++ b/tox.ini
@@ -13,27 +13,30 @@ deps =
     MySQL-python==1.2.3
     SQLAlchemy==0.6.4
     Twisted==10.1.0
     amqplib==0.6.1
     anyjson==0.3
     argparse==1.1
     carrot==0.10.7
     distribute==0.6.14
+    mozci==0.4.1
     pyOpenSSL==0.14
     pyasn1==0.0.11a
     pycrypto==2.3
+    pytest==2.7.0
     pytz==2011d
     wsgiref==0.1.2
     zope.interface==3.6.1
     MozillaPulse==0.80
 
 commands =
     ./tox_env.sh "{toxinidir}" "{toxworkdir}"
     ./test-masters.sh -e
+    py.test test
 
 
 [testenv:pep8]
 # Don't fail on pep8 yet
 # Would love to enable failing this by default - See:
 # https://bitbucket.org/hpk42/tox/issue/124/ignore-command-exit-codes
 deps=
     pep8
--- a/tox_env.sh
+++ b/tox_env.sh
@@ -12,14 +12,16 @@ function hgme {
         hg status -un0 -R "${TOX_WORK_DIR}/${repo}" | xargs rm -rf
         hg pull -u -R "${TOX_WORK_DIR}/${repo}"
     fi
 }
 
 hgme tools
 hgme buildbotcustom
 hgme buildbot
+hgme braindump
 
 hg -R "${TOX_WORK_DIR}/buildbot" checkout production-0.8
 cd "${TOX_WORK_DIR}/buildbot/master" && python setup.py install
 rm -rf "${TOX_INI_DIR}/test-output"
 rm -rf "${TOX_INI_DIR}/run/shm/buildbot"
 mkdir -p "${TOX_INI_DIR}/run/shm/buildbot"
+cd ${TOX_INI_DIR} && "${TOX_WORK_DIR}/braindump/buildbot-related/dump_allthethings.sh"