[ARVADOS] updated: c0b9d41a5570862dcaac06b727d88be4d0ac9dc6

git at public.curoverse.com git at public.curoverse.com
Fri Nov 13 13:04:56 EST 2015


Summary of changes:
 .../app/controllers/collections_controller.rb      |   7 +-
 apps/workbench/app/views/layouts/body.html.erb     |   4 +-
 .../controllers/application_controller_test.rb     |  20 +++
 .../controllers/collections_controller_test.rb     |  14 +-
 apps/workbench/test/helpers/download_helper.rb     |   2 +-
 apps/workbench/test/integration/download_test.rb   |  57 +++++++-
 sdk/cli/bin/crunch-job                             |   5 +-
 sdk/python/tests/nginx.conf                        |  12 ++
 sdk/python/tests/run_test_server.py                |   4 +-
 services/datamanager/keep/keep_test.go             | 151 ++++++++++++++++++++-
 10 files changed, 252 insertions(+), 24 deletions(-)

       via  c0b9d41a5570862dcaac06b727d88be4d0ac9dc6 (commit)
       via  2255281ed7406e7c10027ed778f53ee28e6869fa (commit)
       via  8d9db88641ada8ecd5400fe4affd9b90647c5d3a (commit)
       via  1df49e868dd28baf47ea01a45d4cb421b97ec0aa (commit)
       via  97bc18eee0a50a4bc0209932c26ab44e51b4836b (commit)
       via  e8f3520fd515b0aaee92193b0b59c85839e2da4c (commit)
       via  209d83a0ce0bd22669a39f49daddca432babeae7 (commit)
       via  b907947d2ce1e2fa44b11ebc1c8a2108bc499d95 (commit)
       via  7efd2bc23c0e72f42a70e6bd968cdae1bf11a366 (commit)
       via  0d1688a1e1d50d562a34279665069230e0851b16 (commit)
      from  da68b65f0264961902d0a26aea42466a69523148 (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 c0b9d41a5570862dcaac06b727d88be4d0ac9dc6
Author: radhika <radhika at curoverse.com>
Date:   Fri Nov 13 13:04:26 2015 -0500

    7490: a few more keep unit tests with simulated errors

diff --git a/services/datamanager/keep/keep_test.go b/services/datamanager/keep/keep_test.go
index 272fad2..246a8e5 100644
--- a/services/datamanager/keep/keep_test.go
+++ b/services/datamanager/keep/keep_test.go
@@ -4,6 +4,9 @@ import (
 	"encoding/json"
 	"net/http"
 	"net/http/httptest"
+	"net/url"
+	"strconv"
+	"strings"
 	"testing"
 
 	"git.curoverse.com/arvados.git/sdk/go/arvadosclient"
@@ -45,7 +48,6 @@ func (s *KeepSuite) TestSendTrashLists(c *C) {
 		map[string]string{})
 
 	err := SendTrashLists(&kc, tl)
-	server.Close()
 
 	c.Check(err, IsNil)
 
@@ -87,3 +89,150 @@ func (s *KeepSuite) TestSendTrashListErrorResponse(c *C) {
 func (s *KeepSuite) TestSendTrashListUnreachable(c *C) {
 	sendTrashListError(c, httptest.NewUnstartedServer(&TestHandler{}))
 }
+
+type APIStub struct {
+	respStatus   int
+	responseBody string
+}
+
+func (h *APIStub) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
+	resp.WriteHeader(h.respStatus)
+	resp.Write([]byte(h.responseBody))
+}
+
+type KeepServerStub struct {
+}
+
+func (ts *KeepServerStub) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
+	http.Error(resp, "oops", 500)
+}
+
+func (s *KeepSuite) TestGetKeepServers_UnsupportedServiceType(c *C) {
+	keepServers := ServiceList{
+		ItemsAvailable: 1,
+		KeepServers: []ServerAddress{{
+			SSL:         false,
+			Host:        "example.com",
+			Port:        12345,
+			UUID:        "abcdefg",
+			ServiceType: "nondisk",
+		}},
+	}
+
+	ksJSON, _ := json.Marshal(keepServers)
+	apiStub := APIStub{200, string(ksJSON)}
+
+	api := httptest.NewServer(&apiStub)
+	defer api.Close()
+
+	arv := arvadosclient.ArvadosClient{
+		Scheme:    "http",
+		ApiServer: api.URL[7:],
+		ApiToken:  "abc123",
+		Client:    &http.Client{Transport: &http.Transport{}},
+	}
+
+	kc := keepclient.KeepClient{Arvados: &arv, Client: &http.Client{}}
+	kc.SetServiceRoots(map[string]string{"xxxx": "http://example.com:23456"},
+		map[string]string{"xxxx": "http://example.com:23456"},
+		map[string]string{})
+
+	params := GetKeepServersParams{
+		Client: arv,
+		Logger: nil,
+		Limit:  10,
+	}
+
+	_, err := GetKeepServersAndSummarize(params)
+	c.Assert(err, ErrorMatches, ".*Unsupported service type.*")
+}
+
+func (s *KeepSuite) TestGetKeepServers_ReceivedTooFewServers(c *C) {
+	keepServers := ServiceList{
+		ItemsAvailable: 2,
+		KeepServers: []ServerAddress{{
+			SSL:         false,
+			Host:        "example.com",
+			Port:        12345,
+			UUID:        "abcdefg",
+			ServiceType: "disk",
+		}},
+	}
+
+	ksJSON, _ := json.Marshal(keepServers)
+	apiStub := APIStub{200, string(ksJSON)}
+
+	api := httptest.NewServer(&apiStub)
+	defer api.Close()
+
+	arv := arvadosclient.ArvadosClient{
+		Scheme:    "http",
+		ApiServer: api.URL[7:],
+		ApiToken:  "abc123",
+		Client:    &http.Client{Transport: &http.Transport{}},
+	}
+
+	kc := keepclient.KeepClient{Arvados: &arv, Client: &http.Client{}}
+	kc.SetServiceRoots(map[string]string{"xxxx": "http://example.com:23456"},
+		map[string]string{"xxxx": "http://example.com:23456"},
+		map[string]string{})
+
+	params := GetKeepServersParams{
+		Client: arv,
+		Logger: nil,
+		Limit:  10,
+	}
+
+	_, err := GetKeepServersAndSummarize(params)
+	c.Assert(err, ErrorMatches, ".*Did not receive all available keep servers.*")
+}
+
+func (s *KeepSuite) TestGetKeepServers_ErrorGettingKeepServerStatus(c *C) {
+	ksStub := KeepServerStub{}
+	ks := httptest.NewServer(&ksStub)
+	defer ks.Close()
+
+	ksURL, err := url.Parse(ks.URL)
+	c.Check(err, IsNil)
+	ksURLParts := strings.Split(ksURL.Host, ":")
+	ksPort, err := strconv.Atoi(ksURLParts[1])
+	c.Check(err, IsNil)
+
+	servers_list := ServiceList{
+		ItemsAvailable: 1,
+		KeepServers: []ServerAddress{{
+			SSL:         false,
+			Host:        strings.Split(ksURL.Host, ":")[0],
+			Port:        ksPort,
+			UUID:        "abcdefg",
+			ServiceType: "disk",
+		}},
+	}
+	ksJSON, _ := json.Marshal(servers_list)
+	apiStub := APIStub{200, string(ksJSON)}
+
+	api := httptest.NewServer(&apiStub)
+	defer api.Close()
+
+	arv := arvadosclient.ArvadosClient{
+		Scheme:    "http",
+		ApiServer: api.URL[7:],
+		ApiToken:  "abc123",
+		Client:    &http.Client{Transport: &http.Transport{}},
+	}
+
+	kc := keepclient.KeepClient{Arvados: &arv, Client: &http.Client{}}
+	kc.SetServiceRoots(map[string]string{"xxxx": ks.URL},
+		map[string]string{"xxxx": ks.URL},
+		map[string]string{})
+
+	params := GetKeepServersParams{
+		Client: arv,
+		Logger: nil,
+		Limit:  10,
+	}
+
+	// This fails during GetServerStatus
+	_, err = GetKeepServersAndSummarize(params)
+	c.Assert(err, ErrorMatches, ".*Error during GetServerContents; no host info found.*")
+}

commit 2255281ed7406e7c10027ed778f53ee28e6869fa
Merge: da68b65 8d9db88
Author: radhika <radhika at curoverse.com>
Date:   Thu Nov 12 16:26:44 2015 -0500

    Merge branch 'master' into 7490-datamanager-dont-die-return-error


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


hooks/post-receive
-- 




More information about the arvados-commits mailing list