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

Fix go test on Windows #4632

Merged
merged 5 commits into from
Feb 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
assets/init-doc/* binary
core/coreunix/test_data/** binary
2 changes: 2 additions & 0 deletions cmd/ipfs/util/ulimit_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !windows

package util

import (
Expand Down
4 changes: 3 additions & 1 deletion pin/pin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ import (
cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid"
)

var rand = util.NewTimeSeededRand()

func randNode() (*mdag.ProtoNode, *cid.Cid) {
nd := new(mdag.ProtoNode)
nd.SetData(make([]byte, 32))
util.NewTimeSeededRand().Read(nd.Data())
rand.Read(nd.Data())
k := nd.Cid()
return nd, k
}
Expand Down
8 changes: 6 additions & 2 deletions repo/fsrepo/serialize/serialize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package fsrepo

import (
"os"
"runtime"
"testing"

config "github.com/ipfs/go-ipfs/repo/config"
Expand All @@ -27,7 +28,10 @@ func TestConfig(t *testing.T) {
if err != nil {
t.Fatalf("cannot stat config file: %v", err)
}
if g := st.Mode().Perm(); g&0117 != 0 {
t.Fatalf("config file should not be executable or accessible to world: %v", g)

if runtime.GOOS != "windows" { // see https://golang.org/src/os/types_windows.go
if g := st.Mode().Perm(); g&0117 != 0 {
t.Fatalf("config file should not be executable or accessible to world: %v", g)
}
}
}
4 changes: 3 additions & 1 deletion routing/mock/centralized_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"time"

delay "github.com/ipfs/go-ipfs/thirdparty/delay"
"gx/ipfs/QmVvkK7s5imCiq3JVbL3pGfnhcCnf3LrFJPF4GE2sAoGZf/go-testutil"

u "gx/ipfs/QmNiJuT8Ja3hMVpBHXv3Q6dwmperaQ6JjLtpMQgMCD7xvx/go-ipfs-util"
testutil "gx/ipfs/QmVvkK7s5imCiq3JVbL3pGfnhcCnf3LrFJPF4GE2sAoGZf/go-testutil"
pstore "gx/ipfs/QmXauCuJzmzapetmC6W4TuDJLL1yFFrVzSHoWv8YdbmnxH/go-libp2p-peerstore"
cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid"
)
Expand Down Expand Up @@ -164,6 +164,8 @@ func TestValidAfter(t *testing.T) {
}

conf.ValueVisibility.Set(0)
time.Sleep(100 * time.Millisecond)

providersChan = rs.Client(pi).FindProvidersAsync(ctx, key, max)
t.Log("providers", providers)
for p := range providersChan {
Expand Down