Skip to content
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

many: switch to use http numeric statuses as agreed #3486

Merged
merged 9 commits into from Jun 15, 2017

Conversation

pedronis
Copy link
Collaborator

@pedronis pedronis commented Jun 15, 2017

Also change the code that was interpreting a 401 as "please buy" which is the unlikely case.

Also have a static check to make sure we continue with this style.

Copy link
Contributor

@chipaca chipaca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@@ -698,15 +700,15 @@ func (t *remoteRepoTestSuite) TestActualDownloadNonPurchased401(c *C) {
var buf bytes.Buffer
err := download(context.TODO(), "foo", "sha3", mockServer.URL, nil, theStore, nopeSeeker{&buf}, -1, nil)
c.Assert(err, NotNil)
c.Check(err.Error(), Equals, "Please buy foo before installing it.")
c.Check(err.Error(), Equals, "please buy foo before installing it.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice drive-by there

run-checks Outdated
echo 'Check for usages of http.Status*'
got=""
for dir in $(go list -f '{{.Dir}}' ./... | grep -v '/vendor/' ); do
s="$(grep -nE "http\.Status" "$dir"/*.go |grep -vE "http\.StatusText\(" || true)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could also write that grep -nP 'http\.Status(?!Text)', fwiw.

n := 0
mockServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
n++
w.WriteHeader(http.StatusUnauthorized)
// XXX: the server doesn't behave correctly ATM
// but 401 for non purchases is the unlikely case so far
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this still true? I thought work was being done on this front

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, is still true to some extent

@codecov-io
Copy link

codecov-io commented Jun 15, 2017

Codecov Report

Merging #3486 into master will not change coverage.
The diff coverage is 55%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3486   +/-   ##
=======================================
  Coverage   77.16%   77.16%           
=======================================
  Files         373      373           
  Lines       25793    25793           
=======================================
  Hits        19903    19903           
  Misses       4133     4133           
  Partials     1757     1757
Impacted Files Coverage Δ
overlord/devicestate/handlers.go 66.79% <0%> (ø) ⬆️
client/client.go 80.88% <100%> (ø) ⬆️
client/asserts.go 87.5% <100%> (ø) ⬆️
daemon/daemon.go 64.21% <100%> (ø) ⬆️
httputil/retry.go 93.22% <100%> (ø) ⬆️
client/icons.go 89.47% <100%> (ø) ⬆️
tests/lib/fakestore/store/store.go 64.05% <5.26%> (ø) ⬆️
daemon/api.go 73.19% <58.33%> (ø) ⬆️
daemon/response.go 88.6% <83.33%> (ø) ⬆️
store/store.go 79.62% <88.23%> (ø) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cd8b523...906d1bf. Read the comment docs.

@pedronis pedronis merged commit 1383502 into snapcore:master Jun 15, 2017
@pedronis pedronis deleted the http-numeric-statuses branch June 16, 2017 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants