Repository: buildbot/buildbot

Issue:
buildbot.test.integration.test_trigger.TriggeringMaster.test_trigger is flaky
This ticket is a migrated Trac ticket [3339](http://trac.buildbot.net/ticket/3339)

People contributed to the original ticket: @djmitche, @sa2ajj
Ticket created on: `Aug 25 2015`
Ticket last modified on: `Sep 01 2015`

---

And it causes **two** errors:


    [FAIL]
    Traceback (most recent call last):
      File "/home/buildbot/slave/py27-tw1320/sandbox-python2.7-Twisted==13.2.0samigr-0.7.1/lib/python2.7/site-packages/twisted/internet/defer.py", line 1099, in _inlineCallbacks
        result = g.send(result)
      File "/home/buildbot/slave/py27-tw1320/build/master/buildbot/test/integration/test_trigger.py", line 61, in test_trigger
        self.assertEqual(dump.getvalue(), expectedOutput % dict(loglines=loglines))
      File "/home/buildbot/slave/py27-tw1320/sandbox-python2.7-Twisted==13.2.0samigr-0.7.1/lib/python2.7/site-packages/twisted/trial/_synctest.py", line 356, in assertEqual
        % (msg, pformat(first), pformat(second)))
    twisted.trial.unittest.[[FailTest]]: not equal:
    a # u"*** BUILD 1 ***=> finished (success)\n    *** STEP shell *** ==> 'echo hello' (success)\n        log:stdio (29)\n    *** STEP trigger *** ==> triggered trigsched (success)\n       url:trigsched #2 (http://localhost:8080/#buildrequests/2)\n       url:success: build #1 (http://localhost:8080/#builders/2/builds/1)\n    *** STEP shell_1 *** ==> 'echo world' (success)\n        log:stdio (0)\n*** BUILD 2 *** ==> finished (success)\n    *** STEP shell *** ==> 'echo ola' (success)\n        log:stdio (29)\n"
    b # "*** BUILD 1 ***=> finished (success)\n    *** STEP shell *** ==> 'echo hello' (success)\n        log:stdio (29)\n    *** STEP trigger *** ==> triggered trigsched (success)\n       url:trigsched #2 (http://localhost:8080/#buildrequests/2)\n       url:success: build #1 (http://localhost:8080/#builders/2/builds/1)\n    *** STEP shell_1 *** ==> 'echo world' (success)\n        log:stdio (29)\n*** BUILD 2 *** ==> finished (success)\n    *** STEP shell *** ==> 'echo ola' (success)\n        log:stdio (29)\n"
    
    
    buildbot.test.integration.test_trigger.[[TriggeringMaster]].test_trigger



    [ERROR]
    Traceback (most recent call last):
      File "/home/buildbot/slave/py27-tw1320/sandbox-python2.7-Twisted==13.2.0samigr-0.7.1/lib/python2.7/site-packages/twisted/internet/defer.py", line 1099, in _inlineCallbacks
        result = g.send(result)
      File "/home/buildbot/slave/py27-tw1320/build/master/buildbot/test/util/integration.py", line 133, in tearDown
        raise self.failureException(dump.getvalue())
    twisted.trial.unittest.[[FailTest]]: FAILED! dumping build db for debug
    *** BUILD 1 *** ==> finished (success)
        *** STEP shell *** ==> 'echo hello' (success)
            log:stdio (29)
            *********** LOG: stdio *********
            ********************************
        *** STEP trigger *** ==> triggered trigsched (success)
           url:trigsched #2 (http://localhost:8080/#buildrequests/2)
           url:success: build #1 (http://localhost:8080/#builders/2/builds/1)
        *** STEP shell_1 *** ==> 'echo world' (success)
            log:stdio (29)
            *********** LOG: stdio *********
            ********************************
    *** BUILD 2 *** ==> finished (success)
        *** STEP shell *** ==> 'echo ola' (success)
            log:stdio (29)
            *********** LOG: stdio *********
            ********************************
    
    
    buildbot.test.integration.test_trigger.[[TriggeringMaster]].test_trigger



---

_Comment from_: @dustin
_Date_: `Sep 01 2015`

Marked as flaky in https://github.com/buildbot/buildbot/commit/2844506f75aba94d32b7dd4258bac1e6015e8d14




Discussion:

Resolving patch:
diff --git a/master/buildbot/process/buildstep.py b/master/buildbot/process/buildstep.py
--- a/master/buildbot/process/buildstep.py
+++ b/master/buildbot/process/buildstep.py
@@ -246,6 +246,9 @@ class BuildStep(results.ResultComputingConfigMixin,
         'alwaysRun',
         'doStepIf',
         'hideStepIf',
+        'description',
+        'descriptionDone',
+        'descriptionSuffix',
     ]
 
     # 'parms' holds a list of all the parameters we care about, to allow
diff --git a/master/buildbot/steps/master.py b/master/buildbot/steps/master.py
--- a/master/buildbot/steps/master.py
+++ b/master/buildbot/steps/master.py
@@ -38,29 +38,16 @@ class MasterShellCommand(BuildStep):
     description = 'Running'
     descriptionDone = 'Ran'
     descriptionSuffix = None
