[ARVADOS] updated: db68fd029f681f380f218b9b2f4fec3a315f140c

git at public.curoverse.com git at public.curoverse.com
Fri Nov 6 10:12:30 EST 2015


Summary of changes:
 .../install-crunch-dispatch.html.textile.liquid    |  2 +-
 doc/install/install-keep-web.html.textile.liquid   | 13 +--
 doc/install/install-keepproxy.html.textile.liquid  |  2 +-
 sdk/go/arvadosclient/arvadosclient.go              |  3 +-
 sdk/go/arvadosclient/arvadosclient_test.go         | 98 +++++++++++-----------
 sdk/go/arvadostest/fixtures.go                     |  2 +
 sdk/python/tests/run_test_server.py                |  2 +-
 .../test/fixtures/api_client_authorizations.yml    | 12 +++
 services/datamanager/datamanager_test.go           | 27 ++++--
 services/keep-web/anonymous.go                     | 23 +++--
 services/keep-web/doc.go                           | 18 ++--
 services/keep-web/main.go                          |  4 +-
 services/keep-web/server.go                        |  2 +-
 services/keepproxy/keepproxy_test.go               |  2 +
 14 files changed, 128 insertions(+), 82 deletions(-)

       via  db68fd029f681f380f218b9b2f4fec3a315f140c (commit)
       via  27b9247e0c42700e0c7d94f7721e2164610b1e4c (commit)
       via  49fccd5b00230418a0918a33d4fb9154af63220a (commit)
       via  8e1e7e6bf355eb0f1defc7278f1434c393a75a75 (commit)
       via  05a0e777cdef513f5365d5319fea7af01ae9e7f7 (commit)
       via  b85cb1ba40385444f9494bbb88248ab65d700c85 (commit)
       via  28425a5cf55a26113bdbea53381f86b779d84bf9 (commit)
       via  6a8d940762f1b9be1a3a273e13b070d1f75ef8f1 (commit)
       via  fa96bcea706312be52f1488da3dad34452f5ccf4 (commit)
      from  4288cc1b9f894d3574be1ac04dab01e70e1a4580 (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 db68fd029f681f380f218b9b2f4fec3a315f140c
Author: radhika <radhika at curoverse.com>
Date:   Fri Nov 6 10:11:27 2015 -0500

    5538: much simpler and neater api stub test case array; golint

diff --git a/sdk/go/arvadosclient/arvadosclient.go b/sdk/go/arvadosclient/arvadosclient.go
index 68c0632..2b6a36a 100644
--- a/sdk/go/arvadosclient/arvadosclient.go
+++ b/sdk/go/arvadosclient/arvadosclient.go
@@ -228,9 +228,8 @@ func (c ArvadosClient) CallRaw(method string, resourceType string, uuid string,
 
 	if resp != nil {
 		return nil, newAPIServerError(c.ApiServer, resp)
-	} else {
-		return nil, err
 	}
+	return nil, err
 }
 
 func newAPIServerError(ServerAddress string, resp *http.Response) APIServerError {
diff --git a/sdk/go/arvadosclient/arvadosclient_test.go b/sdk/go/arvadosclient/arvadosclient_test.go
index a9c2c83..a4fe136 100644
--- a/sdk/go/arvadosclient/arvadosclient_test.go
+++ b/sdk/go/arvadosclient/arvadosclient_test.go
@@ -7,7 +7,6 @@ import (
 	"net"
 	"net/http"
 	"os"
-	"strconv"
 	"strings"
 	"testing"
 	"time"
@@ -251,11 +250,6 @@ func RunFakeArvadosServer(st http.Handler) (api APIServer, err error) {
 	return
 }
 
-type APIStub struct {
-	count      int
-	respStatus []int
-}
-
 func (h *APIStub) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
 	resp.WriteHeader(h.respStatus[h.count])
 
@@ -265,46 +259,57 @@ func (h *APIStub) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
 		resp.Write([]byte(``))
 	}
 
-	h.count += 1
+	h.count++
+}
+
+type APIStub struct {
+	method       string
+	count        int
+	expected     int
+	respStatus   []int
+	responseBody []string
 }
 
 func (s *MockArvadosServerSuite) TestWithRetries(c *C) {
-	// Each testCase below specifies the operation to be used ("get", "create" etc),
-	// the "expected" outcome (500 or 401 or success etc,
-	// and an array of response statuses to be returned in that order for each (re)try.
-	//
-	// The tests are using retry count of 2,
-	// and hence the first "non-retryable" code (such as 401)
-	// or whatever is the third status code is to be expected.
-	for _, testCase := range []map[string][]int{
-		{"get:500": []int{500, 500, 500, 200}},
-		{"create:500": []int{500, 500, 500, 200}},
-		{"update:500": []int{500, 500, 500, 200}},
-		{"delete:500": []int{500, 500, 500, 200}},
-		{"get:502": []int{500, 500, 502, 200}},
-		{"create:502": []int{500, 500, 502, 200}},
-		{"get:success": []int{500, 500, 200}},
-		{"create:success": []int{500, 500, 200}},
-		{"get:401": []int{401, 200}},
-		{"create:401": []int{401, 200}},
-		{"get:404": []int{404, 200}},
-		{"create:404": []int{404, 200}},
-		{"get:401": []int{500, 401, 200}},
-		{"create:401": []int{500, 401, 200}},
+	for _, stub := range []APIStub{
+		{
+			"get", 0, 500, []int{500, 500, 500, 200}, []string{``, ``, ``, `{"ok":"ok"}`},
+		},
+		{
+			"create", 0, 500, []int{500, 500, 500, 200}, []string{``, ``, ``, `{"ok":"ok"}`},
+		},
+		{
+			"update", 0, 500, []int{500, 500, 500, 200}, []string{``, ``, ``, `{"ok":"ok"}`},
+		},
+		{
+			"delete", 0, 500, []int{500, 500, 500, 200}, []string{``, ``, ``, `{"ok":"ok"}`},
+		},
+		{
+			"get", 0, 502, []int{500, 500, 502, 200}, []string{``, ``, ``, `{"ok":"ok"}`},
+		},
+		{
+			"create", 0, 502, []int{500, 500, 502, 200}, []string{``, ``, ``, `{"ok":"ok"}`},
+		},
+		{
+			"get", 0, 200, []int{500, 500, 200}, []string{``, ``, `{"ok":"ok"}`},
+		},
+		{
+			"create", 0, 200, []int{500, 500, 200}, []string{``, ``, `{"ok":"ok"}`},
+		},
+		{
+			"get", 0, 401, []int{401, 200}, []string{``, `{"ok":"ok"}`},
+		},
+		{
+			"create", 0, 401, []int{401, 200}, []string{``, `{"ok":"ok"}`},
+		},
+		{
+			"get", 0, 404, []int{404, 200}, []string{``, `{"ok":"ok"}`},
+		},
+		{
+			"get", 0, 401, []int{500, 401, 200}, []string{``, ``, `{"ok":"ok"}`},
+		},
 	} {
-		var method string
-		var statusCodes []int
-		var expected string
-
-		for key, value := range testCase {
-			method = key[:strings.Index(key, ":")]
-			expected = key[strings.Index(key, ":")+1:]
-			statusCodes = value
-		}
-
-		stub := &APIStub{0, statusCodes}
-
-		api, err := RunFakeArvadosServer(stub)
+		api, err := RunFakeArvadosServer(&stub)
 		c.Check(err, IsNil)
 
 		defer api.listener.Close()
@@ -318,7 +323,7 @@ func (s *MockArvadosServerSuite) TestWithRetries(c *C) {
 			Retries:     2}
 
 		getback := make(Dict)
-		switch method {
+		switch stub.method {
 		case "get":
 			err = arv.Get("collections", "zzzzz-4zz18-znfnqtbbv4spc3w", nil, &getback)
 		case "create":
@@ -333,14 +338,13 @@ func (s *MockArvadosServerSuite) TestWithRetries(c *C) {
 			err = arv.Delete("pipeline_templates", "zzzzz-4zz18-znfnqtbbv4spc3w", nil, &getback)
 		}
 
-		if expected == "success" {
+		if stub.expected == 200 {
 			c.Check(err, IsNil)
 			c.Assert(getback["ok"], Equals, "ok")
 		} else {
 			c.Check(err, NotNil)
-			expectedStatus, _ := strconv.Atoi(expected)
-			c.Check(strings.Contains(err.Error(), fmt.Sprintf("%s%s", "arvados API server error: ", expected)), Equals, true)
-			c.Assert(err.(APIServerError).HttpStatusCode, Equals, expectedStatus)
+			c.Check(strings.Contains(err.Error(), fmt.Sprintf("%s%d", "arvados API server error: ", stub.expected)), Equals, true)
+			c.Assert(err.(APIServerError).HttpStatusCode, Equals, stub.expected)
 		}
 	}
 }

commit 27b9247e0c42700e0c7d94f7721e2164610b1e4c
Merge: 4288cc1 49fccd5
Author: radhika <radhika at curoverse.com>
Date:   Thu Nov 5 22:19:54 2015 -0500

    Merge branch 'master' into 5538-arvadosclient-retry


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


hooks/post-receive
-- 




More information about the arvados-commits mailing list