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

ipns_test: fix slice bounds out of range #1414

Merged
merged 1 commit into from
Jun 23, 2015
Merged

ipns_test: fix slice bounds out of range #1414

merged 1 commit into from
Jun 23, 2015

Conversation

chriscool
Copy link
Contributor

This fixes issue #1411 (go test error in TestConcurentWrites: slice bounds out of range).

License: MIT
Signed-off-by: Christian Couder chriscool@tuxfamily.org

@jbenet jbenet added the status/in-progress In progress label Jun 22, 2015
@jbenet jbenet mentioned this pull request Jun 22, 2015
55 tasks
@cryptix
Copy link
Contributor

cryptix commented Jun 22, 2015

Hmm, looks correct to me.

verifyFile() checks if data was written to path, right? Does it need to be this handwoven?

Something like this would be more maintainable, imho.

func verifyFile(t *testing.T, path string, wantData []byte) {
    isData, err := ioutil.ReadFile(path)
    if err != nil {
        t.Fatal(err)
    }
    if len(isData) != len(wantData) {
        t.Fatal("Data not equal - length check failed")
    }
    if !bytes.Equal(isData, wantData) {
        t.Fatal("Data not equal")
    }
}

@chriscool
Copy link
Contributor Author

The Travis errors are the following:

--- FAIL: TestNotifications-2 (0.01s)
    mock_notif_test.go:57: got notif for conn
    mock_notif_test.go:57: got notif for conn
    mock_notif_test.go:57: got notif for conn
    mock_notif_test.go:57: got notif for conn
    mock_notif_test.go:57: got notif for conn
    mock_notif_test.go:57: got notif for conn
    mock_notif_test.go:57: got notif for conn
    mock_notif_test.go:57: got notif for conn
    mock_notif_test.go:57: got notif for conn
    mock_notif_test.go:57: got notif for conn
    mock_notif_test.go:57: got notif for conn
    mock_notif_test.go:57: got notif for conn
    mock_notif_test.go:57: got notif for conn
    mock_notif_test.go:57: got notif for conn
    mock_notif_test.go:57: got notif for conn
    mock_notif_test.go:57: got notif for conn
    mock_notif_test.go:57: got notif for conn
    mock_notif_test.go:57: got notif for conn
    mock_notif_test.go:61: connection not found
    mock_notif_test.go:61: connection not found
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:129: <peer.ID SVqTeW> /ip4/127.0.0.1/tcp/51932 <--0xc20807d2f0--> <peer.ID THqMv5> /ip4/127.0.0.1/tcp/51930
    mock_notif_test.go:133: <peer.ID THqMv5> /ip4/127.0.0.1/tcp/51930 <--0xc20807d320--> <peer.ID SVqTeW> /ip4/127.0.0.1/tcp/51932
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:129: <peer.ID SVqTeW> /ip4/127.0.0.1/tcp/51932 <--0xc208123890--> <peer.ID W9tFEy> /ip4/127.0.0.1/tcp/51929
    mock_notif_test.go:133: <peer.ID W9tFEy> /ip4/127.0.0.1/tcp/51929 <--0xc2081238c0--> <peer.ID SVqTeW> /ip4/127.0.0.1/tcp/51932
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:129: <peer.ID SVqTeW> /ip4/127.0.0.1/tcp/51932 <--0xc208131e30--> <peer.ID azSmnd> /ip4/127.0.0.1/tcp/51928
    mock_notif_test.go:133: <peer.ID azSmnd> /ip4/127.0.0.1/tcp/51928 <--0xc208131e60--> <peer.ID SVqTeW> /ip4/127.0.0.1/tcp/51932
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:129: <peer.ID SVqTeW> /ip4/127.0.0.1/tcp/51932 <--0xc208136390--> <peer.ID eFtCct> /ip4/127.0.0.1/tcp/51931
    mock_notif_test.go:133: <peer.ID eFtCct> /ip4/127.0.0.1/tcp/51931 <--0xc2081363c0--> <peer.ID SVqTeW> /ip4/127.0.0.1/tcp/51932
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:129: <peer.ID THqMv5> /ip4/127.0.0.1/tcp/51930 <--0xc208136e70--> <peer.ID SVqTeW> /ip4/127.0.0.1/tcp/51932
    mock_notif_test.go:133: <peer.ID SVqTeW> /ip4/127.0.0.1/tcp/51932 <--0xc208136ea0--> <peer.ID THqMv5> /ip4/127.0.0.1/tcp/51930
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:129: <peer.ID THqMv5> /ip4/127.0.0.1/tcp/51930 <--0xc2080cfe00--> <peer.ID W9tFEy> /ip4/127.0.0.1/tcp/51929
    mock_notif_test.go:133: <peer.ID W9tFEy> /ip4/127.0.0.1/tcp/51929 <--0xc2080cfe30--> <peer.ID THqMv5> /ip4/127.0.0.1/tcp/51930
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:129: <peer.ID THqMv5> /ip4/127.0.0.1/tcp/51930 <--0xc2081227b0--> <peer.ID azSmnd> /ip4/127.0.0.1/tcp/51928
    mock_notif_test.go:133: <peer.ID azSmnd> /ip4/127.0.0.1/tcp/51928 <--0xc2081227e0--> <peer.ID THqMv5> /ip4/127.0.0.1/tcp/51930
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:129: <peer.ID THqMv5> /ip4/127.0.0.1/tcp/51930 <--0xc20811ecf0--> <peer.ID eFtCct> /ip4/127.0.0.1/tcp/51931
    mock_notif_test.go:133: <peer.ID eFtCct> /ip4/127.0.0.1/tcp/51931 <--0xc20811ed20--> <peer.ID THqMv5> /ip4/127.0.0.1/tcp/51930
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:129: <peer.ID W9tFEy> /ip4/127.0.0.1/tcp/51929 <--0xc208071290--> <peer.ID eFtCct> /ip4/127.0.0.1/tcp/51931
    mock_notif_test.go:133: <peer.ID eFtCct> /ip4/127.0.0.1/tcp/51931 <--0xc2080712c0--> <peer.ID W9tFEy> /ip4/127.0.0.1/tcp/51929
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:129: <peer.ID W9tFEy> /ip4/127.0.0.1/tcp/51929 <--0xc20807b830--> <peer.ID SVqTeW> /ip4/127.0.0.1/tcp/51932
    mock_notif_test.go:133: <peer.ID SVqTeW> /ip4/127.0.0.1/tcp/51932 <--0xc20807b860--> <peer.ID W9tFEy> /ip4/127.0.0.1/tcp/51929
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:129: <peer.ID W9tFEy> /ip4/127.0.0.1/tcp/51929 <--0xc208077dd0--> <peer.ID THqMv5> /ip4/127.0.0.1/tcp/51930
    mock_notif_test.go:133: <peer.ID THqMv5> /ip4/127.0.0.1/tcp/51930 <--0xc208077e00--> <peer.ID W9tFEy> /ip4/127.0.0.1/tcp/51929
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:129: <peer.ID W9tFEy> /ip4/127.0.0.1/tcp/51929 <--0xc208132390--> <peer.ID azSmnd> /ip4/127.0.0.1/tcp/51928
    mock_notif_test.go:133: <peer.ID azSmnd> /ip4/127.0.0.1/tcp/51928 <--0xc2081323c0--> <peer.ID W9tFEy> /ip4/127.0.0.1/tcp/51929
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:129: <peer.ID azSmnd> /ip4/127.0.0.1/tcp/51928 <--0xc2080cc8d0--> <peer.ID SVqTeW> /ip4/127.0.0.1/tcp/51932
    mock_notif_test.go:133: <peer.ID SVqTeW> /ip4/127.0.0.1/tcp/51932 <--0xc2080cc900--> <peer.ID azSmnd> /ip4/127.0.0.1/tcp/51928
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:129: <peer.ID azSmnd> /ip4/127.0.0.1/tcp/51928 <--0xc20810ae10--> <peer.ID THqMv5> /ip4/127.0.0.1/tcp/51930
    mock_notif_test.go:133: <peer.ID THqMv5> /ip4/127.0.0.1/tcp/51930 <--0xc20810ae40--> <peer.ID azSmnd> /ip4/127.0.0.1/tcp/51928
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:129: <peer.ID azSmnd> /ip4/127.0.0.1/tcp/51928 <--0xc20810d350--> <peer.ID W9tFEy> /ip4/127.0.0.1/tcp/51929
    mock_notif_test.go:133: <peer.ID W9tFEy> /ip4/127.0.0.1/tcp/51929 <--0xc20810d380--> <peer.ID azSmnd> /ip4/127.0.0.1/tcp/51928
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:129: <peer.ID azSmnd> /ip4/127.0.0.1/tcp/51928 <--0xc208111890--> <peer.ID eFtCct> /ip4/127.0.0.1/tcp/51931
    mock_notif_test.go:133: <peer.ID eFtCct> /ip4/127.0.0.1/tcp/51931 <--0xc2081118c0--> <peer.ID azSmnd> /ip4/127.0.0.1/tcp/51928
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:129: <peer.ID eFtCct> /ip4/127.0.0.1/tcp/51931 <--0xc208110000--> <peer.ID SVqTeW> /ip4/127.0.0.1/tcp/51932
    mock_notif_test.go:133: <peer.ID SVqTeW> /ip4/127.0.0.1/tcp/51932 <--0xc208110030--> <peer.ID eFtCct> /ip4/127.0.0.1/tcp/51931
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:129: <peer.ID eFtCct> /ip4/127.0.0.1/tcp/51931 <--0xc208136630--> <peer.ID THqMv5> /ip4/127.0.0.1/tcp/51930
    mock_notif_test.go:133: <peer.ID THqMv5> /ip4/127.0.0.1/tcp/51930 <--0xc208136660--> <peer.ID eFtCct> /ip4/127.0.0.1/tcp/51931
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:129: <peer.ID eFtCct> /ip4/127.0.0.1/tcp/51931 <--0xc2080cec60--> <peer.ID W9tFEy> /ip4/127.0.0.1/tcp/51929
    mock_notif_test.go:133: <peer.ID W9tFEy> /ip4/127.0.0.1/tcp/51929 <--0xc2080cec90--> <peer.ID eFtCct> /ip4/127.0.0.1/tcp/51931
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:129: <peer.ID eFtCct> /ip4/127.0.0.1/tcp/51931 <--0xc2080437a0--> <peer.ID azSmnd> /ip4/127.0.0.1/tcp/51928
    mock_notif_test.go:133: <peer.ID azSmnd> /ip4/127.0.0.1/tcp/51928 <--0xc208043800--> <peer.ID eFtCct> /ip4/127.0.0.1/tcp/51931
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
    mock_notif_test.go:83: got notif for opened stream
    mock_notif_test.go:93: got notif for closed stream
FAIL
FAIL    github.com/ipfs/go-ipfs/p2p/net/mock    1.771s

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
@chriscool
Copy link
Contributor Author

@cryptix ok I will force push using your version.

@jbenet
Copy link
Member

jbenet commented Jun 23, 2015

LGTM, thanks @chriscool

jbenet added a commit that referenced this pull request Jun 23, 2015
ipns_test: fix slice bounds out of range
@jbenet jbenet merged commit 3f28663 into master Jun 23, 2015
@jbenet jbenet removed the status/in-progress In progress label Jun 23, 2015
@jbenet jbenet deleted the fix-verify-file branch June 23, 2015 04:14
wking added a commit that referenced this pull request Jun 24, 2015
License: MIT
Signed-off-by: W. Trevor King <wking@tremily.us>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants