Skip to content

Commit

Permalink
refactor(v8): make internal/ public (#1038)
Browse files Browse the repository at this point in the history
* move version out of internal/

* blockdb, dockerutil, mocktesting

* make private methods public for usage
  • Loading branch information
Reecepbcups authored Apr 9, 2024
1 parent 1c05790 commit 99bcbc1
Show file tree
Hide file tree
Showing 85 changed files with 93 additions and 341 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ help: ## Print this help message

.PHONY: interchaintest
interchaintest: gen ## Build interchaintest binary into ./bin
go test -ldflags "-X github.com/strangelove-ventures/interchaintest/v8/internal/version.GitSha=$(shell git describe --always --dirty)" -c -o ./bin/interchaintest ./cmd/interchaintest
go test -ldflags "-X github.com/strangelove-ventures/interchaintest/v8/interchaintest.GitSha=$(shell git describe --always --dirty)" -c -o ./bin/interchaintest ./cmd/interchaintest

.PHONY: test
test: ## Run unit tests
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion internal/blockdb/tui/model.go → blockdb/tui/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/atotto/clipboard"
"github.com/rivo/tview"
"github.com/strangelove-ventures/interchaintest/v8/internal/blockdb"
"github.com/strangelove-ventures/interchaintest/v8/blockdb"
)

//go:generate go run golang.org/x/tools/cmd/stringer -type=mainContent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

"github.com/strangelove-ventures/interchaintest/v8/internal/blockdb"
"github.com/strangelove-ventures/interchaintest/v8/blockdb"
"github.com/stretchr/testify/require"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"strconv"
"strings"

"github.com/strangelove-ventures/interchaintest/v8/internal/blockdb"
"github.com/strangelove-ventures/interchaintest/v8/blockdb"
)

// CosmosMessage presents a blockdb.CosmosMessageResult.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"database/sql"
"testing"

"github.com/strangelove-ventures/interchaintest/v8/internal/blockdb"
"github.com/strangelove-ventures/interchaintest/v8/blockdb"
"github.com/stretchr/testify/require"
)

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package presenter
import (
"strconv"

"github.com/strangelove-ventures/interchaintest/v8/internal/blockdb"
"github.com/strangelove-ventures/interchaintest/v8/blockdb"
)

// TestCase presents a blockdb.TestCaseResult.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

"github.com/strangelove-ventures/interchaintest/v8/internal/blockdb"
"github.com/strangelove-ventures/interchaintest/v8/blockdb"
"github.com/stretchr/testify/require"
)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strconv"
"sync"

"github.com/strangelove-ventures/interchaintest/v8/internal/blockdb"
"github.com/strangelove-ventures/interchaintest/v8/blockdb"
)

var bufPool = sync.Pool{New: func() any { return new(bytes.Buffer) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"testing"

"github.com/strangelove-ventures/interchaintest/v8/internal/blockdb"
"github.com/strangelove-ventures/interchaintest/v8/blockdb"
"github.com/stretchr/testify/require"
)

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion internal/blockdb/tui/update.go → blockdb/tui/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
"github.com/strangelove-ventures/interchaintest/v8/internal/blockdb/tui/presenter"
"github.com/strangelove-ventures/interchaintest/v8/blockdb/tui/presenter"
)

// Update should be the argument for *(tview.Application).SetInputCapture.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
"github.com/strangelove-ventures/interchaintest/v8/internal/blockdb"
"github.com/strangelove-ventures/interchaintest/v8/blockdb"
"github.com/stretchr/testify/require"
)

Expand Down
4 changes: 2 additions & 2 deletions internal/blockdb/tui/views.go → blockdb/tui/views.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (

"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
"github.com/strangelove-ventures/interchaintest/v8/internal/blockdb"
"github.com/strangelove-ventures/interchaintest/v8/internal/blockdb/tui/presenter"
"github.com/strangelove-ventures/interchaintest/v8/blockdb"
"github.com/strangelove-ventures/interchaintest/v8/blockdb/tui/presenter"
)

func headerView(m *Model) *tview.Flex {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion chain/cosmos/broadcaster.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
"github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/testutil"
)

Expand Down
4 changes: 2 additions & 2 deletions chain/cosmos/chain_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

"github.com/strangelove-ventures/interchaintest/v8/blockdb"
"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/strangelove-ventures/interchaintest/v8/internal/blockdb"
"github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/testutil"
)

