This repository has been archived by the owner on Jan 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #313 from justinsb/always_renew_certificates
Always renew certificates
- Loading branch information
Showing
5 changed files
with
105 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package pki | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
) | ||
|
||
func TestParseHumanDuration(t *testing.T) { | ||
grid := []struct { | ||
Value string | ||
Expected time.Duration | ||
}{ | ||
{"10m", 10 * time.Minute}, | ||
{"24h", 24 * time.Hour}, | ||
{"1d", 24 * time.Hour}, | ||
{"10d", 10 * 24 * time.Hour}, | ||
{"365d", 365 * 24 * time.Hour}, | ||
{"1y", 365 * 24 * time.Hour}, | ||
{"10y", 10 * 365 * 24 * time.Hour}, | ||
} | ||
|
||
for _, g := range grid { | ||
g := g | ||
t.Run(g.Value, func(t *testing.T) { | ||
actual, err := ParseHumanDuration(g.Value) | ||
if err != nil { | ||
t.Fatalf("unexpected error: %v", err) | ||
} | ||
if actual != g.Expected { | ||
t.Fatalf("unexpected value; expected=%v, actual=%v", g.Expected, actual) | ||
} | ||
}) | ||
} | ||
} |
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