-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move to Go 1.5 #3863
Merged
Merged
Move to Go 1.5 #3863
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -498,13 +498,12 @@ func TestBatchPoints_Normal(t *testing.T) { | |
} | ||
|
||
func TestClient_Timeout(t *testing.T) { | ||
done := make(chan bool) | ||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | ||
time.Sleep(1 * time.Second) | ||
var data client.Response | ||
w.WriteHeader(http.StatusOK) | ||
_ = json.NewEncoder(w).Encode(data) | ||
<-done | ||
})) | ||
defer ts.Close() | ||
defer func() { done <- true }() | ||
|
||
u, _ := url.Parse(ts.URL) | ||
config := client.Config{URL: *u, Timeout: 500 * time.Millisecond} | ||
|
@@ -517,13 +516,32 @@ func TestClient_Timeout(t *testing.T) { | |
_, err = c.Query(query) | ||
if err == nil { | ||
t.Fatalf("unexpected success. expected timeout error") | ||
} else if !strings.Contains(err.Error(), "use of closed network connection") { | ||
t.Fatalf("unexpected error. expected 'use of closed network connection' error, got %v", err) | ||
} else if !strings.Contains(err.Error(), "request canceled") { | ||
t.Fatalf("unexpected error. expected 'request canceled' error, got %v", err) | ||
} | ||
} | ||
|
||
confignotimeout := client.Config{URL: *u} | ||
cnotimeout, err := client.NewClient(confignotimeout) | ||
_, err = cnotimeout.Query(query) | ||
func TestClient_NoTimeout(t *testing.T) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if testing.Short() { | ||
t.Skip("skipping in short mode") | ||
} | ||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | ||
time.Sleep(1 * time.Second) | ||
var data client.Response | ||
w.WriteHeader(http.StatusOK) | ||
_ = json.NewEncoder(w).Encode(data) | ||
})) | ||
defer ts.Close() | ||
|
||
u, _ := url.Parse(ts.URL) | ||
config := client.Config{URL: *u} | ||
c, err := client.NewClient(config) | ||
if err != nil { | ||
t.Fatalf("unexpected error. expected %v, actual %v", nil, err) | ||
} | ||
|
||
query := client.Query{} | ||
_, err = c.Query(query) | ||
if err != nil { | ||
t.Fatalf("unexpected error. expected %v, actual %v", nil, err) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@corylanou -- please confirm that this is OK with you. I think the error must have changed in Go 1.5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's interesting. It appears to be a "better" error now. I don't remember reading anything in the release notes on it, but it's probably in their changelog. Seems fine. +1