Merge pull request #1629 from hashicorp/remove-verify-connection

Remove unused VerifyConnection from storage entries of SQL backends
This commit is contained in:
Vishal Nayak 2016-07-19 12:21:23 -04:00 committed by GitHub
commit fbb04349b5
6 changed files with 5 additions and 9 deletions

View File

@ -45,6 +45,7 @@ func TestBackend_config_connection(t *testing.T) {
t.Fatalf("err:%s resp:%#v\n", err, resp)
}
delete(configData, "verify_connection")
if !reflect.DeepEqual(configData, resp.Data) {
t.Fatalf("bad: expected:%#v\nactual:%#v\n", configData, resp.Data)
}

View File

@ -87,7 +87,6 @@ func (b *backend) pathConnectionWrite(req *logical.Request, data *framework.Fiel
entry, err := logical.StorageEntryJSON("config/connection", connectionConfig{
ConnectionString: connString,
MaxOpenConnections: maxOpenConns,
VerifyConnection: verifyConnection,
})
if err != nil {
return nil, err
@ -108,7 +107,6 @@ func (b *backend) pathConnectionWrite(req *logical.Request, data *framework.Fiel
type connectionConfig struct {
ConnectionString string `json:"connection_string" structs:"connection_string" mapstructure:"connection_string"`
MaxOpenConnections int `json:"max_open_connections" structs:"max_open_connections" mapstructure:"max_open_connections"`
VerifyConnection bool `json:"verify_connection" structs:"verify_connection" mapstructure:"verify_connection"`
}
const pathConfigConnectionHelpSyn = `

View File

@ -103,6 +103,7 @@ func TestBackend_config_connection(t *testing.T) {
t.Fatalf("err:%s resp:%#v\n", err, resp)
}
delete(configData, "verify_connection")
if !reflect.DeepEqual(configData, resp.Data) {
t.Fatalf("bad: expected:%#v\nactual:%#v\n", configData, resp.Data)
}

View File

@ -101,7 +101,6 @@ func (b *backend) pathConnectionWrite(
entry, err := logical.StorageEntryJSON("config/connection", connectionConfig{
ConnectionURL: connURL,
MaxOpenConnections: maxOpenConns,
VerifyConnection: verifyConnection,
})
if err != nil {
return nil, err
@ -124,7 +123,6 @@ type connectionConfig struct {
// Deprecate "value" in coming releases
ConnectionString string `json:"value" structs:"value" mapstructure:"value"`
MaxOpenConnections int `json:"max_open_connections" structs:"max_open_connections" mapstructure:"max_open_connections"`
VerifyConnection bool `json:"verify_connection" structs:"verify_connection" mapstructure:"verify_connection"`
}
const pathConfigConnectionHelpSyn = `

View File

@ -5,11 +5,11 @@ import (
"fmt"
"log"
"os"
"path"
"reflect"
"sync"
"testing"
"time"
"path"
"github.com/hashicorp/vault/logical"
logicaltest "github.com/hashicorp/vault/logical/testing"
@ -107,6 +107,7 @@ func TestBackend_config_connection(t *testing.T) {
t.Fatalf("err:%s resp:%#v\n", err, resp)
}
delete(configData, "verify_connection")
if !reflect.DeepEqual(configData, resp.Data) {
t.Fatalf("bad: expected:%#v\nactual:%#v\n", configData, resp.Data)
}
@ -183,7 +184,7 @@ func TestBackend_roleReadOnly(t *testing.T) {
}
logicaltest.Test(t, logicaltest.TestCase{
Backend: b,
Backend: b,
Steps: []logicaltest.TestStep{
testAccStepConfig(t, connData, false),
testAccStepCreateRole(t, "web", testRole),
@ -329,7 +330,6 @@ func testAccStepReadCreds(t *testing.T, b logical.Backend, s logical.Storage, na
}
}
func testAccStepCreateTable(t *testing.T, b logical.Backend, s logical.Storage, name string, connURL string) logicaltest.TestStep {
return logicaltest.TestStep{
Operation: logical.ReadOperation,

View File

@ -124,7 +124,6 @@ func (b *backend) pathConnectionWrite(
ConnectionURL: connURL,
MaxOpenConnections: maxOpenConns,
MaxIdleConnections: maxIdleConns,
VerifyConnection: verifyConnection,
})
if err != nil {
return nil, err
@ -148,7 +147,6 @@ type connectionConfig struct {
ConnectionString string `json:"value" structs:"value" mapstructure:"value"`
MaxOpenConnections int `json:"max_open_connections" structs:"max_open_connections" mapstructure:"max_open_connections"`
MaxIdleConnections int `json:"max_idle_connections" structs:"max_idle_connections" mapstructure:"max_idle_connections"`
VerifyConnection bool `json:"verify_connection" structs:"verify_connection" mapstructure:"verify_connection"`
}
const pathConfigConnectionHelpSyn = `