Skip to content

Commit

Permalink
Merge branch 'main' into fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
felipemadero committed Oct 12, 2024
2 parents 4c23cb1 + 8bbfc66 commit 5a3a4e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 36 deletions.
2 changes: 2 additions & 0 deletions local/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -1263,9 +1263,11 @@ func (ln *localNetwork) buildArgs(
config.HTTPPortKey: fmt.Sprintf("%d", apiPort),
config.StakingPortKey: fmt.Sprintf("%d", p2pPort),
}
// avoid setting db dir flag if the value is the default avalanchego value
if dbDir != filepath.Join(dataDir, defaultDBSubdir) {
flags[config.DBPathKey] = dbDir
}
// avoid setting log dir flag if the value is the default avalanchego value
if logsDir != filepath.Join(dataDir, defaultLogsSubdir) {
flags[config.LogsDirKey] = logsDir
}
Expand Down
40 changes: 4 additions & 36 deletions local/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,30 +419,6 @@ func TestWrongNetworkConfigs(t *testing.T) {
},
},
},
"StakingKey but no StakingCert": {
config: network.Config{
Genesis: "{\"networkID\": 0}",
NodeConfigs: []node.Config{
{
BinaryPath: "pepe",
IsBeacon: true,
StakingKey: refNetworkConfig.NodeConfigs[0].StakingKey,
},
},
},
},
"StakingCert but no StakingKey": {
config: network.Config{
Genesis: "{\"networkID\": 0}",
NodeConfigs: []node.Config{
{
BinaryPath: "pepe",
IsBeacon: true,
StakingCert: refNetworkConfig.NodeConfigs[0].StakingCert,
},
},
},
},
"invalid staking cert/key": {
config: network.Config{
Genesis: "{\"networkID\": 0}",
Expand Down Expand Up @@ -1292,9 +1268,7 @@ func TestWriteFiles(t *testing.T) {
stakingKeyPath := filepath.Join(tmpDir, "staking", stakingKeyFileName)
stakingCertPath := filepath.Join(tmpDir, "staking", stakingCertFileName)
genesisPath := filepath.Join(tmpDir, "configs", genesisFileName)
chainConfigDir := filepath.Join(tmpDir, chainConfigSubDir)
subnetConfigDir := filepath.Join(tmpDir, subnetConfigSubDir)
cChainConfigPath := filepath.Join(tmpDir, chainConfigSubDir, "C", configFileName)
cChainConfigPath := filepath.Join(tmpDir, "configs", "chains", "C", configFileName)

type test struct {
name string
Expand All @@ -1314,9 +1288,7 @@ func TestWriteFiles(t *testing.T) {
StakingCert: stakingCert,
},
expectedFlags: map[string]string{
config.GenesisFileKey: genesisPath,
config.ChainConfigDirKey: chainConfigDir,
config.SubnetConfigDirKey: subnetConfigDir,
config.GenesisFileKey: genesisPath,
},
},
{
Expand All @@ -1329,9 +1301,7 @@ func TestWriteFiles(t *testing.T) {
ConfigFile: configFile,
},
expectedFlags: map[string]string{
config.GenesisFileKey: genesisPath,
config.ChainConfigDirKey: chainConfigDir,
config.SubnetConfigDirKey: subnetConfigDir,
config.GenesisFileKey: genesisPath,
},
},
{
Expand All @@ -1345,9 +1315,7 @@ func TestWriteFiles(t *testing.T) {
ChainConfigFiles: chainConfigFiles,
},
expectedFlags: map[string]string{
config.GenesisFileKey: genesisPath,
config.ChainConfigDirKey: chainConfigDir,
config.SubnetConfigDirKey: subnetConfigDir,
config.GenesisFileKey: genesisPath,
},
},
}
Expand Down

0 comments on commit 5a3a4e5

Please sign in to comment.