[ARVADOS] updated: c1d63408c611a5ce65dc4de41aeb323c06da2bbc
git at public.curoverse.com
git at public.curoverse.com
Mon Nov 9 13:50:47 EST 2015
Summary of changes:
sdk/go/arvadosclient/arvadosclient_test.go | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
via c1d63408c611a5ce65dc4de41aeb323c06da2bbc (commit)
from 4c00b4c7c670abe7da5c61e437887a53bbcaadf9 (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 c1d63408c611a5ce65dc4de41aeb323c06da2bbc
Author: radhika <radhika at curoverse.com>
Date: Mon Nov 9 13:49:31 2015 -0500
5538: update the test case for "error" to use better stub parameters with nil status codes and response body to avoid any confusion to the reader.
diff --git a/sdk/go/arvadosclient/arvadosclient_test.go b/sdk/go/arvadosclient/arvadosclient_test.go
index f5ce338..045acf8 100644
--- a/sdk/go/arvadosclient/arvadosclient_test.go
+++ b/sdk/go/arvadosclient/arvadosclient_test.go
@@ -7,7 +7,6 @@ import (
"net"
"net/http"
"os"
- "strings"
"testing"
"time"
)
@@ -314,13 +313,13 @@ func (s *MockArvadosServerSuite) TestWithRetries(c *C) {
{
"get", 0, 401, []int{500, 401, 200}, []string{``, ``, `{"ok":"ok"}`},
},
- // Use expected = 0 to simulate error during request processing
+ // Use nil responseBody to simulate error during request processing
// Even though retryable, the simulated error applies during reties also, and hence "get" also eventually fails in this test.
{
- "get", 0, 0, []int{500, 500, 500}, []string{``, ``, ``},
+ "get", 0, -1, nil, nil,
},
{
- "create", 0, 0, []int{500, 500, 500}, []string{``, ``, ``},
+ "create", 0, -1, nil, nil,
},
} {
api, err := RunFakeArvadosServer(&stub)
@@ -336,9 +335,9 @@ func (s *MockArvadosServerSuite) TestWithRetries(c *C) {
Client: &http.Client{Transport: &http.Transport{}},
Retries: 2}
- // We use expected = 0 to look for errors during request processing
+ // We use nil responseBody to look for errors during request processing
// Simulate an error using https (but the arv.Client transport used does not support it)
- if stub.expected == 0 {
+ if stub.responseBody == nil {
arv.Scheme = "https"
}
@@ -364,10 +363,10 @@ func (s *MockArvadosServerSuite) TestWithRetries(c *C) {
} else {
c.Check(err, NotNil)
- if stub.expected == 0 { // test uses 0 to look for errors during request processing
- c.Check(strings.Contains(err.Error(), fmt.Sprintf("%s", "tls: oversized record received")), Equals, true)
+ if stub.responseBody == nil { // test uses empty responseBody to look for errors during request processing
+ c.Assert(err, ErrorMatches, "* oversized record received.*")
} else {
- c.Check(strings.Contains(err.Error(), fmt.Sprintf("%s%d", "arvados API server error: ", stub.expected)), Equals, true)
+ c.Assert(err, ErrorMatches, fmt.Sprintf("%s%d.*", "arvados API server error: ", stub.expected))
c.Assert(err.(APIServerError).HttpStatusCode, Equals, stub.expected)
}
}
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list