[ARVADOS] updated: 6e6a5f4005e7f7c3a41d632ed350f2da918cd01c

Git user git at public.curoverse.com
Wed May 25 08:41:26 EDT 2016


Summary of changes:
 services/keep-balance/balance_run_test.go |  4 ++--
 services/keep-balance/main.go             | 19 ++++++++++++-------
 2 files changed, 14 insertions(+), 9 deletions(-)

       via  6e6a5f4005e7f7c3a41d632ed350f2da918cd01c (commit)
       via  1b6238eb711a3b62a9f6c67460e20b24a2dc1e11 (commit)
      from  ac9cacc92f66867673e186716616452cb628352f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 6e6a5f4005e7f7c3a41d632ed350f2da918cd01c
Author: Tom Clegg <tom at curoverse.com>
Date:   Wed May 25 08:41:23 2016 -0400

    9162: Obey runOptions.Logger in RunForever.

diff --git a/services/keep-balance/main.go b/services/keep-balance/main.go
index 88b7eaf..c6e92ab 100644
--- a/services/keep-balance/main.go
+++ b/services/keep-balance/main.go
@@ -105,6 +105,11 @@ func mustReadJSON(dst interface{}, path string) {
 // RunForever runs forever, or (for testing purposes) until the given
 // stop channel is ready to receive.
 func RunForever(config Config, runOptions RunOptions, stop <-chan interface{}) error {
+	if runOptions.Logger == nil {
+		runOptions.Logger = log.New(os.Stderr, "", log.LstdFlags)
+	}
+	logger := runOptions.Logger
+
 	ticker := time.NewTicker(time.Duration(config.RunPeriod))
 
 	// The unbuffered channel here means we only hear SIGUSR1 if
@@ -112,19 +117,19 @@ func RunForever(config Config, runOptions RunOptions, stop <-chan interface{}) e
 	sigUSR1 := make(chan os.Signal)
 	signal.Notify(sigUSR1, syscall.SIGUSR1)
 
-	log.Printf("starting in service mode, running every %v and on SIGUSR1", config.RunPeriod)
+	logger.Printf("starting in service mode, running every %v and on SIGUSR1", config.RunPeriod)
 
 	for {
 		if !runOptions.CommitPulls && !runOptions.CommitTrash {
-			log.Print("WARNING: Running in service mode, but no changes will be committed.")
-			log.Print("=======  Consider using -commit-pulls and -commit-trash flags.")
+			logger.Print("WARNING: Running in service mode, but no changes will be committed.")
+			logger.Print("=======  Consider using -commit-pulls and -commit-trash flags.")
 		}
 
 		err := (&Balancer{}).Run(config, runOptions)
 		if err != nil {
-			log.Print("run failed: ", err)
+			logger.Print("run failed: ", err)
 		} else {
-			log.Print("run succeeded")
+			logger.Print("run succeeded")
 		}
 
 		select {
@@ -133,12 +138,12 @@ func RunForever(config Config, runOptions RunOptions, stop <-chan interface{}) e
 			return nil
 		case <-ticker.C:
 		case <-sigUSR1:
-			log.Print("received SIGUSR1, resetting timer")
+			logger.Print("received SIGUSR1, resetting timer")
 			// Reset the timer so we don't wake up too
 			// soon after a run triggered by SIGUSR1.
 			ticker.Stop()
 			ticker = time.NewTicker(time.Duration(config.RunPeriod))
 		}
-		log.Print("waking up")
+		logger.Print("waking up")
 	}
 }

commit 1b6238eb711a3b62a9f6c67460e20b24a2dc1e11
Author: Tom Clegg <tom at curoverse.com>
Date:   Wed May 25 08:31:00 2016 -0400

    9162: Fix TestServiceTypes: collections should still be processed

diff --git a/services/keep-balance/balance_run_test.go b/services/keep-balance/balance_run_test.go
index c3e8420..9b7ea67 100644
--- a/services/keep-balance/balance_run_test.go
+++ b/services/keep-balance/balance_run_test.go
@@ -231,12 +231,12 @@ func (s *runSuite) TestServiceTypes(c *check.C) {
 	}
 	s.config.KeepServiceTypes = []string{"unlisted-type"}
 	s.stub.serveCurrentUserAdmin()
-	s.stub.serveZeroCollections()
+	s.stub.serveFooBarFileCollections()
 	s.stub.serveFourDiskKeepServices()
 	indexReqs := s.stub.serveKeepstoreIndexFoo4Bar1()
 	trashReqs := s.stub.serveKeepstoreTrash()
 	err := (&Balancer{}).Run(s.config, opts)
-	c.Check(err, check.ErrorMatches, "received zero collections")
+	c.Check(err, check.IsNil)
 	c.Check(indexReqs.Count(), check.Equals, 0)
 	c.Check(trashReqs.Count(), check.Equals, 0)
 }

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list