Skip to content

Commit

Permalink
Fix pprof service related flag and config migration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
niklr committed Jul 9, 2021
1 parent ec72821 commit e750a99
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
6 changes: 3 additions & 3 deletions cmd/harmony/config_migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ func init() {
confTree.Set("Pprof.Folder", defaultConfig.Pprof.Folder)
}
if confTree.Get("Pprof.ProfileNames") == nil {
confTree.Set("Pprof.ProfileNames", []string{})
confTree.Set("Pprof.ProfileNames", make([]interface{}, 0))
}
if confTree.Get("Pprof.ProfileIntervals") == nil {
confTree.Set("Pprof.ProfileIntervals", []string{})
confTree.Set("Pprof.ProfileIntervals", make([]interface{}, 0))
}
if confTree.Get("Pprof.ProfileDebugValues") == nil {
confTree.Set("Pprof.ProfileDebugValues", []string{})
confTree.Set("Pprof.ProfileDebugValues", make([]interface{}, 0))
}

confTree.Set("Version", "2.2.0")
Expand Down
10 changes: 6 additions & 4 deletions cmd/harmony/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ var defaultConfig = harmonyconfig.HarmonyConfig{
},
Sync: getDefaultSyncConfig(defNetworkType),
Pprof: harmonyconfig.PprofConfig{
Enabled: false,
ListenAddr: "127.0.0.1:6060",
Folder: "./profiles",
ProfileNames: []string{},
Enabled: false,
ListenAddr: "127.0.0.1:6060",
Folder: "./profiles",
ProfileNames: []string{},
ProfileIntervals: []int{},
ProfileDebugValues: []int{},
},
Log: harmonyconfig.LogConfig{
Folder: "./latest",
Expand Down
10 changes: 6 additions & 4 deletions cmd/harmony/flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,12 @@ func TestHarmonyFlags(t *testing.T) {
BlacklistFile: "./.hmy/blacklist.txt",
},
Pprof: harmonyconfig.PprofConfig{
Enabled: false,
ListenAddr: "127.0.0.1:6060",
Folder: "./profiles",
ProfileNames: []string{},
Enabled: false,
ListenAddr: "127.0.0.1:6060",
Folder: "./profiles",
ProfileNames: []string{},
ProfileIntervals: []int{},
ProfileDebugValues: []int{},
},
Log: harmonyconfig.LogConfig{
Folder: "./latest",
Expand Down
4 changes: 2 additions & 2 deletions internal/configs/harmony/harmony.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ type PprofConfig struct {
ListenAddr string
Folder string
ProfileNames []string
ProfileIntervals []int `toml:",omitempty"`
ProfileDebugValues []int `toml:",omitempty"`
ProfileIntervals []int
ProfileDebugValues []int
}

type LogConfig struct {
Expand Down

0 comments on commit e750a99

Please sign in to comment.