forked from influxdata/influxdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow configuration of retention policy in toml
retention-policy = "168h" shard-duration = "24h" Fixes influxdata#2676
- Loading branch information
Showing
6 changed files
with
88 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package tsdb | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
|
||
"github.com/BurntSushi/toml" | ||
) | ||
|
||
func TestConfig_Parse(t *testing.T) { | ||
// Parse configuration. | ||
var c Config | ||
if _, err := toml.Decode(` | ||
dir = "/tmp/foo" | ||
retention-auto-create = true | ||
retention-check-enabled = true | ||
retention-check-period = "45m" | ||
retention-create-period = "10m" | ||
`, &c); err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
// Validate configuration. | ||
if c.Dir != "/tmp/foo" { | ||
t.Fatalf("unexpected dir: %s", c.Dir) | ||
} else if c.RetentionAutoCreate != true { | ||
t.Fatalf("unexpected retention auto create: %v", c.RetentionAutoCreate) | ||
} else if c.RetentionCheckEnabled != true { | ||
t.Fatalf("unexpected retention check enabled: %v", c.RetentionCheckEnabled) | ||
} else if time.Duration(c.RetentionCheckPeriod) != 45*time.Minute { | ||
t.Fatalf("unexpected retention check period: %v", c.RetentionCheckPeriod) | ||
} | ||
} |