Skip to content
This repository was archived by the owner on Dec 7, 2019. It is now read-only.

migrate test utilities to go-libp2p-testing #24

Merged
merged 5 commits into from
May 24, 2019
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
46 changes: 0 additions & 46 deletions ci/ci.go

This file was deleted.

36 changes: 36 additions & 0 deletions ci/deprecated.go
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()
}
62 changes: 62 additions & 0 deletions ci/travis/deprecated.go
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()
}
57 changes: 0 additions & 57 deletions ci/travis/travis.go

This file was deleted.

13 changes: 0 additions & 13 deletions ci/travis/travis_test.go

This file was deleted.

99 changes: 99 additions & 0 deletions deprecated.go
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)
}
Loading