Question

I'd like to run integration tests against a running server and retrieve server output to check it later.

Was it helpful?

Solution

Here is a cheap way to do so with local slave (otherwhise you'll probably need a FileUpload extra step)

class StopServer(ShellCommand):
  def _init_(self):
    ShellCommand.__init__(self, command=['pkill', '-f', 'my-server-name'],
                                       workdir='build/python',
                                       description='Stopping test server')

  def createSummary(self, log):
    buildername = self.getProperty("buildername")
    f = '/home/buildbot/slave/%s/build/python/nohup.out' % buildername
    output = open(f, "r").read()
    self.addCompleteLog('server output', output)


class StartServer(ShellCommand):
  def _init_(self):
    ShellCommand.__init__(self, command=['./start-test-server.sh'],
                                       workdir='build/python', haltOnFailure=True,
                                       description='Starting test server')

The shell script is just a nohup with stderr and stdout redirect

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top