Skip to content

Commit 409ad90

Browse files
adds config.json for C-Chain during antithesis - json logs (#3968)
1 parent 6cdbc54 commit 409ad90

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

tests/antithesis/compose.go

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ func initComposeConfig(
9696
targetPath string,
9797
) error {
9898
// Generate a compose project for the specified network
99-
project := newComposeProject(network, nodeImageName, workloadImageName)
99+
project, err := newComposeProject(network, nodeImageName, workloadImageName)
100+
if err != nil {
101+
return err
102+
}
100103

101104
absPath, err := filepath.Abs(targetPath)
102105
if err != nil {
@@ -131,7 +134,7 @@ func initComposeConfig(
131134

132135
// Create a new docker compose project for an antithesis test setup
133136
// for the provided network configuration.
134-
func newComposeProject(network *tmpnet.Network, nodeImageName string, workloadImageName string) *types.Project {
137+
func newComposeProject(network *tmpnet.Network, nodeImageName string, workloadImageName string) (*types.Project, error) {
135138
networkName := "avalanche-testnet"
136139
baseNetworkAddress := "10.0.20"
137140

@@ -141,6 +144,20 @@ func newComposeProject(network *tmpnet.Network, nodeImageName string, workloadIm
141144
bootstrapIP string
142145
bootstrapIDs string
143146
)
147+
148+
if network.PrimaryChainConfigs == nil {
149+
network.PrimaryChainConfigs = make(map[string]tmpnet.ConfigMap)
150+
}
151+
if network.PrimaryChainConfigs["C"] == nil {
152+
network.PrimaryChainConfigs["C"] = make(tmpnet.ConfigMap)
153+
}
154+
network.PrimaryChainConfigs["C"]["log-json-format"] = true
155+
156+
chainConfigContent, err := network.GetChainConfigContent()
157+
if err != nil {
158+
return nil, fmt.Errorf("failed to get chain config content: %w", err)
159+
}
160+
144161
for i, node := range network.Nodes {
145162
address := fmt.Sprintf("%s.%d", baseNetworkAddress, 3+i)
146163

@@ -158,6 +175,7 @@ func newComposeProject(network *tmpnet.Network, nodeImageName string, workloadIm
158175
config.StakingTLSKeyContentKey: tlsKey,
159176
config.StakingCertContentKey: tlsCert,
160177
config.StakingSignerKeyContentKey: signerKey,
178+
config.ChainConfigContentKey: chainConfigContent,
161179
}
162180

163181
// Apply configuration appropriate to a test network
@@ -259,7 +277,7 @@ func newComposeProject(network *tmpnet.Network, nodeImageName string, workloadIm
259277
},
260278
},
261279
Services: services,
262-
}
280+
}, nil
263281
}
264282

265283
// Convert a mapping of avalanche config keys to a mapping of env vars

0 commit comments

Comments
 (0)