mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-28 17:03:58 +08:00
Merge pull request #4632 from ipfs/fix/windows-tests
Fix go test on Windows
This commit is contained in:
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
assets/init-doc/* binary
|
||||||
|
core/coreunix/test_data/** binary
|
@ -1,3 +1,5 @@
|
|||||||
|
// +build !windows
|
||||||
|
|
||||||
package util
|
package util
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -16,10 +16,12 @@ import (
|
|||||||
cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid"
|
cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var rand = util.NewTimeSeededRand()
|
||||||
|
|
||||||
func randNode() (*mdag.ProtoNode, *cid.Cid) {
|
func randNode() (*mdag.ProtoNode, *cid.Cid) {
|
||||||
nd := new(mdag.ProtoNode)
|
nd := new(mdag.ProtoNode)
|
||||||
nd.SetData(make([]byte, 32))
|
nd.SetData(make([]byte, 32))
|
||||||
util.NewTimeSeededRand().Read(nd.Data())
|
rand.Read(nd.Data())
|
||||||
k := nd.Cid()
|
k := nd.Cid()
|
||||||
return nd, k
|
return nd, k
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package fsrepo
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
config "github.com/ipfs/go-ipfs/repo/config"
|
config "github.com/ipfs/go-ipfs/repo/config"
|
||||||
@ -27,7 +28,10 @@ func TestConfig(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("cannot stat config file: %v", err)
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,9 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
delay "github.com/ipfs/go-ipfs/thirdparty/delay"
|
delay "github.com/ipfs/go-ipfs/thirdparty/delay"
|
||||||
"gx/ipfs/QmVvkK7s5imCiq3JVbL3pGfnhcCnf3LrFJPF4GE2sAoGZf/go-testutil"
|
|
||||||
|
|
||||||
u "gx/ipfs/QmNiJuT8Ja3hMVpBHXv3Q6dwmperaQ6JjLtpMQgMCD7xvx/go-ipfs-util"
|
u "gx/ipfs/QmNiJuT8Ja3hMVpBHXv3Q6dwmperaQ6JjLtpMQgMCD7xvx/go-ipfs-util"
|
||||||
|
testutil "gx/ipfs/QmVvkK7s5imCiq3JVbL3pGfnhcCnf3LrFJPF4GE2sAoGZf/go-testutil"
|
||||||
pstore "gx/ipfs/QmXauCuJzmzapetmC6W4TuDJLL1yFFrVzSHoWv8YdbmnxH/go-libp2p-peerstore"
|
pstore "gx/ipfs/QmXauCuJzmzapetmC6W4TuDJLL1yFFrVzSHoWv8YdbmnxH/go-libp2p-peerstore"
|
||||||
cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid"
|
cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid"
|
||||||
)
|
)
|
||||||
@ -164,6 +164,8 @@ func TestValidAfter(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
conf.ValueVisibility.Set(0)
|
conf.ValueVisibility.Set(0)
|
||||||
|
time.Sleep(100 * time.Millisecond)
|
||||||
|
|
||||||
providersChan = rs.Client(pi).FindProvidersAsync(ctx, key, max)
|
providersChan = rs.Client(pi).FindProvidersAsync(ctx, key, max)
|
||||||
t.Log("providers", providers)
|
t.Log("providers", providers)
|
||||||
for p := range providersChan {
|
for p := range providersChan {
|
||||||
|
Reference in New Issue
Block a user