mirror of
https://github.com/ipfs/kubo.git
synced 2025-09-09 23:42:20 +08:00
testing/ci: all env var checks now use new pkgs
Good thing, i checked one wrong, too!
This commit is contained in:
@ -5,24 +5,20 @@ import (
|
|||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
fstest "github.com/jbenet/go-ipfs/Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil"
|
fstest "github.com/jbenet/go-ipfs/Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil"
|
||||||
|
|
||||||
core "github.com/jbenet/go-ipfs/core"
|
core "github.com/jbenet/go-ipfs/core"
|
||||||
u "github.com/jbenet/go-ipfs/util"
|
u "github.com/jbenet/go-ipfs/util"
|
||||||
|
ci "github.com/jbenet/go-ipfs/util/testutil/ci"
|
||||||
)
|
)
|
||||||
|
|
||||||
func maybeSkipFuseTests(t *testing.T) bool {
|
func maybeSkipFuseTests(t *testing.T) {
|
||||||
v := "TEST_NO_FUSE"
|
if ci.NoFuse() {
|
||||||
n := strings.ToLower(os.Getenv(v))
|
t.Skip("Skipping FUSE tests")
|
||||||
skip := n != "" && n != "false" && n != "f"
|
|
||||||
|
|
||||||
if skip {
|
|
||||||
t.Skipf("Skipping FUSE tests (%s=%s)", v, n)
|
|
||||||
}
|
}
|
||||||
return skip
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func randBytes(size int) []byte {
|
func randBytes(size int) []byte {
|
||||||
|
@ -3,13 +3,14 @@ package conn
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
|
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
|
||||||
|
|
||||||
|
travis "github.com/jbenet/go-ipfs/util/testutil/ci/travis"
|
||||||
)
|
)
|
||||||
|
|
||||||
func testOneSendRecv(t *testing.T, c1, c2 Conn) {
|
func testOneSendRecv(t *testing.T, c1, c2 Conn) {
|
||||||
@ -62,7 +63,7 @@ func TestCloseLeak(t *testing.T) {
|
|||||||
t.SkipNow()
|
t.SkipNow()
|
||||||
}
|
}
|
||||||
|
|
||||||
if os.Getenv("TRAVIS") == "true" {
|
if travis.IsRunning() {
|
||||||
t.Skip("this doesn't work well on travis")
|
t.Skip("this doesn't work well on travis")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,13 +2,13 @@ package conn
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"os"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
ic "github.com/jbenet/go-ipfs/p2p/crypto"
|
ic "github.com/jbenet/go-ipfs/p2p/crypto"
|
||||||
|
travis "github.com/jbenet/go-ipfs/util/testutil/ci/travis"
|
||||||
|
|
||||||
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
|
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
|
||||||
)
|
)
|
||||||
@ -131,7 +131,7 @@ func TestSecureCloseLeak(t *testing.T) {
|
|||||||
if testing.Short() {
|
if testing.Short() {
|
||||||
t.SkipNow()
|
t.SkipNow()
|
||||||
}
|
}
|
||||||
if os.Getenv("TRAVIS") == "true" {
|
if travis.IsRunning() {
|
||||||
t.Skip("this doesn't work well on travis")
|
t.Skip("this doesn't work well on travis")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,14 +2,16 @@ package swarm
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
"os"
|
|
||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
addrutil "github.com/jbenet/go-ipfs/p2p/net/swarm/addr"
|
addrutil "github.com/jbenet/go-ipfs/p2p/net/swarm/addr"
|
||||||
peer "github.com/jbenet/go-ipfs/p2p/peer"
|
peer "github.com/jbenet/go-ipfs/p2p/peer"
|
||||||
|
|
||||||
testutil "github.com/jbenet/go-ipfs/util/testutil"
|
testutil "github.com/jbenet/go-ipfs/util/testutil"
|
||||||
|
jenkins "github.com/jbenet/go-ipfs/util/testutil/ci/jenkins"
|
||||||
|
travis "github.com/jbenet/go-ipfs/util/testutil/ci/travis"
|
||||||
|
|
||||||
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
|
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
|
||||||
ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
|
ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
|
||||||
@ -114,7 +116,7 @@ func TestDialWait(t *testing.T) {
|
|||||||
defer s1.Close()
|
defer s1.Close()
|
||||||
|
|
||||||
s1.dialT = time.Millisecond * 300 // lower timeout for tests.
|
s1.dialT = time.Millisecond * 300 // lower timeout for tests.
|
||||||
if os.Getenv("TRAVIS") == "true" {
|
if travis.IsRunning() {
|
||||||
s1.dialT = time.Second
|
s1.dialT = time.Second
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,8 +150,8 @@ func TestDialWait(t *testing.T) {
|
|||||||
|
|
||||||
func TestDialBackoff(t *testing.T) {
|
func TestDialBackoff(t *testing.T) {
|
||||||
// t.Skip("skipping for another test")
|
// t.Skip("skipping for another test")
|
||||||
if os.Getenv("TRAVIS") == "true" {
|
if travis.IsRunning() || jenkins.IsRunning() {
|
||||||
t.Skip("travis will never have fun with this test")
|
t.Skip("travis and jenkins will never have fun with this test")
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
@ -375,7 +377,7 @@ func TestDialBackoffClears(t *testing.T) {
|
|||||||
defer s2.Close()
|
defer s2.Close()
|
||||||
s1.dialT = time.Millisecond * 300 // lower timeout for tests.
|
s1.dialT = time.Millisecond * 300 // lower timeout for tests.
|
||||||
s2.dialT = time.Millisecond * 300 // lower timeout for tests.
|
s2.dialT = time.Millisecond * 300 // lower timeout for tests.
|
||||||
if os.Getenv("TRAVIS") == "true" {
|
if travis.IsRunning() {
|
||||||
s1.dialT = time.Second
|
s1.dialT = time.Second
|
||||||
s2.dialT = time.Second
|
s2.dialT = time.Second
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
package ctxutil
|
package ctxutil
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
travis "github.com/jbenet/go-ipfs/util/testutil/ci/travis"
|
||||||
|
|
||||||
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
|
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
// this test is on the context tool itself, not our stuff. it's for sanity on ours.
|
// this test is on the context tool itself, not our stuff. it's for sanity on ours.
|
||||||
func TestDeadline(t *testing.T) {
|
func TestDeadline(t *testing.T) {
|
||||||
if os.Getenv("TRAVIS") == "true" {
|
if travis.IsRunning() {
|
||||||
t.Skip("timeouts don't work reliably on travis")
|
t.Skip("timeouts don't work reliably on travis")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ func TestDeadlineFractionForever(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDeadlineFractionHalf(t *testing.T) {
|
func TestDeadlineFractionHalf(t *testing.T) {
|
||||||
if os.Getenv("TRAVIS") == "true" {
|
if travis.IsRunning() {
|
||||||
t.Skip("timeouts don't work reliably on travis")
|
t.Skip("timeouts don't work reliably on travis")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,11 +42,11 @@ func Env(v EnvVar) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns whether FUSE is explicitly disabled wiht TEST_NO_FUSE.
|
// Returns whether FUSE is explicitly disabled wiht TEST_NO_FUSE.
|
||||||
func NoFuse(v EnvVar) bool {
|
func NoFuse() bool {
|
||||||
return os.Getenv(string(VarNoFuse)) == "1"
|
return os.Getenv(string(VarNoFuse)) == "1"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns whether TEST_VERBOSE is enabled.
|
// Returns whether TEST_VERBOSE is enabled.
|
||||||
func Verbose(v EnvVar) bool {
|
func Verbose() bool {
|
||||||
return os.Getenv(string(VarVerbose)) == "1"
|
return os.Getenv(string(VarVerbose)) == "1"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user