Expand Down
4 changes: 2 additions & 2 deletions chain/cosmos/cosmos_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ import (
dockertypes "github.com/docker/docker/api/types"
volumetypes "github.com/docker/docker/api/types/volume"
"github.com/docker/docker/client"
"github.com/strangelove-ventures/interchaintest/v8/blockdb"
wasmtypes "github.com/strangelove-ventures/interchaintest/v8/chain/cosmos/08-wasm-types"
"github.com/strangelove-ventures/interchaintest/v8/chain/internal/tendermint"
"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/strangelove-ventures/interchaintest/v8/internal/blockdb"
"github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/testutil"
"go.uber.org/zap"
"golang.org/x/sync/errgroup"
Expand Down
2 changes: 1 addition & 1 deletion chain/cosmos/module_gov.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
paramsutils "github.com/cosmos/cosmos-sdk/x/params/client/utils"
"github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
)

// VoteOnProposal submits a vote for the specified proposal.
Expand Down
2 changes: 1 addition & 1 deletion chain/cosmos/module_vesting.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"path"

vestingcli "github.com/cosmos/cosmos-sdk/x/auth/vesting/client/cli"
"github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
)

// VestingCreateAccount creates a new vesting account funded with an allocation of tokens. The account can either be a delayed or continuous vesting account, which is determined by the '--delayed' flag.
Expand Down
2 changes: 1 addition & 1 deletion chain/cosmos/osmosis.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"path/filepath"
"strings"

"github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
)

// OsmosisPoolParams defines parameters for creating an osmosis gamm liquidity pool
Expand Down
2 changes: 1 addition & 1 deletion chain/cosmos/sidecar.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"github.com/docker/go-connections/nat"
"go.uber.org/zap"

"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil"
)

type SidecarProcesses []*SidecarProcess
Expand Down
2 changes: 1 addition & 1 deletion chain/ethereum/ethererum_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"github.com/docker/docker/api/types/volume"
dockerclient "github.com/docker/docker/client"
"github.com/docker/go-connections/nat"
"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/testutil"
"go.uber.org/zap"
)
Expand Down
2 changes: 1 addition & 1 deletion chain/ethereum/forge.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"path/filepath"

"github.com/docker/docker/api/types/mount"
"github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
)

// cli options for the `forge script` command
Expand Down
2 changes: 1 addition & 1 deletion chain/internal/tendermint/tendermint_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
dockerclient "github.com/docker/docker/client"
"github.com/docker/go-connections/nat"
"github.com/hashicorp/go-version"
"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/testutil"
"go.uber.org/zap"
)
Expand Down
2 changes: 1 addition & 1 deletion chain/penumbra/penumbra_app_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/docker/docker/client"
dockerclient "github.com/docker/docker/client"
"github.com/docker/go-connections/nat"
"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil"
"go.uber.org/zap"
)

Expand Down
2 changes: 1 addition & 1 deletion chain/penumbra/penumbra_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"github.com/strangelove-ventures/interchaintest/v8/chain/internal/tendermint"
"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/testutil"
"go.uber.org/zap"
"golang.org/x/sync/errgroup"
Expand Down
2 changes: 1 addition & 1 deletion chain/penumbra/penumbra_client_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
cryptov1alpha1 "github.com/strangelove-ventures/interchaintest/v8/chain/penumbra/core/crypto/v1alpha1"
custodyv1alpha1 "github.com/strangelove-ventures/interchaintest/v8/chain/penumbra/custody/v1alpha1"
viewv1alpha1 "github.com/strangelove-ventures/interchaintest/v8/chain/penumbra/view/v1alpha1"
"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/testutil"
"go.uber.org/zap"
"google.golang.org/grpc"
Expand Down
2 changes: 1 addition & 1 deletion chain/polkadot/parachain_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (
p2pcrypto "github.com/libp2p/go-libp2p/core/crypto"
"github.com/libp2p/go-libp2p/core/peer"
gsrpc "github.com/misko9/go-substrate-rpc-client/v4"
"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil"
"go.uber.org/zap"
)

