Skip to content

Commit

Permalink
Fix a compile error introduced by a previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
wallyworld committed Feb 17, 2018
1 parent 75d0f22 commit 72217dd
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions featuretests/agent_caasoperator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
package featuretests

import (
"os"
"path/filepath"
"time"

"github.com/juju/cmd/cmdtesting"
jc "github.com/juju/testing/checkers"
"github.com/juju/utils"
Expand Down Expand Up @@ -92,6 +96,39 @@ func (s *CAASOperatorSuite) newBufferedLogWriter() *logsender.BufferedLogWriter
return logger
}

func waitForApplicationActive(c *gc.C, dataDir, appTag string) {
timeout := time.After(coretesting.LongWait)
agentCharmDir := filepath.Join(dataDir, "agents", appTag, "charm")
for {
select {
case <-timeout:
c.Fatalf("no activity detected")
case <-time.After(coretesting.ShortWait):
if _, err := os.Stat(agentCharmDir); err == nil {
return
}
}
}
}

func (s *CAASOperatorSuite) TestRunStop(c *gc.C) {
app, config, _ := s.primeAgent(c)
a := s.newAgent(c, app)
go func() { c.Check(a.Run(nil), gc.IsNil) }()
defer func() { c.Check(a.Stop(), gc.IsNil) }()
waitForApplicationActive(c, config.DataDir(), app.Tag().String())
}

func (s *CAASOperatorSuite) TestOpenStateFails(c *gc.C) {
app, config, _ := s.primeAgent(c)
a := s.newAgent(c, app)
go func() { c.Check(a.Run(nil), gc.IsNil) }()
defer func() { c.Check(a.Stop(), gc.IsNil) }()
waitForApplicationActive(c, config.DataDir(), app.Tag().String())

s.AssertCannotOpenState(c, config.Tag(), config.DataDir())
}

type CAASOperatorManifoldsFunc func(config caasoperator.ManifoldsConfig) dependency.Manifolds

func TrackCAASOperator(c *gc.C, tracker *agenttest.EngineTracker, inner CAASOperatorManifoldsFunc) CAASOperatorManifoldsFunc {
Expand Down

0 comments on commit 72217dd

Please sign in to comment.