Clean up HABackend tests (#5617)

This commit is contained in:
Calvin Leung Huang
2018-11-01 10:31:09 -07:00
committed by GitHub
parent 934ec9305b
commit 6d6fbf2f57
11 changed files with 92 additions and 87 deletions

View File

@@ -78,16 +78,16 @@ func TestMySQLHABackend(t *testing.T) {
// Run vault tests
logger := logging.NewVaultLogger(log.Debug)
b, err := NewMySQLBackend(map[string]string{
config := map[string]string{
"address": address,
"database": database,
"table": table,
"username": username,
"password": password,
"ha_enabled": "true",
}, logger)
}
b, err := NewMySQLBackend(config, logger)
if err != nil {
t.Fatalf("Failed to create new backend: %v", err)
}
@@ -100,9 +100,10 @@ func TestMySQLHABackend(t *testing.T) {
}
}()
ha, ok := b.(physical.HABackend)
if !ok {
t.Fatalf("MySQL does not implement HABackend")
b2, err := NewMySQLBackend(config, logger)
if err != nil {
t.Fatalf("Failed to create new backend: %v", err)
}
physical.ExerciseHABackend(t, ha, ha)
physical.ExerciseHABackend(t, b.(physical.HABackend), b2.(physical.HABackend))
}