Skip to content

Commit

Permalink
Move Shared/Testutil into Testing (prysmaticlabs#9659)
Browse files Browse the repository at this point in the history
* move testutil

* util pkg

* build

* gaz

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
  • Loading branch information
rauljordan and prylabs-bulldozer[bot] authored Sep 23, 2021
1 parent 2952bb3 commit a9a4bb9
Show file tree
Hide file tree
Showing 654 changed files with 2,950 additions and 2,950 deletions.
4 changes: 2 additions & 2 deletions api/gateway/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ go_test(
deps = [
"//api/grpc:go_default_library",
"//cmd/beacon-chain/flags:go_default_library",
"//shared/testutil/assert:go_default_library",
"//shared/testutil/require:go_default_library",
"//testing/assert:go_default_library",
"//testing/require:go_default_library",
"@com_github_gorilla_mux//:go_default_library",
"@com_github_sirupsen_logrus//hooks/test:go_default_library",
"@com_github_urfave_cli_v2//:go_default_library",
Expand Down
4 changes: 2 additions & 2 deletions api/gateway/api_middleware_processing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"testing"

"github.com/prysmaticlabs/prysm/api/grpc"
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
"github.com/prysmaticlabs/prysm/testing/assert"
"github.com/prysmaticlabs/prysm/testing/require"
"github.com/sirupsen/logrus/hooks/test"
)

Expand Down
4 changes: 2 additions & 2 deletions api/gateway/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (

"github.com/gorilla/mux"
"github.com/prysmaticlabs/prysm/cmd/beacon-chain/flags"
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
"github.com/prysmaticlabs/prysm/testing/assert"
"github.com/prysmaticlabs/prysm/testing/require"
logTest "github.com/sirupsen/logrus/hooks/test"
"github.com/urfave/cli/v2"
)
Expand Down
4 changes: 2 additions & 2 deletions api/gateway/param_handling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"testing"

"github.com/gorilla/mux"
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
"github.com/prysmaticlabs/prysm/testing/assert"
"github.com/prysmaticlabs/prysm/testing/require"
)

func TestHandleURLParameters(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions api/grpc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ go_test(
srcs = ["grpcutils_test.go"],
embed = [":go_default_library"],
deps = [
"//shared/testutil/assert:go_default_library",
"//shared/testutil/require:go_default_library",
"//testing/assert:go_default_library",
"//testing/require:go_default_library",
"@com_github_grpc_ecosystem_grpc_gateway_v2//runtime:go_default_library",
"@com_github_sirupsen_logrus//hooks/test:go_default_library",
"@org_golang_google_grpc//:go_default_library",
Expand Down
4 changes: 2 additions & 2 deletions api/grpc/grpcutils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"testing"

"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
"github.com/prysmaticlabs/prysm/testing/assert"
"github.com/prysmaticlabs/prysm/testing/require"
logTest "github.com/sirupsen/logrus/hooks/test"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
Expand Down
4 changes: 2 additions & 2 deletions api/pagination/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ go_test(
srcs = ["pagination_test.go"],
deps = [
":go_default_library",
"//shared/testutil/assert:go_default_library",
"//shared/testutil/require:go_default_library",
"//testing/assert:go_default_library",
"//testing/require:go_default_library",
],
)
4 changes: 2 additions & 2 deletions api/pagination/pagination_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"testing"

"github.com/prysmaticlabs/prysm/api/pagination"
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
"github.com/prysmaticlabs/prysm/testing/assert"
"github.com/prysmaticlabs/prysm/testing/require"
)

func TestStartAndEndPage(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions async/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ go_test(
],
embed = [":go_default_library"],
deps = [
"//shared/testutil:go_default_library",
"//shared/testutil/assert:go_default_library",
"//shared/testutil/require:go_default_library",
"//testing/assert:go_default_library",
"//testing/require:go_default_library",
"//testing/util:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@com_github_stretchr_testify//assert:go_default_library",
],
Expand Down
2 changes: 1 addition & 1 deletion async/benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"

"github.com/prysmaticlabs/prysm/async"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
"github.com/prysmaticlabs/prysm/testing/require"
log "github.com/sirupsen/logrus"
)

Expand Down
10 changes: 5 additions & 5 deletions async/debounce_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"time"

"github.com/prysmaticlabs/prysm/async"
"github.com/prysmaticlabs/prysm/shared/testutil"
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
"github.com/prysmaticlabs/prysm/testing/assert"
"github.com/prysmaticlabs/prysm/testing/require"
"github.com/prysmaticlabs/prysm/testing/util"
)

func TestDebounce_NoEvents(t *testing.T) {
Expand All @@ -30,7 +30,7 @@ func TestDebounce_NoEvents(t *testing.T) {
})
wg.Done()
}()
if testutil.WaitTimeout(wg, interval*2) {
if util.WaitTimeout(wg, interval*2) {
t.Fatalf("Test should have exited by now, timed out")
}
assert.Equal(t, 0, timesHandled, "Wrong number of handled calls")
Expand Down Expand Up @@ -66,7 +66,7 @@ func TestDebounce_CtxClosing(t *testing.T) {
})
wg.Done()
}()
if testutil.WaitTimeout(wg, interval*2) {
if util.WaitTimeout(wg, interval*2) {
t.Fatalf("Test should have exited by now, timed out")
}
assert.Equal(t, 0, timesHandled, "Wrong number of handled calls")
Expand Down
4 changes: 2 additions & 2 deletions async/event/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ go_test(
],
embed = [":go_default_library"],
deps = [
"//shared/testutil/assert:go_default_library",
"//shared/testutil/require:go_default_library",
"//testing/assert:go_default_library",
"//testing/require:go_default_library",
],
)
2 changes: 1 addition & 1 deletion async/event/feed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"testing"
"time"