-    renderables = ['command', 'env', 'description', 'descriptionDone', 'descriptionSuffix']
+    renderables = ['command', 'env']
     haltOnFailure = True
     flunkOnFailure = True
 
     def __init__(self, command,
-                 description=None, descriptionDone=None, descriptionSuffix=None,
                  env=None, path=None, usePTY=0, interruptSignal="KILL",
                  **kwargs):
         BuildStep.__init__(self, **kwargs)
 
         self.command = command
-        if description:
-            self.description = description
-        if isinstance(self.description, str):
-            self.description = [self.description]
-        if descriptionDone:
-            self.descriptionDone = descriptionDone
-        if isinstance(self.descriptionDone, str):
-            self.descriptionDone = [self.descriptionDone]
-        if descriptionSuffix:
-            self.descriptionSuffix = descriptionSuffix
-        if isinstance(self.descriptionSuffix, str):
-            self.descriptionSuffix = [self.descriptionSuffix]
         self.env = env
         self.path = path
         self.usePTY = usePTY
@@ -165,13 +152,6 @@ def processEnded(self, status_object):
             self.step_status.setText(self.describe(done=True))
             self.finished(SUCCESS)
 
-    def describe(self, done=False):
-        desc = self.descriptionDone if done else self.description
-        if self.descriptionSuffix:
-            desc = desc[:]
-            desc.extend(self.descriptionSuffix)
-        return desc
-
     def interrupt(self, reason):
         try:
             self.process.signalProcess(self.interruptSignal)
diff --git a/master/buildbot/steps/shell.py b/master/buildbot/steps/shell.py
--- a/master/buildbot/steps/shell.py
+++ b/master/buildbot/steps/shell.py
@@ -81,7 +81,6 @@ class ShellCommand(buildstep.LoggingBuildStep):
     name = "shell"
     renderables = [
         'slaveEnvironment', 'remote_kwargs', 'command',
-        'description', 'descriptionDone', 'descriptionSuffix',
         'haltOnFailure', 'flunkOnFailure']
 
     command = None  # set this to a command, or set in kwargs
@@ -94,7 +93,6 @@ class ShellCommand(buildstep.LoggingBuildStep):
     flunkOnFailure = True
 
     def __init__(self, workdir=None,
-                 description=None, descriptionDone=None, descriptionSuffix=None,
                  command=None,
                  usePTY="slave-config",
                  **kwargs):
@@ -103,20 +101,6 @@ def __init__(self, workdir=None,
         # BuildStep (like haltOnFailure and friends), and a couple that we
         # consume ourselves.
 
-        if description:
-            self.description = description
-        if isinstance(self.description, str):
-            self.description = [self.description]
-        if descriptionDone:
-            self.descriptionDone = descriptionDone
-        if isinstance(self.descriptionDone, str):
-            self.descriptionDone = [self.descriptionDone]
-
-        if descriptionSuffix:
-            self.descriptionSuffix = descriptionSuffix
-        if isinstance(self.descriptionSuffix, str):
-            self.descriptionSuffix = [self.descriptionSuffix]
-
         if command:
             self.setCommand(command)
 


Test patch:
diff --git a/master/buildbot/test/unit/test_steps_master.py b/master/buildbot/test/unit/test_steps_master.py
--- a/master/buildbot/test/unit/test_steps_master.py
+++ b/master/buildbot/test/unit/test_steps_master.py
@@ -106,8 +106,6 @@ def test_constr_args(self):
                                       env={'a': 'b'}, path=['/usr/bin'], usePTY=True,
                                       command='true'))
 
-        self.assertEqual(self.step.describe(), ['x'])
-
         if runtime.platformType == 'win32':
             exp_argv = [r'C:\WINDOWS\system32\cmd.exe', '/c', 'true']
         else:
@@ -185,10 +183,6 @@ def test_constr_args_descriptionSuffix(self):
                                       env={'a': 'b'}, path=['/usr/bin'], usePTY=True,
                                       command='true'))
 
-        # call twice to make sure the suffix doesn't get double added
-        self.assertEqual(self.step.describe(), ['x', 'z'])
-        self.assertEqual(self.step.describe(), ['x', 'z'])
-
         if runtime.platformType == 'win32':
             exp_argv = [r'C:\WINDOWS\system32\cmd.exe', '/c', 'true']
         else:
diff --git a/master/buildbot/test/unit/test_steps_shell.py b/master/buildbot/test/unit/test_steps_shell.py
--- a/master/buildbot/test/unit/test_steps_shell.py
+++ b/master/buildbot/test/unit/test_steps_shell.py
@@ -55,20 +55,6 @@ def test_doStepIf_False(self):
                            state_string=u"'echo hello' (skipped)")
         return self.runStep()
 
-    def test_constructor_args_strings(self):
-        step = shell.ShellCommand(workdir='build', command="echo hello",
-                                  usePTY=False, description="echoing",
-                                  descriptionDone="echoed")
-        self.assertEqual(step.description, ['echoing'])
-        self.assertEqual(step.descriptionDone, ['echoed'])
-
-    def test_constructor_args_lists(self):
-        step = shell.ShellCommand(workdir='build', command="echo hello",
-                                  usePTY=False, description=["echoing"],
-                                  descriptionDone=["echoed"])
-        self.assertEqual(step.description, ['echoing'])
-        self.assertEqual(step.descriptionDone, ['echoed'])
-
     def test_constructor_args_kwargs(self):
         # this is an ugly way to define an API, but for now check that
         # the RemoteCommand arguments are properly passed on