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) t.Fatalf("err:%s resp:%#v\n", err, resp)
} }
delete(configData, "verify_connection")
if !reflect.DeepEqual(configData, resp.Data) { if !reflect.DeepEqual(configData, resp.Data) {
t.Fatalf("bad: expected:%#v\nactual:%#v\n", 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{ entry, err := logical.StorageEntryJSON("config/connection", connectionConfig{
ConnectionString: connString, ConnectionString: connString,
MaxOpenConnections: maxOpenConns, MaxOpenConnections: maxOpenConns,
VerifyConnection: verifyConnection,
}) })
if err != nil { if err != nil {
return nil, err return nil, err
@ -108,7 +107,6 @@ func (b *backend) pathConnectionWrite(req *logical.Request, data *framework.Fiel
type connectionConfig struct { type connectionConfig struct {
ConnectionString string `json:"connection_string" structs:"connection_string" mapstructure:"connection_string"` 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"` 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 = ` const pathConfigConnectionHelpSyn = `

View file

@ -103,6 +103,7 @@ func TestBackend_config_connection(t *testing.T) {
t.Fatalf("err:%s resp:%#v\n", err, resp) t.Fatalf("err:%s resp:%#v\n", err, resp)
} }
delete(configData, "verify_connection")
if !reflect.DeepEqual(configData, resp.Data) { if !reflect.DeepEqual(configData, resp.Data) {
t.Fatalf("bad: expected:%#v\nactual:%#v\n", 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{ entry, err := logical.StorageEntryJSON("config/connection", connectionConfig{
ConnectionURL: connURL, ConnectionURL: connURL,
MaxOpenConnections: maxOpenConns, MaxOpenConnections: maxOpenConns,
VerifyConnection: verifyConnection,
}) })
if err != nil { if err != nil {
return nil, err return nil, err
@ -124,7 +123,6 @@ type connectionConfig struct {
// Deprecate "value" in coming releases // Deprecate "value" in coming releases
ConnectionString string `json:"value" structs:"value" mapstructure:"value"` ConnectionString string `json:"value" structs:"value" mapstructure:"value"`
MaxOpenConnections int `json:"max_open_connections" structs:"max_open_connections" mapstructure:"max_open_connections"` 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 = ` const pathConfigConnectionHelpSyn = `

View file

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

View file

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