Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to latest ibctest #912

Merged
merged 3 commits into from
Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 1 addition & 2 deletions ibctest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/cosmos/relayer/v2 v2.0.0
github.com/docker/docker v20.10.17+incompatible
github.com/moby/moby v20.10.17+incompatible
github.com/strangelove-ventures/ibctest v0.0.0-20220722174333-fef71f837b13
github.com/strangelove-ventures/ibctest v0.0.0-20220808143238-7112edfee8f9
github.com/stretchr/testify v1.8.0
go.uber.org/zap v1.21.0
)
Expand All @@ -27,7 +27,6 @@ require (
github.com/btcsuite/btcd v0.22.1 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce // indirect
github.com/cespare/permute/v2 v2.0.0-beta2 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/confio/ics23/go v0.7.0 // indirect
Expand Down
6 changes: 2 additions & 4 deletions ibctest/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,6 @@ github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInq
github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s=
github.com/cespare/permute/v2 v2.0.0-beta2 h1:iiJWgDsInCbnwfDZiLJX7cVlJevgIM1pUiArcUylUMc=
github.com/cespare/permute/v2 v2.0.0-beta2/go.mod h1:7e2Tqe0fjn1T4rTjDLJjQ+kNtt+UW4B9lg10asqWw0A=
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
Expand Down Expand Up @@ -1299,8 +1297,8 @@ github.com/spf13/viper v1.12.0 h1:CZ7eSOd3kZoaYDLbXnmzgQI5RlciuXBMA+18HwHRfZQ=
github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI=
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q=
github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8=
github.com/strangelove-ventures/ibctest v0.0.0-20220722174333-fef71f837b13 h1:N0yc7mtEkibAnHusTLMH5oCJhYsRwgzxSpqUdxVkC8o=
github.com/strangelove-ventures/ibctest v0.0.0-20220722174333-fef71f837b13/go.mod h1:aWBeEKU4lGfvJ9qO543zJbQGtB2fK2ffrJh6jbtowEM=
github.com/strangelove-ventures/ibctest v0.0.0-20220808143238-7112edfee8f9 h1:UBuFEvsv7Dp8Kl3IWqsGAHWF+XOZ/oPGpXxDDAx/pzA=
github.com/strangelove-ventures/ibctest v0.0.0-20220808143238-7112edfee8f9/go.mod h1:aWBeEKU4lGfvJ9qO543zJbQGtB2fK2ffrJh6jbtowEM=
github.com/strangelove-ventures/lens v0.5.2-0.20220725181212-615bf7a39fe6 h1:zqc+cBHJn1YD/G0MK40jYnQJi6qWzJgNVjVcTeb8WjQ=
github.com/strangelove-ventures/lens v0.5.2-0.20220725181212-615bf7a39fe6/go.mod h1:nJkqTtTKgLUM4nEUJKABNVLzQ+y9u6XhDYMHNn93HjQ=
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
Expand Down
20 changes: 2 additions & 18 deletions ibctest/ibc_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package ibctest_test

import (
"io"
"testing"

relayeribctest "github.com/cosmos/relayer/v2/ibctest"
Expand Down Expand Up @@ -29,15 +28,14 @@ func ibctestConformance(t *testing.T, rf ibctest.RelayerFactory) {
t,
[]ibctest.ChainFactory{cf},
[]ibctest.RelayerFactory{rf},
// The nop write closer means no test report will be generated,
// which is fine for these tests for now.
testreporter.NewReporter(newNopWriteCloser()),
testreporter.NewNopReporter(),
)
}

// TestRelayerInProcess runs the ibctest conformance tests against
// the current state of this relayer implementation running in process.
func TestRelayerInProcess(t *testing.T) {
t.Parallel()
ibctestConformance(t, relayeribctest.RelayerFactory{})
}

Expand Down Expand Up @@ -76,17 +74,3 @@ func TestRelayerDockerLegacyProcessor(t *testing.T) {

ibctestConformance(t, rf)
}

// nopWriteCloser is a no-op io.WriteCloser used to satisfy the ibctest TestReporter type.
// Because the relayer is used in-process, all logs are simply streamed to the test log.
type nopWriteCloser struct {
io.Writer
}

func (nopWriteCloser) Close() error {
return nil
}

func newNopWriteCloser() io.WriteCloser {
return nopWriteCloser{Writer: io.Discard}
}
19 changes: 19 additions & 0 deletions ibctest/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,25 @@ func (r *Relayer) start(ctx context.Context, pathName string) {

func (r *Relayer) UseDockerNetwork() bool { return false }

func (r *Relayer) Exec(ctx context.Context, _ ibc.RelayerExecReporter, cmd, env []string) ibc.RelayerExecResult {
// TODO: env would be ignored for now.
// We may want to modify the call to sys() to accept environment overrides,
// so this relayer can continue to be used in parallel without environment cross-contamination.
res := r.sys().RunC(ctx, r.log(), cmd...)

exitCode := 0
if res.Err != nil {
exitCode = 1
}

return ibc.RelayerExecResult{
Err: res.Err,
ExitCode: exitCode,
Stdout: res.Stdout.Bytes(),
Stderr: res.Stderr.Bytes(),
}
}

func (r *Relayer) FlushAcknowledgements(ctx context.Context, _ ibc.RelayerExecReporter, pathName string, channelID string) error {
res := r.sys().RunC(ctx, r.log(), "tx", "relay-acks", pathName, channelID)
if res.Err != nil {
Expand Down