From 2933c5ce08b1ce3a73fad174ebdfa5fc61fe3d97 Mon Sep 17 00:00:00 2001 From: vishalnayak Date: Mon, 20 Jun 2016 20:08:12 -0400 Subject: [PATCH] Made default_lease_ttl and max_lease_ttl as int64 and fixed tests --- vault/logical_system.go | 8 ++++---- vault/logical_system_test.go | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/vault/logical_system.go b/vault/logical_system.go index 85de2ad84..1263d2c2d 100644 --- a/vault/logical_system.go +++ b/vault/logical_system.go @@ -661,8 +661,8 @@ func (b *SystemBackend) handleMountTable( "type": entry.Type, "description": entry.Description, "config": map[string]interface{}{ - "default_lease_ttl": int(entry.Config.DefaultLeaseTTL.Seconds()), - "max_lease_ttl": int(entry.Config.MaxLeaseTTL.Seconds()), + "default_lease_ttl": int64(entry.Config.DefaultLeaseTTL.Seconds()), + "max_lease_ttl": int64(entry.Config.MaxLeaseTTL.Seconds()), }, } @@ -1041,8 +1041,8 @@ func (b *SystemBackend) handleAuthTable( "type": entry.Type, "description": entry.Description, "config": map[string]interface{}{ - "default_lease_ttl": int(entry.Config.DefaultLeaseTTL.Seconds()), - "max_lease_ttl": int(entry.Config.MaxLeaseTTL.Seconds()), + "default_lease_ttl": int64(entry.Config.DefaultLeaseTTL.Seconds()), + "max_lease_ttl": int64(entry.Config.MaxLeaseTTL.Seconds()), }, } resp.Data[entry.Path] = info diff --git a/vault/logical_system_test.go b/vault/logical_system_test.go index 64aebd3d8..f354c2d03 100644 --- a/vault/logical_system_test.go +++ b/vault/logical_system_test.go @@ -46,24 +46,24 @@ func TestSystemBackend_mounts(t *testing.T) { "type": "generic", "description": "generic secret storage", "config": map[string]interface{}{ - "default_lease_ttl": resp.Data["secret/"].(map[string]interface{})["config"].(map[string]interface{})["default_lease_ttl"].(int), - "max_lease_ttl": resp.Data["secret/"].(map[string]interface{})["config"].(map[string]interface{})["max_lease_ttl"].(int), + "default_lease_ttl": resp.Data["secret/"].(map[string]interface{})["config"].(map[string]interface{})["default_lease_ttl"].(int64), + "max_lease_ttl": resp.Data["secret/"].(map[string]interface{})["config"].(map[string]interface{})["max_lease_ttl"].(int64), }, }, "sys/": map[string]interface{}{ "type": "system", "description": "system endpoints used for control, policy and debugging", "config": map[string]interface{}{ - "default_lease_ttl": resp.Data["sys/"].(map[string]interface{})["config"].(map[string]interface{})["default_lease_ttl"].(int), - "max_lease_ttl": resp.Data["sys/"].(map[string]interface{})["config"].(map[string]interface{})["max_lease_ttl"].(int), + "default_lease_ttl": resp.Data["sys/"].(map[string]interface{})["config"].(map[string]interface{})["default_lease_ttl"].(int64), + "max_lease_ttl": resp.Data["sys/"].(map[string]interface{})["config"].(map[string]interface{})["max_lease_ttl"].(int64), }, }, "cubbyhole/": map[string]interface{}{ "description": "per-token private secret storage", "type": "cubbyhole", "config": map[string]interface{}{ - "default_lease_ttl": resp.Data["cubbyhole/"].(map[string]interface{})["config"].(map[string]interface{})["default_lease_ttl"].(int), - "max_lease_ttl": resp.Data["cubbyhole/"].(map[string]interface{})["config"].(map[string]interface{})["max_lease_ttl"].(int), + "default_lease_ttl": resp.Data["cubbyhole/"].(map[string]interface{})["config"].(map[string]interface{})["default_lease_ttl"].(int64), + "max_lease_ttl": resp.Data["cubbyhole/"].(map[string]interface{})["config"].(map[string]interface{})["max_lease_ttl"].(int64), }, }, } @@ -529,8 +529,8 @@ func TestSystemBackend_authTable(t *testing.T) { "type": "token", "description": "token based credentials", "config": map[string]interface{}{ - "default_lease_ttl": int(0), - "max_lease_ttl": int(0), + "default_lease_ttl": int64(0), + "max_lease_ttl": int64(0), }, }, }