github.com/koko1123/flow-go-1@v0.29.6/tools/test_monitor/common/config.go (about) 1 package common 2 3 import ( 4 "encoding/json" 5 "os" 6 "path/filepath" 7 ) 8 9 type Config struct { 10 FailureThresholdPercent float64 `json:"failures_threshold_percent"` 11 FailuresSliceMax int `json:"failures_slice_max"` 12 13 DurationThresholdSeconds float64 `json:"duration_threshold_seconds"` 14 DurationSliceMax int `json:"duration_slice_max"` 15 } 16 17 func ReadProperties(directory string) Config { 18 propertyFile := filepath.Join(directory, "flaky-test-monitor.json") 19 20 var config Config 21 configBytes, err := os.ReadFile(propertyFile) 22 AssertNoError(err, "error reading property file") 23 err = json.Unmarshal(configBytes, &config) 24 AssertNoError(err, "error unmarshalling property file") 25 26 return config 27 }