From 9e62489f778cd5f6b0c3081695fe802687812d9e Mon Sep 17 00:00:00 2001 From: Luke Morris Date: Sat, 16 Dec 2017 14:35:04 -0800 Subject: [PATCH] Repair broken tests --- bolt/client.go | 2 +- bolt/config_test.go | 3 +++ bolt/organizations_test.go | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bolt/client.go b/bolt/client.go index 927d343afa..4fb7a6f205 100644 --- a/bolt/client.go +++ b/bolt/client.go @@ -171,7 +171,7 @@ func (c *Client) Backup(ctx context.Context, build chronograf.BuildInfo) error { backupDir := path.Join(path.Dir(c.Path), "backup") _ = os.Mkdir(backupDir, 0700) - toName := fmt.Sprintf("%s.%s", c.Path, lastBuild.Version) + toName := fmt.Sprintf("%s.%s", path.Base(c.Path), lastBuild.Version) toPath := path.Join(backupDir, toName) to, err := os.OpenFile(toPath, os.O_RDWR|os.O_CREATE, 0600) if err != nil { diff --git a/bolt/config_test.go b/bolt/config_test.go index 8577185097..a1cf8f867b 100644 --- a/bolt/config_test.go +++ b/bolt/config_test.go @@ -36,6 +36,9 @@ func TestConfig_Get(t *testing.T) { if err := client.Open(context.TODO()); err != nil { t.Fatal(err) } + if err := client.Migrate(context.TODO()); err != nil { + t.Fatal(err) + } defer client.Close() s := client.ConfigStore diff --git a/bolt/organizations_test.go b/bolt/organizations_test.go index 9ef54c3b23..fa834f3429 100644 --- a/bolt/organizations_test.go +++ b/bolt/organizations_test.go @@ -218,6 +218,9 @@ func TestOrganizationsStore_All(t *testing.T) { if err := client.Open(context.TODO()); err != nil { t.Fatal(err) } + if err := client.Migrate(context.TODO()); err != nil { + t.Fatal(err) + } defer client.Close() s := client.OrganizationsStore @@ -651,6 +654,9 @@ func TestOrganizationsStore_DefaultOrganization(t *testing.T) { if err := client.Open(context.TODO()); err != nil { t.Fatal(err) } + if err := client.Migrate(context.TODO()); err != nil { + t.Fatal(err) + } defer client.Close() s := client.OrganizationsStore