[ARVADOS] updated: 8adab284315900b0d7d2edd1c28957f0e510019e

git at public.curoverse.com git at public.curoverse.com
Wed Sep 9 16:13:24 EDT 2015


Summary of changes:
 services/datamanager/datamanager_test.go | 36 +++++++++++---------------------
 1 file changed, 12 insertions(+), 24 deletions(-)

       via  8adab284315900b0d7d2edd1c28957f0e510019e (commit)
      from  8678b8542a1e73c9a7861a9b8ba7488a1a32c1c4 (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 8adab284315900b0d7d2edd1c28957f0e510019e
Author: Tom Clegg <tom at curoverse.com>
Date:   Wed Sep 9 16:12:28 2015 -0400

    6260: Fix up /status.json checks.

diff --git a/services/datamanager/datamanager_test.go b/services/datamanager/datamanager_test.go
index c76d481..68534b2 100644
--- a/services/datamanager/datamanager_test.go
+++ b/services/datamanager/datamanager_test.go
@@ -47,6 +47,7 @@ func SetupDataManagerTest(t *testing.T) {
 	if err := keepClient.DiscoverKeepServers(); err != nil {
 		t.Fatalf("Error discovering keep services: %s", err)
 	}
+	keepServers = []string{}
 	for _, host := range keepClient.LocalRoots() {
 		keepServers = append(keepServers, host)
 	}
@@ -299,11 +300,10 @@ func getStatus(t *testing.T, path string) interface{} {
 	req.Header.Add("Authorization", "OAuth2 " + AdminToken)
 	req.Header.Add("Content-Type", "application/octet-stream")
 	resp, err := client.Do(req)
-	defer resp.Body.Close()
-
 	if err != nil {
 		t.Fatalf("Error during %s %s", path, err)
 	}
+	defer resp.Body.Close()
 
 	var s interface{}
 	json.NewDecoder(resp.Body).Decode(&s)
@@ -311,28 +311,18 @@ func getStatus(t *testing.T, path string) interface{} {
 	return s
 }
 
+// Wait until PullQueue and TrashQueue are empty on all keepServers.
 func waitUntilQueuesFinishWork(t *testing.T) {
-	// Wait until PullQueue and TrashQueue finish their work
-	for {
-		var done [2]bool
-		for i := 0; i < 2; i++ {
-			s := getStatus(t, keepServers[i]+"/status.json")
-			var pullQueueStatus interface{}
-			pullQueueStatus = s.(map[string]interface{})["PullQueue"]
-			var trashQueueStatus interface{}
-			trashQueueStatus = s.(map[string]interface{})["TrashQueue"]
-
-			if pullQueueStatus.(map[string]interface{})["Queued"] == float64(0) &&
-				pullQueueStatus.(map[string]interface{})["InProgress"] == float64(0) &&
-				trashQueueStatus.(map[string]interface{})["Queued"] == float64(0) &&
-				trashQueueStatus.(map[string]interface{})["InProgress"] == float64(0) {
-				done[i] = true
-			}
-		}
-		if done[0] && done[1] {
-			break
-		} else {
+	for _, ks := range keepServers {
+		for done := false; !done; {
 			time.Sleep(100 * time.Millisecond)
+			s := getStatus(t, ks + "/status.json")
+			for _, qName := range []string{"PullQueue", "TrashQueue"} {
+				qStatus := s.(map[string]interface{})[qName].(map[string]interface{})
+				if qStatus["Queued"].(float64) + qStatus["InProgress"].(float64) == 0 {
+					done = true
+				}
+			}
 		}
 	}
 }
@@ -484,8 +474,6 @@ func TestDatamanagerSingleRunRepeatedly(t *testing.T) {
 }
 
 func TestGetStatusRepeatedly(t *testing.T) {
-	t.Skip("This test still fails. Skip it until it is fixed.")
-
 	defer TearDownDataManagerTest(t)
 	SetupDataManagerTest(t)
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list