[lxc-devel] [lxd/master] Storage: Always initialise db.StorageRemoteDriverNames in DB tests
tomponline on Github
lxc-bot at linuxcontainers.org
Tue Nov 10 10:52:05 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201110/7b006b90/attachment.bin>
-------------- next part --------------
From 33f1523397cd40c027d4d96bc511f0d122c70b3f Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 10 Nov 2020 10:44:34 +0000
Subject: [PATCH 1/2] lxd/db/storage/pools/test: Initialise
db.StorageRemoteDriverNames in db_test package
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/db/storage_pools_test.go | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lxd/db/storage_pools_test.go b/lxd/db/storage_pools_test.go
index 2958900c5e..9830798068 100644
--- a/lxd/db/storage_pools_test.go
+++ b/lxd/db/storage_pools_test.go
@@ -11,6 +11,12 @@ import (
"github.com/stretchr/testify/require"
)
+func init() {
+ db.StorageRemoteDriverNames = func() []string {
+ return []string{"ceph", "cephfs"}
+ }
+}
+
// The GetStoragePoolsLocalConfigs method returns only node-specific config values.
func TestGetStoragePoolsLocalConfigs(t *testing.T) {
cluster, cleanup := db.NewTestCluster(t)
From 7f8d26eb15ff1e5efaacc80372aa92743dbcbb1c Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 10 Nov 2020 10:46:21 +0000
Subject: [PATCH 2/2] lxd/db: Removes duplicated db.StorageRemoteDriverNames
init from tests
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/db/instances_test.go | 4 ----
lxd/db/storage_volumes_test.go | 4 ----
2 files changed, 8 deletions(-)
diff --git a/lxd/db/instances_test.go b/lxd/db/instances_test.go
index 8922bcbe50..d6b71eb974 100644
--- a/lxd/db/instances_test.go
+++ b/lxd/db/instances_test.go
@@ -216,10 +216,6 @@ func TestInstanceList(t *testing.T) {
}
func TestCreateInstance(t *testing.T) {
- db.StorageRemoteDriverNames = func() []string {
- return []string{"ceph", "cephfs"}
- }
-
tx, cleanup := db.NewTestClusterTx(t)
defer cleanup()
diff --git a/lxd/db/storage_volumes_test.go b/lxd/db/storage_volumes_test.go
index 2dd65f699b..557a23b449 100644
--- a/lxd/db/storage_volumes_test.go
+++ b/lxd/db/storage_volumes_test.go
@@ -12,10 +12,6 @@ import (
// Addresses of all nodes with matching volume name are returned.
func TestGetStorageVolumeNodes(t *testing.T) {
- db.StorageRemoteDriverNames = func() []string {
- return []string{"ceph", "cephfs"}
- }
-
tx, cleanup := db.NewTestClusterTx(t)
defer cleanup()
More information about the lxc-devel
mailing list