"github.com/prysmaticlabs/prysm/shared/testutil/assert"
"github.com/prysmaticlabs/prysm/testing/assert"
)

func TestFeedPanics(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion async/event/subscription_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"testing"
"time"

"github.com/prysmaticlabs/prysm/shared/testutil/require"
"github.com/prysmaticlabs/prysm/testing/require"
)

var errInts = errors.New("error in subscribeInts")
Expand Down
4 changes: 2 additions & 2 deletions async/scatter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"testing"

"github.com/prysmaticlabs/prysm/async"
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
"github.com/prysmaticlabs/prysm/testing/assert"
"github.com/prysmaticlabs/prysm/testing/require"
)

func TestDouble(t *testing.T) {
Expand Down
12 changes: 6 additions & 6 deletions beacon-chain/blockchain/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ go_test(
"//encoding/bytesutil:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//proto/prysm/v1alpha1/wrapper:go_default_library",
"//shared/testutil:go_default_library",
"//shared/testutil/assert:go_default_library",
"//shared/testutil/require:go_default_library",
"//testing/assert:go_default_library",
"//testing/require:go_default_library",
"//testing/util:go_default_library",
"@com_github_ethereum_go_ethereum//:go_default_library",
"@com_github_ethereum_go_ethereum//common:go_default_library",
"@com_github_ethereum_go_ethereum//core/types:go_default_library",
Expand Down Expand Up @@ -165,9 +165,9 @@ go_test(
"//encoding/bytesutil:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//proto/prysm/v1alpha1/wrapper:go_default_library",
"//shared/testutil:go_default_library",
"//shared/testutil/assert:go_default_library",
"//shared/testutil/require:go_default_library",
"//testing/assert:go_default_library",
"//testing/require:go_default_library",
"//testing/util:go_default_library",
"@com_github_ethereum_go_ethereum//:go_default_library",
"@com_github_ethereum_go_ethereum//common:go_default_library",
"@com_github_ethereum_go_ethereum//core/types:go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/blockchain/chain_info_norace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/state/stategen"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
"github.com/prysmaticlabs/prysm/testing/require"
)

func TestHeadSlot_DataRace(t *testing.T) {
Expand Down
22 changes: 11 additions & 11 deletions beacon-chain/blockchain/chain_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
"github.com/prysmaticlabs/prysm/encoding/bytesutil"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper"
"github.com/prysmaticlabs/prysm/shared/testutil"
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
"github.com/prysmaticlabs/prysm/testing/assert"
"github.com/prysmaticlabs/prysm/testing/require"
"github.com/prysmaticlabs/prysm/testing/util"
"google.golang.org/protobuf/proto"
)

Expand Down Expand Up @@ -122,7 +122,7 @@ func TestHeadRoot_UseDB(t *testing.T) {
beaconDB := testDB.SetupDB(t)
c := &Service{cfg: &Config{BeaconDB: beaconDB}}
c.head = &head{root: params.BeaconConfig().ZeroHash}
b := testutil.NewBeaconBlock()
b := util.NewBeaconBlock()
br, err := b.Block.HashTreeRoot()
require.NoError(t, err)
require.NoError(t, beaconDB.SaveBlock(context.Background(), wrapper.WrappedPhase0SignedBeaconBlock(b)))
Expand All @@ -134,7 +134,7 @@ func TestHeadRoot_UseDB(t *testing.T) {
}

func TestHeadBlock_CanRetrieve(t *testing.T) {
b := testutil.NewBeaconBlock()
b := util.NewBeaconBlock()
b.Block.Slot = 1
s, err := v1.InitializeFromProto(&ethpb.BeaconState{})
require.NoError(t, err)
Expand Down Expand Up @@ -217,7 +217,7 @@ func TestIsCanonical_Ok(t *testing.T) {
beaconDB := testDB.SetupDB(t)
c := setupBeaconChain(t, beaconDB)

blk := testutil.NewBeaconBlock()
blk := util.NewBeaconBlock()
blk.Block.Slot = 0
root, err := blk.Block.HashTreeRoot()
require.NoError(t, err)
Expand All @@ -233,7 +233,7 @@ func TestIsCanonical_Ok(t *testing.T) {
}

func TestService_HeadValidatorsIndices(t *testing.T) {
s, _ := testutil.DeterministicGenesisState(t, 10)
s, _ := util.DeterministicGenesisState(t, 10)
c := &Service{}

c.head = &head{}
Expand All @@ -248,7 +248,7 @@ func TestService_HeadValidatorsIndices(t *testing.T) {
}

func TestService_HeadSeed(t *testing.T) {
s, _ := testutil.DeterministicGenesisState(t, 1)
s, _ := util.DeterministicGenesisState(t, 1)
c := &Service{}
seed, err := helpers.Seed(s, 0, params.BeaconConfig().DomainBeaconAttester)
require.NoError(t, err)
Expand All @@ -265,7 +265,7 @@ func TestService_HeadSeed(t *testing.T) {
}

func TestService_HeadGenesisValidatorRoot(t *testing.T) {
s, _ := testutil.DeterministicGenesisState(t, 1)
s, _ := util.DeterministicGenesisState(t, 1)
c := &Service{}

c.head = &head{}
Expand Down Expand Up @@ -298,7 +298,7 @@ func TestService_ChainHeads(t *testing.T) {
}

func TestService_HeadPublicKeyToValidatorIndex(t *testing.T) {
s, _ := testutil.DeterministicGenesisState(t, 10)
s, _ := util.DeterministicGenesisState(t, 10)
c := &Service{}
c.head = &head{state: s}

Expand All @@ -314,7 +314,7 @@ func TestService_HeadPublicKeyToValidatorIndex(t *testing.T) {
}

func TestService_HeadValidatorIndexToPublicKey(t *testing.T) {
s, _ := testutil.DeterministicGenesisState(t, 10)
s, _ := util.DeterministicGenesisState(t, 10)
c := &Service{}
c.head = &head{state: s}

Expand Down
20 changes: 10 additions & 10 deletions beacon-chain/blockchain/head_sync_committee_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
dbtest "github.com/prysmaticlabs/prysm/beacon-chain/db/testing"
"github.com/prysmaticlabs/prysm/beacon-chain/state/stategen"
"github.com/prysmaticlabs/prysm/config/params"
"github.com/prysmaticlabs/prysm/shared/testutil"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
"github.com/prysmaticlabs/prysm/testing/require"
"github.com/prysmaticlabs/prysm/testing/util"
)

func TestService_headSyncCommitteeFetcher_Errors(t *testing.T) {
Expand Down Expand Up @@ -52,7 +52,7 @@ func TestService_HeadDomainFetcher_Errors(t *testing.T) {
}

func TestService_HeadSyncCommitteeIndices(t *testing.T) {
s, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize)
s, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize)
c := &Service{}
c.head = &head{state: s}

Expand All @@ -75,7 +75,7 @@ func TestService_HeadSyncCommitteeIndices(t *testing.T) {
}

func TestService_headCurrentSyncCommitteeIndices(t *testing.T) {
s, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize)
s, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize)
c := &Service{}
c.head = &head{state: s}

Expand All @@ -89,7 +89,7 @@ func TestService_headCurrentSyncCommitteeIndices(t *testing.T) {
}

func TestService_headNextSyncCommitteeIndices(t *testing.T) {
s, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize)
s, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize)
c := &Service{}
c.head = &head{state: s}

Expand All @@ -103,7 +103,7 @@ func TestService_headNextSyncCommitteeIndices(t *testing.T) {
}

func TestService_HeadSyncCommitteePubKeys(t *testing.T) {
s, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize)
s, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize)
c := &Service{}
c.head = &head{state: s}

Expand All @@ -118,7 +118,7 @@ func TestService_HeadSyncCommitteePubKeys(t *testing.T) {
}

func TestService_HeadSyncCommitteeDomain(t *testing.T) {
s, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize)
s, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize)
c := &Service{}
c.head = &head{state: s}

Expand All @@ -132,7 +132,7 @@ func TestService_HeadSyncCommitteeDomain(t *testing.T) {
}

func TestService_HeadSyncContributionProofDomain(t *testing.T) {
s, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize)
s, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize)
c := &Service{}
c.head = &head{state: s}

Expand All @@ -146,7 +146,7 @@ func TestService_HeadSyncContributionProofDomain(t *testing.T) {
}

func TestService_HeadSyncSelectionProofDomain(t *testing.T) {
s, _ := testutil.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize)
s, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().TargetCommitteeSize)
c := &Service{}
c.head = &head{state: s}

Expand All @@ -164,7 +164,7 @@ func TestSyncCommitteeHeadStateCache_RoundTrip(t *testing.T) {
t.Cleanup(func() {
syncCommitteeHeadStateCache = cache.NewSyncCommitteeHeadState()
})
beaconState, _ := testutil.DeterministicGenesisStateAltair(t, 100)
beaconState, _ := util.DeterministicGenesisStateAltair(t, 100)
require.NoError(t, beaconState.SetSlot(100))
cachedState, err := c.Get(101)
require.ErrorContains(t, cache.ErrNotFound.Error(), err)
Expand Down
Loading

0 comments on commit a9a4bb9

Please sign in to comment.