Use a non-standard port for the test server

Start the test API server on a non-standard port to avoid
conflicting with a server already running due to devstack.

Change-Id: I010c76376048e3433301ccc64ce35db11e69a3e7
Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>
This commit is contained in:
Doug Hellmann 2013-03-08 15:41:17 -05:00
parent e7fc028e2b
commit 35d50a5de7

View File

@ -20,6 +20,7 @@
import httplib2
import json
import os
import random
import socket
import subprocess
import tempfile
@ -67,11 +68,13 @@ class BinSendCounterTestCase(unittest.TestCase):
class BinApiTestCase(unittest.TestCase):
def setUp(self):
self.api_port = 8777
self.api_port = random.randint(10000, 11000)
self.http = httplib2.Http()
self.tempfile = tempfile.mktemp()
with open(self.tempfile, 'w') as tmp:
tmp.write("[DEFAULT]\n")
tmp.write(
"metering_api_port=%s\n" % self.api_port)
tmp.write(
"rpc_backend=ceilometer.openstack.common.rpc.impl_fake\n")
tmp.write("database_connection=log://localhost\n")