Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Stops control after test blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
jcooklin committed Jun 30, 2016
1 parent 51314c6 commit 0476ccf
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions control/control_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,20 @@ func load(c *pluginControl, paths ...string) (core.CatalogedPlugin, serror.SnapE
}

func TestPluginControlGenerateArgs(t *testing.T) {
Convey("pluginControl.Start", t, func() {
c := New(GetDefaultConfig())
Convey("starts successfully", func() {
err := c.Start()
So(c.Started, ShouldBeTrue)
So(err, ShouldBeNil)
n := c.Name()
So(n, ShouldResemble, "control")
})
Convey("sets monitor duration", func() {
c.SetMonitorOptions(MonitorDurationOption(time.Millisecond * 100))
So(c.pluginRunner.Monitor().duration, ShouldResemble, 100*time.Millisecond)
})
config := GetDefaultConfig()
config.ListenPort = 0
c := New(config)
err := c.Start()
Convey("pluginControl starts successfully", t, func() {
So(c.Started, ShouldBeTrue)
So(err, ShouldBeNil)
So(c.Name(), ShouldResemble, "control")
})
c.SetMonitorOptions(MonitorDurationOption(time.Millisecond * 100))
Convey("sets monitor duration", t, func() {
So(c.pluginRunner.Monitor().duration, ShouldResemble, 100*time.Millisecond)
})
c.Stop()
}

func TestSwapPlugin(t *testing.T) {
Expand Down Expand Up @@ -419,6 +419,7 @@ func TestLoadWithSignedPlugins(t *testing.T) {
Convey("so error should not be nil when loading an unsigned plugin with trust enabled", func() {
So(err, ShouldNotBeNil)
})
c.Stop()
})
} else {
fmt.Printf("SNAP_PATH not set. Cannot test %s plugin.\n", fixtures.PluginName)
Expand Down Expand Up @@ -918,6 +919,7 @@ func TestRoutingCachingStrategy(t *testing.T) {
})
})
})
c.Stop()
})

Convey("Given loaded plugins that use least-recently-used routing", t, func() {
Expand Down Expand Up @@ -984,6 +986,7 @@ func TestRoutingCachingStrategy(t *testing.T) {
})
})
})
c.Stop()
})
}

Expand Down Expand Up @@ -1638,6 +1641,7 @@ func TestMetricSubscriptionToNewVersion(t *testing.T) {
_, ok = mts[0].Data().(int)
So(ok, ShouldEqual, true)
})
c.Stop()
})
}

Expand Down Expand Up @@ -1705,6 +1709,7 @@ func TestMetricSubscriptionToOlderVersion(t *testing.T) {
_, ok = mts[0].Data().(string)
So(ok, ShouldEqual, true)
})
c.Stop()
})

}

0 comments on commit 0476ccf

Please sign in to comment.