Fix some tests

This commit is contained in:
Jeff Mitchell 2018-04-10 00:22:23 -04:00
parent 16f6dd1ae1
commit f4879cbe88
3 changed files with 15 additions and 5 deletions

View file

@ -511,7 +511,7 @@ func TestSysRemount(t *testing.T) {
}
if !reflect.DeepEqual(actual, expected) {
t.Fatalf("bad: %#v", actual)
t.Fatalf("bad:\ngot\n%#v\nexpected\n%#v\n", actual, expected)
}
}
@ -734,10 +734,12 @@ func TestSysTuneMount_Options(t *testing.T) {
"default_lease_ttl": json.Number("2764800"),
"max_lease_ttl": json.Number("2764800"),
"force_no_cache": false,
"options": map[string]interface{}{"test": "true"},
},
"default_lease_ttl": json.Number("2764800"),
"max_lease_ttl": json.Number("2764800"),
"force_no_cache": false,
"options": map[string]interface{}{"test": "true"},
}
testResponseBody(t, resp, &actual)
expected["request_id"] = actual["request_id"]

View file

@ -572,7 +572,7 @@ ssl_storage_port: 7001
#
# Setting listen_address to 0.0.0.0 is always wrong.
#
listen_address: 172.17.0.2
listen_address: 172.17.0.5
# Set listen_address OR listen_interface, not both. Interfaces must correspond
# to a single address, IP aliasing is not supported.

View file

@ -1646,7 +1646,8 @@ func (b *SystemBackend) handleMount(ctx context.Context, req *logical.Request, d
}
switch logicalType {
case "kv", "kv-v1":
case "kv":
case "kv-v1":
// Alias KV v1
logicalType = "kv"
if options == nil {
@ -2117,9 +2118,10 @@ func (b *SystemBackend) handleTuneWriteCommon(ctx context.Context, path string,
b.Core.logger.Info("mount tuning of options", "path", path, "options", options)
var changed bool
var numBuiltIn int
if v, ok := options["version"]; ok {
changed = true
numBuiltIn++
// Special case to make sure we can not disable versioning once it's
// enabeled. If the vkv backend suports downgrading this can be removed.
meVersion, err := parseutil.ParseInt(mountEntry.Options["version"])
@ -2137,7 +2139,13 @@ func (b *SystemBackend) handleTuneWriteCommon(ctx context.Context, path string,
resp = &logical.Response{}
resp.AddWarning(fmt.Sprintf("Upgrading mount from version %d to version %d. This mount will be unavailable for a brief period and will resume service shortly.", meVersion, optVersion))
}
}
if options != nil {
// For anything we don't recognize and provide special handling,
// always write
if len(options) > numBuiltIn {
changed = true
}
}
if changed {