From 3e78a618a8085dba94e06a747be9a1f14b3db3fb Mon Sep 17 00:00:00 2001 From: Dwayne Boone Date: Wed, 17 Jul 2002 20:55:08 +0000 Subject: Mods for running IceBox services in python scripts --- cpp/config/TestUtil.py | 13 +++++++++++++ cpp/test/IceStorm/federation/run.py | 22 +++++++++++++--------- cpp/test/IceStorm/federation2/run.py | 18 +++++++++++------- cpp/test/IceStorm/single/run.py | 19 ++++++++++++------- cpp/test/Yellow/basicYellow/run.py | 7 ++++--- 5 files changed, 53 insertions(+), 26 deletions(-) (limited to 'cpp') diff --git a/cpp/config/TestUtil.py b/cpp/config/TestUtil.py index 363873c16b4..8bbd35bbf4b 100644 --- a/cpp/config/TestUtil.py +++ b/cpp/config/TestUtil.py @@ -131,6 +131,19 @@ def getAdapterReady(serverPipe): killServers() sys.exit(1) +def waitServiceReady(pipe, token): + + while 1: + + output = pipe.readline().strip() + + if not output: + print "failed!" + sys.exit(1) + + if output == token + " ready": + break + def clientServerTestWithOptions(toplevel, name, additionalServerOptions, additionalClientOptions): testdir = os.path.join(toplevel, "test", name) diff --git a/cpp/test/IceStorm/federation/run.py b/cpp/test/IceStorm/federation/run.py index 80c1165ab4e..665df888c2b 100755 --- a/cpp/test/IceStorm/federation/run.py +++ b/cpp/test/IceStorm/federation/run.py @@ -25,6 +25,7 @@ name = os.path.join("IceStorm", "federation") testdir = os.path.join(toplevel, "test", name) iceBox = os.path.join(toplevel, "bin", "icebox") +iceBoxAdmin = os.path.join(toplevel, "bin", "iceboxadmin") iceStormAdmin = os.path.join(toplevel, "bin", "icestormadmin") updatedServerOptions = TestUtil.serverOptions.replace("TOPLEVELDIR", toplevel) @@ -32,8 +33,11 @@ updatedClientOptions = TestUtil.clientOptions.replace("TOPLEVELDIR", toplevel) updatedClientServerOptions = TestUtil.clientServerOptions.replace("TOPLEVELDIR", toplevel) iceBoxEndpoints=' --IceBox.ServiceManager.Endpoints="default -p 12345"' +iceBoxReference=' --IceBox.ServiceManager="ServiceManager: default -p 12345"' + iceStormService=" --IceBox.Service.IceStorm=IceStormService:create" + \ - ' --IceStorm.TopicManager.Endpoints="default -p 12346"' + ' --IceStorm.TopicManager.Endpoints="default -p 12346"' + \ + " --IceBox.PrintServicesReady=IceStorm" iceStormReference=' --IceStorm.TopicManager="IceStorm.TopicManager: default -p 12346"' dbEnvName = os.path.join(testdir, "db") @@ -44,7 +48,7 @@ print "starting icestorm service...", command = iceBox + updatedClientServerOptions + iceBoxEndpoints + iceStormService + iceStormDBEnv iceBoxPipe = os.popen(command) TestUtil.getServerPid(iceBoxPipe) -TestUtil.getAdapterReady(iceBoxPipe) +TestUtil.waitServiceReady(iceBoxPipe, "IceStorm") print "ok" print "creating topics...", @@ -163,20 +167,20 @@ print "ok" # # Shutdown icestorm. # -print "shutting down icestorm...", -command = iceStormAdmin + updatedClientOptions + iceStormReference + r' -e "shutdown"' -iceStormAdminPipe = os.popen(command) -iceStormAdminStatus = iceStormAdminPipe.close() -if iceStormAdminStatus: +print "shutting down icestorm service...", +command = iceBoxAdmin + updatedClientOptions + iceBoxReference + r' shutdown' +iceBoxAdminPipe = os.popen(command) +iceBoxAdminStatus = iceBoxAdminPipe.close() +if iceBoxAdminStatus: TestUtil.killServers() sys.exit(1) print "ok" -iceStormStatus = iceBoxPipe.close() +iceBoxStatus = iceBoxPipe.close() subscriberStatus = subscriberPipe.close() publisherStatus = publisherPipe.close() -if iceStormStatus or subscriberStatus or publisherStatus: +if iceBoxStatus or subscriberStatus or publisherStatus: TestUtil.killServers() sys.exit(1) diff --git a/cpp/test/IceStorm/federation2/run.py b/cpp/test/IceStorm/federation2/run.py index d2c15d5d543..96aa71dcb24 100755 --- a/cpp/test/IceStorm/federation2/run.py +++ b/cpp/test/IceStorm/federation2/run.py @@ -25,6 +25,7 @@ testdir = os.path.join(toplevel, "test", "IceStorm", "federation2") exedir = os.path.join(toplevel, "test", "IceStorm", "federation") iceBox = os.path.join(toplevel, "bin", "icebox") +iceBoxAdmin = os.path.join(toplevel, "bin", "iceboxadmin") iceStormAdmin = os.path.join(toplevel, "bin", "icestormadmin") updatedServerOptions = TestUtil.serverOptions.replace("TOPLEVELDIR", toplevel) @@ -32,8 +33,11 @@ updatedClientOptions = TestUtil.clientOptions.replace("TOPLEVELDIR", toplevel) updatedClientServerOptions = TestUtil.clientServerOptions.replace("TOPLEVELDIR", toplevel) iceBoxEndpoints=' --IceBox.ServiceManager.Endpoints="default -p 12345"' +iceBoxReference=' --IceBox.ServiceManager="ServiceManager: default -p 12345"' + iceStormService=" --IceBox.Service.IceStorm=IceStormService:create" + \ - ' --IceStorm.TopicManager.Endpoints="default -p 12346"' + ' --IceStorm.TopicManager.Endpoints="default -p 12346"' + \ + " --IceBox.PrintServicesReady=IceStorm" iceStormReference=' --IceStorm.TopicManager="IceStorm.TopicManager: default -p 12346"' dbEnvName = os.path.join(testdir, "db") @@ -44,7 +48,7 @@ print "starting icestorm service...", command = iceBox + updatedClientServerOptions + iceBoxEndpoints + iceStormService + iceStormDBEnv iceBoxPipe = os.popen(command) TestUtil.getServerPid(iceBoxPipe) -TestUtil.getAdapterReady(iceBoxPipe) +TestUtil.waitServiceReady(iceBoxPipe, "IceStorm") print "ok" print "creating topics...", @@ -158,11 +162,11 @@ print "ok" # # Shutdown icestorm. # -print "shutting down icestorm...", -command = iceStormAdmin + updatedClientOptions + iceStormReference + r' -e "shutdown"' -iceStormAdminPipe = os.popen(command) -iceStormAdminStatus = iceStormAdminPipe.close() -if iceStormAdminStatus: +print "shutting down icestorm service...", +command = iceBoxAdmin + updatedClientOptions + iceBoxReference + r' shutdown' +iceBoxAdminPipe = os.popen(command) +iceBoxAdminStatus = iceBoxAdminPipe.close() +if iceBoxAdminStatus: TestUtil.killServers() sys.exit(1) print "ok" diff --git a/cpp/test/IceStorm/single/run.py b/cpp/test/IceStorm/single/run.py index d2e658d2ff6..ecf13ec84d5 100755 --- a/cpp/test/IceStorm/single/run.py +++ b/cpp/test/IceStorm/single/run.py @@ -25,6 +25,7 @@ name = os.path.join("IceStorm", "single") testdir = os.path.join(toplevel, "test", name) iceBox = os.path.join(toplevel, "bin", "icebox") +iceBoxAdmin = os.path.join(toplevel, "bin", "iceboxadmin") iceStormAdmin = os.path.join(toplevel, "bin", "icestormadmin") updatedServerOptions = TestUtil.serverOptions.replace("TOPLEVELDIR", toplevel) @@ -32,8 +33,11 @@ updatedClientOptions = TestUtil.clientOptions.replace("TOPLEVELDIR", toplevel) updatedClientServerOptions = TestUtil.clientServerOptions.replace("TOPLEVELDIR", toplevel) iceBoxEndpoints=' --IceBox.ServiceManager.Endpoints="default -p 12345"' +iceBoxReference=' --IceBox.ServiceManager="ServiceManager: default -p 12345"' + iceStormService=" --IceBox.Service.IceStorm=IceStormService:create" + \ - ' --IceStorm.TopicManager.Endpoints="default -p 12346"' + ' --IceStorm.TopicManager.Endpoints="default -p 12346"' + \ + " --IceBox.PrintServicesReady=IceStorm" iceStormReference=' --IceStorm.TopicManager="IceStorm.TopicManager: default -p 12346"' dbEnvName = os.path.join(testdir, "db") @@ -44,7 +48,8 @@ print "starting icestorm service...", command = iceBox + updatedClientServerOptions + iceBoxEndpoints + iceStormService + iceStormDBEnv iceBoxPipe = os.popen(command) TestUtil.getServerPid(iceBoxPipe) -TestUtil.getAdapterReady(iceBoxPipe) +#TestUtil.getAdapterReady(iceBoxPipe) +TestUtil.waitServiceReady(iceBoxPipe, "IceStorm") print "ok" print "creating topic...", @@ -124,11 +129,11 @@ print "ok" # # Shutdown icestorm. # -print "shutting down icestorm...", -command = iceStormAdmin + updatedClientOptions + iceStormReference + r' -e "shutdown"' -iceStormAdminPipe = os.popen(command) -iceStormAdminStatus = iceStormAdminPipe.close() -if iceStormAdminStatus: +print "shutting down icestorm service...", +command = iceBoxAdmin + updatedClientOptions + iceBoxReference + r' shutdown' +iceBoxAdminPipe = os.popen(command) +iceBoxAdminStatus = iceBoxAdminPipe.close() +if iceBoxAdminStatus: TestUtil.killServers() sys.exit(1) print "ok" diff --git a/cpp/test/Yellow/basicYellow/run.py b/cpp/test/Yellow/basicYellow/run.py index c1f2ba90b34..fb24061df4a 100755 --- a/cpp/test/Yellow/basicYellow/run.py +++ b/cpp/test/Yellow/basicYellow/run.py @@ -34,7 +34,8 @@ updatedClientServerOptions = TestUtil.clientServerOptions.replace("TOPLEVELDIR", IceBoxEndpoints=' --IceBox.ServiceManager.Endpoints="default -p 12345"' IceBoxReference=' --IceBox.ServiceManager="ServiceManager:default -p 12345"' YellowService=" --IceBox.Service.Yellow=YellowService:create" + \ - ' --Yellow.Query.Endpoints="default -p 12346" --Yellow.Admin.Endpoints="default -p 12347"' + ' --Yellow.Query.Endpoints="default -p 12346" --Yellow.Admin.Endpoints="default -p 12347"' + \ + ' --IceBox.PrintServicesReady=Yellow' dbEnvName = os.path.join(testdir, "db") TestUtil.cleanDbDir(dbEnvName) @@ -44,7 +45,7 @@ print "starting yellow service...", command = IceBox + updatedClientServerOptions + IceBoxEndpoints + YellowService + YellowDBEnv IceBoxPipe = os.popen(command) TestUtil.getServerPid(IceBoxPipe) -TestUtil.getAdapterReady(IceBoxPipe) +TestUtil.waitServiceReady(IceBoxPipe, "Yellow") print "ok" client = os.path.join(testdir, "client") @@ -62,7 +63,7 @@ for output in clientPipe.xreadlines(): # # Shutdown yellow. # -print "shutting down yellow...", +print "shutting down yellow service...", command = IceBoxAdmin + updatedClientOptions + IceBoxReference + r' shutdown' IceBoxAdminPipe = os.popen(command) IceBoxAdminStatus = IceBoxAdminPipe.close() -- cgit v1.2.3