@@ -29,7 +29,7 @@ type myAmazingServiceManager struct {
29
29
func (mgr * myAmazingServiceManager ) ChangeServicePassword (name , newPassword string ) error {
30
30
mgr .svcNames = append (mgr .svcNames , name )
31
31
mgr .pwd = newPassword
32
- if name == "failme" {
32
+ if name == "jujud-unit- failme" {
33
33
return errors .New ("wubwub" )
34
34
}
35
35
return nil
@@ -48,11 +48,12 @@ func (s *ServicePasswordChangerSuite) SetUpTest(c *gc.C) {
48
48
}
49
49
50
50
func listServices () ([]string , error ) {
51
- return []string {"boom" , "pow" }, nil
51
+ // all services except those prefixed with jujud-unit will be filtered out.
52
+ return []string {"boom" , "pow" , "jujud-unit-valid" , "jujud-unit-another" }, nil
52
53
}
53
54
54
55
func listServicesFailingService () ([]string , error ) {
55
- return []string {"boom" , "failme " , "pow " }, nil
56
+ return []string {"boom" , "pow " , "jujud-unit-failme " }, nil
56
57
}
57
58
58
59
func brokenListServices () ([]string , error ) {
@@ -62,7 +63,7 @@ func brokenListServices() ([]string, error) {
62
63
func (s * ServicePasswordChangerSuite ) TestChangeServicePasswordListSucceeds (c * gc.C ) {
63
64
err := s .c .ChangeJujudServicesPassword ("newPass" , s .mgr , listServices )
64
65
c .Assert (err , jc .ErrorIsNil )
65
- c .Assert (s .mgr .svcNames , gc .DeepEquals , []string {"boom " , "pow " })
66
+ c .Assert (s .mgr .svcNames , gc .DeepEquals , []string {"jujud-unit-valid " , "jujud-unit-another " })
66
67
c .Assert (s .mgr .pwd , gc .Equals , "newPass" )
67
68
}
68
69
@@ -74,7 +75,7 @@ func (s *ServicePasswordChangerSuite) TestChangeServicePasswordListFails(c *gc.C
74
75
func (s * ServicePasswordChangerSuite ) TestChangePasswordFails (c * gc.C ) {
75
76
err := s .c .ChangeJujudServicesPassword ("newPass" , s .mgr , listServicesFailingService )
76
77
c .Assert (err , gc .ErrorMatches , "wubwub" )
77
- c .Assert (s .mgr .svcNames , gc .DeepEquals , []string {"boom" , " failme" })
78
+ c .Assert (s .mgr .svcNames , gc .DeepEquals , []string {"jujud-unit- failme" })
78
79
c .Assert (s .mgr .pwd , gc .Equals , "newPass" )
79
80
}
80
81
0 commit comments