This commit is contained in:
Chris Capurso 2022-02-14 18:06:02 -05:00 committed by GitHub
parent 88e02feab0
commit dd0a2c15a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 12 deletions

View File

@ -2,10 +2,11 @@ package command
import (
"fmt"
"strings"
"github.com/mitchellh/cli"
"github.com/posener/complete"
"github.com/ryanuber/columnize"
"strings"
)
var (

View File

@ -4278,7 +4278,6 @@ func (b *SystemBackend) handleVersionHistoryList(ctx context.Context, req *logic
}
return logical.ListResponseWithInfo(respKeys, respKeyInfo), nil
}
func sanitizePath(path string) string {

View File

@ -961,4 +961,4 @@ func TestSystemBackend_VersionHistory_authenticated(t *testing.T) {
if keyInfo[version.Version] == nil {
t.Fatalf("expected version %s to be present in key_info, actual: %#v", version.Version, keyInfo)
}
}
}

View File

@ -114,7 +114,6 @@ func (c *Core) loadVersionTimestamps(ctx context.Context) error {
if timestampInstalled.Location() != time.UTC {
timestampInstalled = timestampInstalled.UTC()
isUpdated, err := c.storeVersionTimestamp(ctx, vaultVersion.Version, timestampInstalled, true)
if err != nil {
c.logger.Warn("failed to rewrite vault version timestamp as UTC", "error", err)
}

View File

@ -33,12 +33,15 @@ func TestVersionStore_GetOldestVersion(t *testing.T) {
upgradeTimePlusEpsilon := time.Now().UTC()
// 1.6.2 is stored before 1.6.1, so even though it is a higher number, it should be returned.
versionEntries := []struct{version string; ts time.Time}{
{"1.6.2", upgradeTimePlusEpsilon.Add(-4*time.Hour)},
{"1.6.1", upgradeTimePlusEpsilon.Add(2*time.Hour)},
versionEntries := []struct {
version string
ts time.Time
}{
{"1.6.2", upgradeTimePlusEpsilon.Add(-4 * time.Hour)},
{"1.6.1", upgradeTimePlusEpsilon.Add(2 * time.Hour)},
}
for _, entry := range versionEntries{
for _, entry := range versionEntries {
_, err := c.storeVersionTimestamp(context.Background(), entry.version, entry.ts, false)
if err != nil {
t.Fatalf("failed to write version entry %#v, err: %s", entry, err.Error())
@ -74,12 +77,15 @@ func TestVersionStore_SelfHealUTC(t *testing.T) {
nowEST := time.Now().In(estLoc)
versionEntries := []struct{version string; ts time.Time}{
{"1.9.0", nowEST.Add(24*time.Hour)},
{"1.9.1", nowEST.Add(48*time.Hour)},
versionEntries := []struct {
version string
ts time.Time
}{
{"1.9.0", nowEST.Add(24 * time.Hour)},
{"1.9.1", nowEST.Add(48 * time.Hour)},
}
for _, entry := range versionEntries{
for _, entry := range versionEntries {
_, err := c.storeVersionTimestamp(context.Background(), entry.version, entry.ts, false)
if err != nil {
t.Fatalf("failed to write version entry %#v, err: %s", entry, err.Error())