Expand Down
4 changes: 2 additions & 2 deletions chain/polkadot/polkadot_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import (
p2pcrypto "github.com/libp2p/go-libp2p/core/crypto"
"github.com/misko9/go-substrate-rpc-client/v4/signature"
gstypes "github.com/misko9/go-substrate-rpc-client/v4/types"
"github.com/strangelove-ventures/interchaintest/v8/blockdb"
"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/strangelove-ventures/interchaintest/v8/internal/blockdb"
"github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil"
"go.uber.org/zap"
"golang.org/x/sync/errgroup"
)
Expand Down
2 changes: 1 addition & 1 deletion chain/polkadot/relay_chain_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"go.uber.org/zap"

"github.com/decred/dcrd/dcrec/secp256k1/v2"
"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil"
)

// RelayChainNode defines the properties required for running a polkadot relay chain node.
Expand Down
2 changes: 1 addition & 1 deletion chainset.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"time"

"github.com/docker/docker/client"
"github.com/strangelove-ventures/interchaintest/v8/blockdb"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/strangelove-ventures/interchaintest/v8/internal/blockdb"
"go.uber.org/multierr"
"go.uber.org/zap"
"golang.org/x/sync/errgroup"
Expand Down
9 changes: 4 additions & 5 deletions cmd/interchaintest/interchaintest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ import (

"github.com/rivo/tview"
interchaintest "github.com/strangelove-ventures/interchaintest/v8"
"github.com/strangelove-ventures/interchaintest/v8/blockdb"
blockdbtui "github.com/strangelove-ventures/interchaintest/v8/blockdb/tui"
"github.com/strangelove-ventures/interchaintest/v8/conformance"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/strangelove-ventures/interchaintest/v8/internal/blockdb"
blockdbtui "github.com/strangelove-ventures/interchaintest/v8/internal/blockdb/tui"
"github.com/strangelove-ventures/interchaintest/v8/internal/version"
"github.com/strangelove-ventures/interchaintest/v8/relayer"
"github.com/strangelove-ventures/interchaintest/v8/testreporter"
"go.uber.org/zap"
Expand Down Expand Up @@ -63,7 +62,7 @@ func TestMain(m *testing.M) {
}
os.Exit(0)
case "version":
fmt.Fprintln(os.Stderr, version.GitSha)
fmt.Fprintln(os.Stderr, interchaintest.GitSha)
os.Exit(0)
}

Expand Down Expand Up @@ -276,7 +275,7 @@ func runDebugTerminalUI(ctx context.Context) error {
}
defer db.Close()

if err = blockdb.Migrate(db, version.GitSha); err != nil {
if err = blockdb.Migrate(db, interchaintest.GitSha); err != nil {
return fmt.Errorf("migrate database %s: %w", dbPath, err)
}

Expand Down
2 changes: 1 addition & 1 deletion conformance/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import (
"github.com/docker/docker/client"
"github.com/strangelove-ventures/interchaintest/v8"
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/relayer"
"github.com/strangelove-ventures/interchaintest/v8/testreporter"
"github.com/strangelove-ventures/interchaintest/v8/testutil"
Expand Down
2 changes: 1 addition & 1 deletion internal/dockerutil/busybox.go → dockerutil/busybox.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var (

const busyboxRef = "busybox:stable"

func ensureBusybox(ctx context.Context, cli *client.Client) error {
func EnsureBusybox(ctx context.Context, cli *client.Client) error {
ensureBusyboxMu.Lock()
defer ensureBusyboxMu.Unlock()

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func NewFileRetriever(log *zap.Logger, cli *client.Client, testName string) *Fil
func (r *FileRetriever) SingleFileContent(ctx context.Context, volumeName, relPath string) ([]byte, error) {
const mountPath = "/mnt/dockervolume"

if err := ensureBusybox(ctx, r.cli); err != nil {
if err := EnsureBusybox(ctx, r.cli); err != nil {
return nil, err
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

volumetypes "github.com/docker/docker/api/types/volume"
interchaintest "github.com/strangelove-ventures/interchaintest/v8"
"github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func NewFileWriter(log *zap.Logger, cli *client.Client, testName string) *FileWr
func (w *FileWriter) WriteFile(ctx context.Context, volumeName, relPath string, content []byte) error {
const mountPath = "/mnt/dockervolume"

if err := ensureBusybox(ctx, w.cli); err != nil {
if err := EnsureBusybox(ctx, w.cli); err != nil {
return err
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

volumetypes "github.com/docker/docker/api/types/volume"
interchaintest "github.com/strangelove-ventures/interchaintest/v8"
"github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
)
Expand Down
Loading

0 comments on commit 99bcbc1

Please sign in to comment.