Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(331)

Issue 7323063: code review 7323063: exp/cookiejar: replace fake creation time by order parameter (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 4 months ago by volker.dobler
Modified:
12 years, 4 months ago
Reviewers:
CC:
nigeltao, brainman, dave_cheney.net, golang-dev
Visibility:
Public.

Description

exp/cookiejar: make cookie sorting deterministic Sorting of cookies with same path length and same creation time is done by an additional seqNum field. This makes the order in which cookies are returned in Cookies deterministic, even if the system clock is manipulated or on systems with a low-resolution clock. The tests now use a synthetic time: This makes cookie testing reliable in case of bogus system clocks and speeds up the expiration tests.

Patch Set 1 #

Patch Set 2 : diff -r 8c44c45a208e https://code.google.com/p/go/ #

Patch Set 3 : diff -r 8c44c45a208e https://code.google.com/p/go/ #

Patch Set 4 : diff -r 8c44c45a208e https://code.google.com/p/go/ #

Patch Set 5 : diff -r 8c44c45a208e https://code.google.com/p/go/ #

Total comments: 10

Patch Set 6 : diff -r 41ab0ca75ea3 https://code.google.com/p/go/ #

Patch Set 7 : diff -r 2523d1acf788 https://code.google.com/p/go/ #

Total comments: 4

Patch Set 8 : diff -r 2523d1acf788 https://code.google.com/p/go/ #

Patch Set 9 : diff -r 6f23480a76e1 https://code.google.com/p/go/ #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+65 lines, -41 lines) Patch
src/pkg/exp/cookiejar/jar.go View 1 2 3 4 5 6 7 10 chunks +31 lines, -11 lines 0 comments Download
src/pkg/exp/cookiejar/jar_test.go View 1 2 3 4 5 6 7 8 12 chunks +34 lines, -30 lines 1 comment Download

Messages

Total messages: 18
volker.dobler
Hello nigeltao@golang.org (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go/
12 years, 4 months ago (2013-02-14 09:51:32 UTC) #1
volker.dobler
Hello nigeltao@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
12 years, 4 months ago (2013-02-14 10:13:46 UTC) #2
brainman
Still fails on windows: === RUN TestCanonicalHost --- PASS: TestCanonicalHost (0.00 seconds) === RUN TestHasPort ...
12 years, 4 months ago (2013-02-14 23:41:44 UTC) #3
nigeltao
https://codereview.appspot.com/7323063/diff/12001/src/pkg/exp/cookiejar/jar.go File src/pkg/exp/cookiejar/jar.go (right): https://codereview.appspot.com/7323063/diff/12001/src/pkg/exp/cookiejar/jar.go#newcode68 src/pkg/exp/cookiejar/jar.go:68: cnt uint64 I'd call the field nextSeqNum. https://codereview.appspot.com/7323063/diff/12001/src/pkg/exp/cookiejar/jar.go#newcode84 src/pkg/exp/cookiejar/jar.go:84: ...
12 years, 4 months ago (2013-02-15 04:43:00 UTC) #4
volker.dobler
PTAL Incorporated all the feedback and tried to make the expiration code more stable by: ...
12 years, 4 months ago (2013-02-15 08:15:01 UTC) #5
brainman
Still fails on windows: --- FAIL: TestUpdateAndDelete (0.00 seconds) jar_test.go:266: Test "Delete all." Content got ...
12 years, 4 months ago (2013-02-15 10:06:19 UTC) #6
volker.dobler
That is strange. I cannot reproduce the failure on Windows 64. Could you try it ...
12 years, 4 months ago (2013-02-15 11:33:05 UTC) #7
dave_cheney.net
Time inside vm's is strange. On Fri, Feb 15, 2013 at 10:33 PM, Volker Dobler ...
12 years, 4 months ago (2013-02-15 11:33:49 UTC) #8
volker.dobler
PTAL Started to remove expiration tests based on passing time by artificially creating expired cookies ...
12 years, 4 months ago (2013-02-15 18:09:59 UTC) #9
nigeltao
Looks good in general, but let's see what brainman says. https://codereview.appspot.com/7323063/diff/23001/src/pkg/exp/cookiejar/jar.go File src/pkg/exp/cookiejar/jar.go (right): https://codereview.appspot.com/7323063/diff/23001/src/pkg/exp/cookiejar/jar.go#newcode67 ...
12 years, 4 months ago (2013-02-16 01:05:15 UTC) #10
brainman
On 2013/02/16 01:05:15, nigeltao wrote: > Looks good in general, but let's see what brainman ...
12 years, 4 months ago (2013-02-16 03:11:54 UTC) #11
volker.dobler
Thanks for running the test. I cross-compiled the test and on my Windows 7 Enterprise, ...
12 years, 4 months ago (2013-02-16 08:46:56 UTC) #12
brainman
The problem seems to be my timezone. expiresIn in jar_test.go creates "expires= ... AUSEDT". http.readSetCookies ...
12 years, 4 months ago (2013-02-17 06:59:14 UTC) #13
volker.dobler
Thanks for debugging this. I changed the tests to a) use UTC as timezone and ...
12 years, 4 months ago (2013-02-17 12:47:49 UTC) #14
volker.dobler
PTAL Should work reliable on any OS and under any strange system clock.
12 years, 4 months ago (2013-02-17 12:48:50 UTC) #15
brainman
Tests PASS on my windows computer now. Thank you. Alex PS: I have created http://code.google.com/p/go/issues/detail?id=4838 ...
12 years, 4 months ago (2013-02-17 23:35:51 UTC) #16
nigeltao
LGTM, submitting... A couple of minor points. First, the CL description should mention re-enabling those ...
12 years, 4 months ago (2013-02-18 00:27:03 UTC) #17
nigeltao
12 years, 4 months ago (2013-02-18 00:27:58 UTC) #18
*** Submitted as https://code.google.com/p/go/source/detail?r=10534bf6553f ***

exp/cookiejar: make cookie sorting deterministic.

Re-enable TestUpdateAndDelete, TestExpiration, TestChromiumDomain and
TestChromiumDeletion on Windows.

Sorting of cookies with same path length and same creation
time is done by an additional seqNum field.
This makes the order in which cookies are returned in Cookies
deterministic, even if the system clock is manipulated or on
systems with a low-resolution clock.

The tests now use a synthetic time: This makes cookie testing
reliable in case of bogus system clocks and speeds up the
expiration tests.

R=nigeltao, alex.brainman, dave
CC=golang-dev
https://codereview.appspot.com/7323063

Committer: Nigel Tao <nigeltao@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b