forked from juju/juju
-
Notifications
You must be signed in to change notification settings - Fork 0
/
steps_22_test.go
79 lines (62 loc) · 2.47 KB
/
steps_22_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Copyright 2017 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package upgrades_test
import (
"io/ioutil"
"path/filepath"
jc "github.com/juju/testing/checkers"
"github.com/juju/version/v2"
gc "gopkg.in/check.v1"
"github.com/juju/juju/testing"
"github.com/juju/juju/upgrades"
)
var v220 = version.MustParse("2.2.0")
type steps22Suite struct {
testing.BaseSuite
}
var _ = gc.Suite(&steps22Suite{})
func (s *steps22Suite) TestAddNonDetachableStorageMachineId(c *gc.C) {
step := findStateStep(c, v220, "add machineid to non-detachable storage docs")
// Logic for step itself is tested in state package.
c.Assert(step.Targets(), jc.DeepEquals, []upgrades.Target{upgrades.DatabaseMaster})
}
func (s *steps22Suite) TestMeterStatusFile(c *gc.C) {
// Create a meter status file.
dataDir := c.MkDir()
statusFile := filepath.Join(dataDir, "meter-status.yaml")
err := ioutil.WriteFile(statusFile, []byte("things"), 0777)
c.Assert(err, jc.ErrorIsNil)
step := findStep(c, v220, "remove meter status file")
check := func() {
context := &mockContext{
agentConfig: &mockAgentConfig{dataDir: dataDir},
}
err = step.Run(context)
c.Assert(err, jc.ErrorIsNil)
// Status file should be gone.
c.Check(pathExists(statusFile), jc.IsFalse)
c.Check(pathExists(dataDir), jc.IsTrue)
}
check()
check() // Check OK when file not present.
}
func (s *steps22Suite) TestAddControllerLogCollectionsSizeSettings(c *gc.C) {
step := findStateStep(c, v220, "add controller log collection sizing config settings")
// Logic for step itself is tested in state package.
c.Assert(step.Targets(), jc.DeepEquals, []upgrades.Target{upgrades.DatabaseMaster})
}
func (s *steps22Suite) TestAddStatusHistoryPruneSettings(c *gc.C) {
step := findStateStep(c, v220, "add status history pruning config settings")
// Logic for step itself is tested in state package.
c.Assert(step.Targets(), jc.DeepEquals, []upgrades.Target{upgrades.DatabaseMaster})
}
func (s *steps22Suite) TestAddStorageInstanceConstraints(c *gc.C) {
step := findStateStep(c, v220, "add storage constraints to storage instance docs")
// Logic for step itself is tested in state package.
c.Assert(step.Targets(), jc.DeepEquals, []upgrades.Target{upgrades.DatabaseMaster})
}
func (s *steps22Suite) TestSplitLogStep(c *gc.C) {
step := findStateStep(c, v220, "split log collections")
// Logic for step itself is tested in state package.
c.Assert(step.Targets(), jc.DeepEquals, []upgrades.Target{upgrades.DatabaseMaster})
}