From 706e37faf9b3709f0682d212994c5f21ed093cc9 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Wed, 12 Dec 2012 13:46:18 -0500 Subject: [PATCH] check_mirroring: Fix sharded stream names and add test for them. The original ones were incorrectly computed with a trailing newline character. (imported from commit 8f4e4e436104aec33e858fa7a65583a1dbc2eaff) --- bots/check-mirroring | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/bots/check-mirroring b/bots/check-mirroring index 6839c7e..67160ac 100755 --- a/bots/check-mirroring +++ b/bots/check-mirroring @@ -6,6 +6,7 @@ import os import random import logging import subprocess +import hashlib from os import path parser = optparse.OptionParser() @@ -67,23 +68,27 @@ if options.sharded: # (stream, shard_name), where sha1sum(stream).startswith(shard_name) test_streams = [ ("message", "p"), - ("tabbott-nagios-test-15", "0"), - ("tabbott-nagios-test-1", "1"), - ("tabbott-nagios-test-4", "2"), - ("tabbott-nagios-test-32", "3"), - ("tabbott-nagios-test-6", "4"), - ("tabbott-nagios-test-93", "5"), - ("tabbott-nagios-test-23", "6"), - ("tabbott-nagios-test-16", "7"), - ("tabbott-nagios-test-22", "8"), + ("tabbott-nagios-test-32", "0"), + ("tabbott-nagios-test-33", "1"), + ("tabbott-nagios-test-2", "2"), + ("tabbott-nagios-test-5", "3"), + ("tabbott-nagios-test-13", "4"), + ("tabbott-nagios-test-7", "5"), + ("tabbott-nagios-test-22", "6"), + ("tabbott-nagios-test-35", "7"), + ("tabbott-nagios-test-4", "8"), ("tabbott-nagios-test-3", "9"), - ("tabbott-nagios-test-2", "a"), - ("tabbott-nagios-test-10", "b"), - ("tabbott-nagios-test-14", "c"), - ("tabbott-nagios-test-8", "d"), - ("tabbott-nagios-test-13", "e"), - ("tabbott-nagios-test-45", "f"), + ("tabbott-nagios-test-1", "a"), + ("tabbott-nagios-test-49", "b"), + ("tabbott-nagios-test-34", "c"), + ("tabbott-nagios-test-12", "d"), + ("tabbott-nagios-test-11", "e"), + ("tabbott-nagios-test-9", "f"), ] + for (stream, test) in test_streams: + if stream == "message": + continue + assert(hashlib.sha1(stream).hexdigest().startswith(test)) else: test_streams = [ ("message", "p"),