@@ -21,6 +21,7 @@ import (
2121 "github.com/cosmos/cosmos-sdk/x/auth"
2222 "github.com/cosmos/cosmos-sdk/x/bank"
2323 banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
24+ dockerclient "github.com/moby/moby/client"
2425 "github.com/stretchr/testify/suite"
2526 "go.uber.org/zap/zaptest"
2627)
@@ -46,10 +47,12 @@ func TestDockerSuite(t *testing.T) {
4647
4748type DockerTestSuite struct {
4849 suite.Suite
49- provider tastoratypes.Provider
50- celestia tastoratypes.Chain
51- daNetwork tastoratypes.DataAvailabilityNetwork
52- rollkitChain tastoratypes.RollkitChain
50+ provider tastoratypes.Provider
51+ celestia tastoratypes.Chain
52+ daNetwork tastoratypes.DataAvailabilityNetwork
53+ rollkitChain tastoratypes.RollkitChain
54+ dockerClient * dockerclient.Client
55+ dockerNetworkID string
5356}
5457
5558// ConfigOption is a function type for modifying tastoradocker.Config
@@ -62,28 +65,24 @@ func (s *DockerTestSuite) CreateDockerProvider(opts ...ConfigOption) tastoratype
6265 numValidators := 1
6366 numFullNodes := 0
6467 client , network := tastoradocker .DockerSetup (t )
68+
69+ // Store client and network ID in the suite for later use
70+ s .dockerClient = client
71+ s .dockerNetworkID = network
6572
6673 cfg := tastoradocker.Config {
6774 Logger : zaptest .NewLogger (t ),
6875 DockerClient : client ,
6976 DockerNetworkID : network ,
7077 ChainConfig : & tastoradocker.ChainConfig {
71- ConfigFileOverrides : map [string ]any {
72- "config/app.toml" : appOverrides (),
73- "config/config.toml" : configOverrides (),
74- },
75- Type : "celestia" ,
7678 Name : "celestia" ,
77- Version : "v4.0.0-rc6" ,
7879 NumValidators : & numValidators ,
7980 NumFullNodes : & numFullNodes ,
8081 ChainID : testChainID ,
81- Images : []tastoradocker.DockerImage {
82- {
83- Repository : "ghcr.io/celestiaorg/celestia-app" ,
84- Version : "v4.0.0-rc6" ,
85- UIDGID : "10001:10001" ,
86- },
82+ Image : tastoradocker.DockerImage {
83+ Repository : "ghcr.io/celestiaorg/celestia-app" ,
84+ Version : "v4.0.0-rc6" ,
85+ UIDGID : "10001:10001" ,
8786 },
8887 Bin : "celestia-appd" ,
8988 Bech32Prefix : "celestia" ,
@@ -149,13 +148,44 @@ func (s *DockerTestSuite) SetupDockerResources(opts ...ConfigOption) {
149148 s .rollkitChain = s .CreateRollkitChain ()
150149}
151150
152- // CreateChain creates a chain using the provider .
151+ // CreateChain creates a chain using the ChainBuilder pattern .
153152func (s * DockerTestSuite ) CreateChain () tastoratypes.Chain {
154153 ctx := context .Background ()
154+ t := s .T ()
155+ encConfig := testutil .MakeTestEncodingConfig (auth.AppModuleBasic {}, bank.AppModuleBasic {})
155156
156- chain , err := s .provider .GetChain (ctx )
157- s .Require ().NoError (err )
157+ // Create chain using ChainBuilder pattern
158+ chain , err := tastoradocker .NewChainBuilder (t ).
159+ WithName ("celestia" ).
160+ WithChainID (testChainID ).
161+ WithBinaryName ("celestia-appd" ).
162+ WithBech32Prefix ("celestia" ).
163+ WithDenom ("utia" ).
164+ WithCoinType ("118" ).
165+ WithGasPrices ("0.025utia" ).
166+ WithGasAdjustment (1.3 ).
167+ WithEncodingConfig (& encConfig ).
168+ WithImage (tastoradocker.DockerImage {
169+ Repository : "ghcr.io/celestiaorg/celestia-app" ,
170+ Version : "v4.0.0-rc6" ,
171+ UIDGID : "10001:10001" ,
172+ }).
173+ WithAdditionalStartArgs (
174+ "--force-no-bbr" ,
175+ "--grpc.enable" ,
176+ "--grpc.address" ,
177+ "0.0.0.0:9090" ,
178+ "--rpc.grpc_laddr=tcp://0.0.0.0:9098" ,
179+ "--timeout-commit" , "1s" ,
180+ ).
181+ WithDockerClient (s .dockerClient ).
182+ WithDockerNetworkID (s .dockerNetworkID ).
183+ WithNode (tastoradocker .NewChainNodeConfigBuilder ().
184+ WithNodeType (tastoradocker .ValidatorNodeType ).
185+ Build ()).
186+ Build (ctx )
158187
188+ s .Require ().NoError (err )
159189 return chain
160190}
161191
0 commit comments