From a9e08c498ac8126026d1226f34913f87c8e590a0 Mon Sep 17 00:00:00 2001 From: radhika Date: Fri, 16 Oct 2015 10:23:12 -0400 Subject: [PATCH] 7167: Remove StartKeepWithParams and StopKeepWithParams and make StartKeep and StopKeep with parameters the only exposed funcs. The update was small enough, about 10 usages in the entire code, and hence did not make sense to postpone it for a "better" time. --- sdk/go/arvadosclient/arvadosclient_test.go | 2 +- sdk/go/arvadostest/run_servers.go | 22 ++++++------------- sdk/go/keepclient/keepclient_test.go | 4 ++-- services/datamanager/datamanager_test.go | 4 ++-- services/keepproxy/keepproxy_test.go | 4 ++-- .../keepstore/pull_worker_integration_test.go | 2 +- tools/keep-rsync/keep-rsync_test.go | 7 +++--- 7 files changed, 19 insertions(+), 26 deletions(-) diff --git a/sdk/go/arvadosclient/arvadosclient_test.go b/sdk/go/arvadosclient/arvadosclient_test.go index d35f6dacb7..2c508dcb4a 100644 --- a/sdk/go/arvadosclient/arvadosclient_test.go +++ b/sdk/go/arvadosclient/arvadosclient_test.go @@ -21,7 +21,7 @@ type ServerRequiredSuite struct{} func (s *ServerRequiredSuite) SetUpSuite(c *C) { arvadostest.StartAPI() - arvadostest.StartKeep() + arvadostest.StartKeep(2, false) } func (s *ServerRequiredSuite) SetUpTest(c *C) { diff --git a/sdk/go/arvadostest/run_servers.go b/sdk/go/arvadostest/run_servers.go index e922104aeb..27c552a4e1 100644 --- a/sdk/go/arvadostest/run_servers.go +++ b/sdk/go/arvadostest/run_servers.go @@ -99,14 +99,10 @@ func StopAPI() { exec.Command("python", "run_test_server.py", "stop").Run() } -// StartKeep starts 2 keep servers with enforcePermissions=false -func StartKeep() { - StartKeepWithParams(2, false) -} - -// StartKeepWithParams starts the given number of keep servers, +// StartKeep starts the given number of keep servers, // optionally with -enforce-permissions enabled. -func StartKeepWithParams(numKeepServers int, enforcePermissions bool) { +// Use numKeepServers = 2 and enforcePermissions = false under all normal circumstances. +func StartKeep(numKeepServers int, enforcePermissions bool) { cwd, _ := os.Getwd() defer os.Chdir(cwd) chdirToPythonTests() @@ -128,14 +124,10 @@ func StartKeepWithParams(numKeepServers int, enforcePermissions bool) { } } -func StopKeep() { - StopKeepWithParams(2) -} - -// StopKeepServers stops keep servers that were started with -// StartKeep. numkeepServers should be the same value that was passed -// to StartKeep. -func StopKeepWithParams(numKeepServers int) { +// StopKeep stops keep servers that were started with StartKeep. +// numkeepServers should be the same value that was passed to StartKeep, +// which is 2 under all normal circumstances. +func StopKeep(numKeepServers int) { cwd, _ := os.Getwd() defer os.Chdir(cwd) chdirToPythonTests() diff --git a/sdk/go/keepclient/keepclient_test.go b/sdk/go/keepclient/keepclient_test.go index b5bc5ced4b..aaba0695f0 100644 --- a/sdk/go/keepclient/keepclient_test.go +++ b/sdk/go/keepclient/keepclient_test.go @@ -45,14 +45,14 @@ func (s *ServerRequiredSuite) SetUpSuite(c *C) { return } arvadostest.StartAPI() - arvadostest.StartKeep() + arvadostest.StartKeep(2, false) } func (s *ServerRequiredSuite) TearDownSuite(c *C) { if *no_server { return } - arvadostest.StopKeep() + arvadostest.StopKeep(2) arvadostest.StopAPI() } diff --git a/services/datamanager/datamanager_test.go b/services/datamanager/datamanager_test.go index 3d9bb3da90..c2cb762d52 100644 --- a/services/datamanager/datamanager_test.go +++ b/services/datamanager/datamanager_test.go @@ -31,7 +31,7 @@ func SetupDataManagerTest(t *testing.T) { // start api and keep servers arvadostest.ResetEnv() arvadostest.StartAPI() - arvadostest.StartKeep() + arvadostest.StartKeep(2, false) arv = makeArvadosClient() @@ -54,7 +54,7 @@ func SetupDataManagerTest(t *testing.T) { } func TearDownDataManagerTest(t *testing.T) { - arvadostest.StopKeep() + arvadostest.StopKeep(2) arvadostest.StopAPI() } diff --git a/services/keepproxy/keepproxy_test.go b/services/keepproxy/keepproxy_test.go index 6fe8fe7ac3..7643e4b0fa 100644 --- a/services/keepproxy/keepproxy_test.go +++ b/services/keepproxy/keepproxy_test.go @@ -53,7 +53,7 @@ func closeListener() { func (s *ServerRequiredSuite) SetUpSuite(c *C) { arvadostest.StartAPI() - arvadostest.StartKeep() + arvadostest.StartKeep(2, false) } func (s *ServerRequiredSuite) SetUpTest(c *C) { @@ -61,7 +61,7 @@ func (s *ServerRequiredSuite) SetUpTest(c *C) { } func (s *ServerRequiredSuite) TearDownSuite(c *C) { - arvadostest.StopKeep() + arvadostest.StopKeep(2) arvadostest.StopAPI() } diff --git a/services/keepstore/pull_worker_integration_test.go b/services/keepstore/pull_worker_integration_test.go index e0bad0045a..3a3069ab77 100644 --- a/services/keepstore/pull_worker_integration_test.go +++ b/services/keepstore/pull_worker_integration_test.go @@ -27,7 +27,7 @@ func SetupPullWorkerIntegrationTest(t *testing.T, testData PullWorkIntegrationTe // start api and keep servers arvadostest.StartAPI() - arvadostest.StartKeep() + arvadostest.StartKeep(2, false) // make arvadosclient arv, err := arvadosclient.MakeArvadosClient() diff --git a/tools/keep-rsync/keep-rsync_test.go b/tools/keep-rsync/keep-rsync_test.go index f1091887d5..6fbb535a03 100644 --- a/tools/keep-rsync/keep-rsync_test.go +++ b/tools/keep-rsync/keep-rsync_test.go @@ -59,7 +59,7 @@ func (s *ServerRequiredSuite) SetUpTest(c *C) { } func (s *ServerRequiredSuite) TearDownTest(c *C) { - arvadostest.StopKeepWithParams(3) + arvadostest.StopKeep(3) } func (s *DoMainTestSuite) SetUpTest(c *C) { @@ -94,7 +94,7 @@ func setupRsync(c *C, enforcePermissions bool, replications int) { } // Start Keep servers - arvadostest.StartKeepWithParams(3, enforcePermissions) + arvadostest.StartKeep(3, enforcePermissions) // setup keepclients var err error @@ -421,6 +421,7 @@ func setupConfigFile(c *C, name string) *os.File { fileContent := "ARVADOS_API_HOST=" + os.Getenv("ARVADOS_API_HOST") + "\n" fileContent += "ARVADOS_API_TOKEN=" + os.Getenv("ARVADOS_API_TOKEN") + "\n" fileContent += "ARVADOS_API_HOST_INSECURE=" + os.Getenv("ARVADOS_API_HOST_INSECURE") + "\n" + fileContent += "ARVADOS_EXTERNAL_CLIENT=false\n" fileContent += "ARVADOS_BLOB_SIGNING_KEY=abcdefg" _, err = file.Write([]byte(fileContent)) @@ -468,7 +469,7 @@ func (s *DoMainTestSuite) Test_doMainWithSrcAndDstConfig(c *C) { // Start keepservers. Since we are not doing any tweaking as in setupRsync func, // kcSrc and kcDst will be the same and no actual copying to dst will happen, but that's ok. - arvadostest.StartKeep() + arvadostest.StartKeep(2, false) err := doMain() c.Check(err, IsNil) -- 2.30.2