Skip to content

Commit

Permalink
Merge pull request #3170 from bogdanteleaga/testfix
Browse files Browse the repository at this point in the history
CentOS unit tests fixes

This is taken from #2951.

Claudiu is not working on juju anymore and this needed updated dependencies and a gofmt run to merge.

(Review request: http://reviews.vapour.ws/r/2548/)
  • Loading branch information
jujubot committed Sep 1, 2015
2 parents a94dd2c + f28f8c3 commit cbd0118
Show file tree
Hide file tree
Showing 11 changed files with 431 additions and 188 deletions.
11 changes: 8 additions & 3 deletions cmd/jujud/agent/upgrade_test.go
Expand Up @@ -72,7 +72,7 @@ func (s *UpgradeSuite) setAptCmds(cmd *exec.Cmd) {
}
}

func (s *UpgradeSuite) getAptCmds() []*exec.Cmd {
func (s *UpgradeSuite) getInstallCmds() []*exec.Cmd {
s.aptMutex.Lock()
defer s.aptMutex.Unlock()
return s.aptCmds
Expand Down Expand Up @@ -802,11 +802,16 @@ func (s *UpgradeSuite) keyFile() string {

func (s *UpgradeSuite) assertCommonUpgrades(c *gc.C) {
// rsyslog-gnutls should have been installed.
cmds := s.getAptCmds()
cmds := s.getInstallCmds()
c.Assert(cmds, gc.HasLen, 1)
args := cmds[0].Args
c.Assert(len(args), jc.GreaterThan, 1)
c.Assert(args[0], gc.Equals, "apt-get")

pm, err := coretesting.GetPackageManager()
c.Assert(err, jc.ErrorIsNil)

c.Assert(args[0], gc.Equals, pm.PackageManager)

c.Assert(args[len(args)-1], gc.Equals, "rsyslog-gnutls")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/plugins/local/main_test.go
Expand Up @@ -77,6 +77,6 @@ func (s *mainSuite) TestRunAsRootCallsSudoIfNotRoot(c *gc.C) {
context := coretesting.Context(c)
err = local.RunAsRoot("juju-magic", args, context, callIgnored)
c.Assert(err, jc.ErrorIsNil)
expected := fmt.Sprintf("sudo \"--preserve-env\" \"%s\" \"passed\"", magicPath)
expected := fmt.Sprintf("sudo '--preserve-env' '%s' 'passed'", magicPath)
c.Assert(strings.TrimRight(coretesting.Stdout(context), "\r\n"), gc.Equals, expected)
}
2 changes: 1 addition & 1 deletion dependencies.tsv
Expand Up @@ -25,7 +25,7 @@ github.com/juju/ratelimit git aa5bb718d4d435629821789cb90970319f57bfe5 2015-03-3
github.com/juju/replicaset git fb7294cf57a1e2f08a57691f1246d129a87ab7e8 2015-05-08T02:21:43Z
github.com/juju/schema git afe1151cb49d1d7ed3c75592dfc6f38703f2e988 2015-08-07T07:58:08Z
github.com/juju/syslog git 6be94e8b718766e9ff7a37342157fe4795da7cfa 2015-02-05T15:59:36Z
github.com/juju/testing git f521911d9a79aeb62c051fe18e689796369c5564 2015-05-29T04:40:43Z
github.com/juju/testing git 0d3403a33d6f400e2edda08d8a3242aa4b255e14 2015-09-01T15:22:33Z
github.com/juju/txn git 99ec629d0066a4d73c54d8e021a7fc1dc07df614 2015-06-09T16:58:27Z
github.com/juju/utils git 6f48322bb574b8578e8ecccf689220eac7edad9d 2015-08-10T03:07:18Z
github.com/juju/xml git eb759a627588d35166bc505fceb51b88500e291e 2015-04-13T13:11:21Z
Expand Down
8 changes: 5 additions & 3 deletions mongo/mongo.go
Expand Up @@ -12,6 +12,7 @@ import (
"os/exec"
"path"
"path/filepath"
"strconv"
"strings"

"github.com/juju/errors"
Expand All @@ -22,6 +23,7 @@ import (
"github.com/juju/utils/packaging/manager"
"gopkg.in/mgo.v2"

environs "github.com/juju/juju/environs/config"
"github.com/juju/juju/network"
"github.com/juju/juju/service"
"github.com/juju/juju/version"
Expand Down Expand Up @@ -354,16 +356,16 @@ func installMongod(operatingsystem string, numaCtl bool) error {
logger.Infof("running %s %v", cmd[0], cmd[1:])
_, err = utils.RunCommand(cmd[0], cmd[1:]...)
if err != nil {
logger.Infof("chcon error %s", err)
logger.Infof("chcon error %s", err.Error())
logger.Errorf("chcon failed to change file security context error %s", err)
return err
}

cmd = []string{"semanage", "port", "-a", "-t", "mongod_port_t", "-p", "tcp", "37017"}
cmd = []string{"semanage", "port", "-a", "-t", "mongod_port_t", "-p", "tcp", strconv.Itoa(environs.DefaultStatePort)}
logger.Infof("running %s %v", cmd[0], cmd[1:])
_, err = utils.RunCommand(cmd[0], cmd[1:]...)
if err != nil {
if !strings.Contains(err.Error(), "exit status 1") {
logger.Errorf("semanage failed to provide access on port %d error %s", environs.DefaultStatePort, err)
return err
}
}
Expand Down

0 comments on commit cbd0118

Please sign in to comment.