This repository has been archived by the owner on Dec 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate test utilities to go-libp2p-testing (#24)
- Loading branch information
Showing
13 changed files
with
222 additions
and
445 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci instead. | ||
package ci | ||
|
||
import testing "github.com/libp2p/go-libp2p-testing/ci" | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci.EnvVar instead. | ||
type EnvVar = testing.EnvVar | ||
|
||
const ( | ||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci.VarCI instead. | ||
VarCI = testing.VarCI | ||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci.VarNoFuse instead. | ||
VarNoFuse = testing.VarNoFuse | ||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci.VarVerbose instead. | ||
VarVerbose = testing.VarVerbose | ||
) | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci.IsRunning instead. | ||
func IsRunning() bool { | ||
return testing.IsRunning() | ||
} | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci.EnvVar instead. | ||
func Env(v EnvVar) string { | ||
return testing.Env(v) | ||
} | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci.NoFuse instead. | ||
func NoFuse() bool { | ||
return testing.NoFuse() | ||
} | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci.Verbose instead. | ||
func Verbose() bool { | ||
return testing.Verbose() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci/travis instead. | ||
package travis | ||
|
||
import testing "github.com/libp2p/go-libp2p-testing/ci/travis" | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci/travis.EnvVar instead. | ||
type EnvVar = testing.EnvVar | ||
|
||
const ( | ||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci/travis.EnvVar instead. | ||
VarCI = testing.VarCI | ||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci/travis.VarTravis instead. | ||
VarTravis = testing.VarTravis | ||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci/travis.VarBranch instead. | ||
VarBranch = testing.VarBranch | ||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci/travis.VarBuildDir instead. | ||
VarBuildDir = testing.VarBuildDir | ||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci/travis.VarBuildId instead. | ||
VarBuildId = testing.VarBuildId | ||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci/travis.VarBuildNumber instead. | ||
VarBuildNumber = testing.VarBuildNumber | ||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci/travis.VarCommit instead. | ||
VarCommit = testing.VarCommit | ||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci/travis.VarCommitRange instead. | ||
VarCommitRange = testing.VarCommitRange | ||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci/travis.VarJobId instead. | ||
VarJobId = testing.VarJobId | ||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci/travis.VarJobNumber instead. | ||
VarJobNumber = testing.VarJobNumber | ||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci/travis.VarPullRequest instead. | ||
VarPullRequest = testing.VarPullRequest | ||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci/travis.VarSecureEnvVars instead. | ||
VarSecureEnvVars = testing.VarSecureEnvVars | ||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci/travis.VarRepoSlug instead. | ||
VarRepoSlug = testing.VarRepoSlug | ||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci/travis.VarOsName instead. | ||
VarOsName = testing.VarOsName | ||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci/travis.VarTag instead. | ||
VarTag = testing.VarTag | ||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci/travis.VarGoVersion instead. | ||
VarGoVersion = testing.VarGoVersion | ||
) | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci/travis.IsRunning instead. | ||
func IsRunning() bool { | ||
return testing.IsRunning() | ||
} | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci/travis.Env instead. | ||
func Env(v EnvVar) string { | ||
return testing.Env(v) | ||
} | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci/travis.JobId instead. | ||
func JobId() string { | ||
return testing.JobId() | ||
} | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/ci/travis.JobNumber instead. | ||
func JobNumber() string { | ||
return testing.JobNumber() | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
// Deprecated: use github.com/libp2p/go-libp2p-testing and subpackages instead. | ||
package testutil | ||
|
||
import ( | ||
"context" | ||
"math/rand" | ||
"testing" | ||
|
||
ci "github.com/libp2p/go-libp2p-core/crypto" | ||
"github.com/libp2p/go-libp2p-core/peer" | ||
"github.com/libp2p/go-libp2p-core/test" | ||
|
||
"github.com/libp2p/go-libp2p-testing/etc" | ||
"github.com/libp2p/go-libp2p-testing/net" | ||
|
||
ma "github.com/multiformats/go-multiaddr" | ||
) | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/net.ZeroLocalTCPAddress instead. | ||
// Warning: it's impossible to alias a var in go. Writes to this var would have no longer | ||
// have any effect, so it has been commented out to induce breakage for added safety. | ||
// var ZeroLocalTCPAddress = tnet.ZeroLocalTCPAddress | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-core/test.RandTestKeyPair instead. | ||
// Supply RSA as a key type to get an equivalent result. | ||
func RandTestKeyPair(bits int) (ci.PrivKey, ci.PubKey, error) { | ||
return test.RandTestKeyPair(ci.RSA, bits) | ||
} | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-core/test.SeededTestKeyPair instead. | ||
// Supply RSA as a key type, with 512 bits, to get an equivalent result. | ||
func SeededTestKeyPair(seed int64) (ci.PrivKey, ci.PubKey, error) { | ||
return test.SeededTestKeyPair(ci.RSA, 512, seed) | ||
} | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-core/test.RandPeerID instead. | ||
func RandPeerID() (peer.ID, error) { | ||
return test.RandPeerID() | ||
} | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-core/test.RandPeerIDFatal instead. | ||
func RandPeerIDFatal(t testing.TB) peer.ID { | ||
return test.RandPeerIDFatal(t) | ||
} | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/net.RandLocalTCPAddress instead. | ||
func RandLocalTCPAddress() ma.Multiaddr { | ||
return tnet.RandLocalTCPAddress() | ||
} | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/net.PeerNetParams instead. | ||
type PeerNetParams = tnet.PeerNetParams | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/net.RandPeerNetParamsOrFatal instead. | ||
func RandPeerNetParamsOrFatal(t *testing.T) PeerNetParams { | ||
return tnet.RandPeerNetParamsOrFatal(t) | ||
} | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/net.RandPeerNetParams instead. | ||
func RandPeerNetParams() (*PeerNetParams, error) { | ||
return tnet.RandPeerNetParams() | ||
} | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/net.Identity instead. | ||
type Identity = tnet.Identity | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/net.RandIdentity instead. | ||
func RandIdentity() (Identity, error) { | ||
return tnet.RandIdentity() | ||
} | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/net.RandIdentityOrFatal instead. | ||
func RandIdentityOrFatal(t *testing.T) Identity { | ||
return tnet.RandIdentityOrFatal(t) | ||
} | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/net.NewIdentity instead. | ||
func NewIdentity(ID peer.ID, addr ma.Multiaddr, privk ci.PrivKey, pubk ci.PubKey) Identity { | ||
return tnet.NewIdentity(ID, addr, privk, pubk) | ||
} | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/net.LatencyConfig instead. | ||
type LatencyConfig = tnet.LatencyConfig | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/etc.SeededRand instead. | ||
var SeededRand = tetc.SeededRand | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/etc.NewSeededRand instead. | ||
func NewSeededRand(seed int64) *rand.Rand { | ||
return tetc.NewSeededRand(seed) | ||
} | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/etc.LockedRandSource instead. | ||
type LockedRandSource = tetc.LockedRandSource | ||
|
||
// Deprecated: use github.com/libp2p/go-libp2p-testing/etc.WaitFor instead. | ||
func WaitFor(ctx context.Context, check func() error) error { | ||
return tetc.WaitFor(ctx, check) | ||
} |
Oops, something went wrong.