Merge pull request #28097 from jasons42/etcdv3-acceptance-tests

Fix type conversion panic
This commit is contained in:
James Bardin 2021-03-17 14:10:54 -04:00 committed by GitHub
commit 439bf9a96d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 8 deletions

View File

@ -60,12 +60,12 @@ func TestBackend(t *testing.T) {
// Get the backend. We need two to test locking.
b1 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
"endpoints": etcdv3Endpoints,
"endpoints": stringsToInterfaces(etcdv3Endpoints),
"prefix": prefix,
}))
b2 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
"endpoints": etcdv3Endpoints,
"endpoints": stringsToInterfaces(etcdv3Endpoints),
"prefix": prefix,
}))
@ -83,13 +83,13 @@ func TestBackend_lockDisabled(t *testing.T) {
// Get the backend. We need two to test locking.
b1 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
"endpoints": etcdv3Endpoints,
"endpoints": stringsToInterfaces(etcdv3Endpoints),
"prefix": prefix,
"lock": false,
}))
b2 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
"endpoints": etcdv3Endpoints,
"endpoints": stringsToInterfaces(etcdv3Endpoints),
"prefix": prefix + "/" + "different", // Diff so locking test would fail if it was locking
"lock": false,
}))
@ -97,3 +97,11 @@ func TestBackend_lockDisabled(t *testing.T) {
// Test
backend.TestBackendStateLocks(t, b1, b2)
}
func stringsToInterfaces(strSlice []string) []interface{} {
var interfaceSlice []interface{}
for _, v := range strSlice {
interfaceSlice = append(interfaceSlice, v)
}
return interfaceSlice
}

View File

@ -23,7 +23,7 @@ func TestRemoteClient(t *testing.T) {
// Get the backend
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
"endpoints": etcdv3Endpoints,
"endpoints": stringsToInterfaces(etcdv3Endpoints),
"prefix": prefix,
}))
@ -45,7 +45,7 @@ func TestEtcdv3_stateLock(t *testing.T) {
// Get the backend
s1, err := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
"endpoints": etcdv3Endpoints,
"endpoints": stringsToInterfaces(etcdv3Endpoints),
"prefix": prefix,
})).StateMgr(backend.DefaultStateName)
if err != nil {
@ -53,7 +53,7 @@ func TestEtcdv3_stateLock(t *testing.T) {
}
s2, err := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
"endpoints": etcdv3Endpoints,
"endpoints": stringsToInterfaces(etcdv3Endpoints),
"prefix": prefix,
})).StateMgr(backend.DefaultStateName)
if err != nil {
@ -71,7 +71,7 @@ func TestEtcdv3_destroyLock(t *testing.T) {
// Get the backend
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
"endpoints": etcdv3Endpoints,
"endpoints": stringsToInterfaces(etcdv3Endpoints),
"prefix": prefix,
}))