Skip to content

Commit 8528520

Browse files
committed
fix lints and even better context passing
1 parent 31c3f4f commit 8528520

File tree

11 files changed

+31
-18
lines changed

11 files changed

+31
-18
lines changed

framework/components/blockchain/aptos.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@ func newAptos(ctx context.Context, in *Input) (*Output, error) {
128128
return nil, err
129129
}
130130
cmdStr := []string{"aptos", "init", "--network=local", "--assume-yes", fmt.Sprintf("--private-key=%s", DefaultAptosPrivateKey)}
131-
_, err = dc.ExecContainer(containerName, cmdStr)
131+
_, err = dc.ExecContainerWithContext(ctx, containerName, cmdStr)
132132
if err != nil {
133133
return nil, err
134134
}
135135
fundCmd := []string{"aptos", "account", "fund-with-faucet", "--account", DefaultAptosAccount, "--amount", "1000000000000"}
136-
_, err = dc.ExecContainer(containerName, fundCmd)
136+
_, err = dc.ExecContainerWithContext(ctx, containerName, fundCmd)
137137
if err != nil {
138138
return nil, err
139139
}

framework/components/blockchain/containers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func createGenericEvmContainer(ctx context.Context, in *Input, req testcontainer
7474
return nil, err
7575
}
7676

77-
host, err := framework.GetHost(c)
77+
host, err := framework.GetHostWithContext(ctx, c)
7878
if err != nil {
7979
return nil, err
8080
}

framework/components/blockchain/solana.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func newSolana(ctx context.Context, in *Input) (*Output, error) {
139139
if err != nil {
140140
return nil, err
141141
}
142-
host, err := framework.GetHost(c)
142+
host, err := framework.GetHostWithContext(ctx, c)
143143
if err != nil {
144144
return nil, err
145145
}

framework/components/blockchain/sui.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ func fundAccount(url string, address string) error {
5454
}
5555

5656
// generateKeyData generates a wallet and returns all the data
57-
func generateKeyData(containerName string, keyCipherType string) (*SuiWalletInfo, error) {
57+
func generateKeyData(ctx context.Context, containerName string, keyCipherType string) (*SuiWalletInfo, error) {
5858
cmdStr := []string{"sui", "keytool", "generate", keyCipherType, "--json"}
5959
dc, err := framework.NewDockerClient()
6060
if err != nil {
6161
return nil, err
6262
}
63-
keyOut, err := dc.ExecContainer(containerName, cmdStr)
63+
keyOut, err := dc.ExecContainerWithContext(ctx, containerName, cmdStr)
6464
if err != nil {
6565
return nil, err
6666
}
@@ -166,7 +166,7 @@ func newSui(ctx context.Context, in *Input) (*Output, error) {
166166
if err != nil {
167167
return nil, err
168168
}
169-
suiAccount, err := generateKeyData(containerName, "ed25519")
169+
suiAccount, err := generateKeyData(ctx, containerName, "ed25519")
170170
if err != nil {
171171
return nil, err
172172
}

framework/components/clnode/clnode.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func NewNodeWithDBAndContext(ctx context.Context, in *Input) (*Output, error) {
9797
if in.Out != nil && in.Out.UseCache {
9898
return in.Out, nil
9999
}
100-
pgOut, err := postgres.NewPostgreSQL(in.DbInput)
100+
pgOut, err := postgres.NewWithContext(ctx, in.DbInput)
101101
if err != nil {
102102
return nil, err
103103
}
@@ -365,7 +365,7 @@ func newNode(ctx context.Context, in *Input, pgOut *postgres.Output) (*NodeOut,
365365
if err != nil {
366366
return nil, err
367367
}
368-
host, err := framework.GetHost(c)
368+
host, err := framework.GetHostWithContext(ctx, c)
369369
if err != nil {
370370
return nil, err
371371
}

framework/components/jd/grpc_wait_strategy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func (g *GRPCHealthStrategy) WaitUntilReady(ctx context.Context, target tcwait.S
6464
}
6565

6666
// Get host and port
67-
host, err := framework.GetHost(target.(tc.Container)) //nolint:contextcheck //don't want modify the signature of GetHost() yet
67+
host, err := framework.GetHostWithContext(ctx, target.(tc.Container))
6868
if err != nil {
6969
continue
7070
}

framework/components/jd/jd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func NewWithContext(ctx context.Context, in *Input) (*Output, error) {
8888
in.DBInput = defaultJDDB()
8989
}
9090
in.DBInput.JDSQLDumpPath = in.JDSQLDumpPath
91-
pgOut, err := postgres.NewPostgreSQL(in.DBInput)
91+
pgOut, err := postgres.NewWithContext(ctx, in.DBInput)
9292
if err != nil {
9393
return nil, err
9494
}
@@ -140,7 +140,7 @@ func NewWithContext(ctx context.Context, in *Input) (*Output, error) {
140140
if err != nil {
141141
return nil, err
142142
}
143-
host, err := framework.GetHost(c)
143+
host, err := framework.GetHostWithContext(ctx, c)
144144
if err != nil {
145145
return nil, err
146146
}

framework/components/postgres/postgres.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func NewWithContext(ctx context.Context, in *Input) (*Output, error) {
163163
if err != nil {
164164
return nil, err
165165
}
166-
host, err := framework.GetHost(c)
166+
host, err := framework.GetHostWithContext(ctx, c)
167167
if err != nil {
168168
return nil, err
169169
}

framework/components/s3provider/minio.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ func (mf MinioFactory) run(ctx context.Context, m *Minio) (Provider, error) {
227227
return nil, err
228228
}
229229

230-
m.Host, err = framework.GetHost(c)
230+
m.Host, err = framework.GetHostWithContext(ctx, c)
231231
if err != nil {
232232
return nil, err
233233
}

framework/components/simple_node_set/fund.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func FundNodesWithContext(ctx context.Context, c *ethclient.Client, nodes []*clc
8787
if err != nil {
8888
return err
8989
}
90-
if err := SendETH(c, pkey, ek.Attributes.Address, big.NewFloat(ethAmount)); err != nil {
90+
if err := SendETHWithContext(ctx, c, pkey, ek.Attributes.Address, big.NewFloat(ethAmount)); err != nil {
9191
return er.Wrapf(err, "failed to fund CL node %s", ek.Attributes.Address)
9292
}
9393
}

0 commit comments

Comments
 (0)