Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(465)

Unified Diff: environs/jujutest/livetests.go

Issue 13632046: all: introduce environs.Prechecker
Patch Set: all: introduce environs.Prechecker Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « environs/interface.go ('k') | errors/errors.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: environs/jujutest/livetests.go
=== modified file 'environs/jujutest/livetests.go'
--- environs/jujutest/livetests.go 2013-09-16 04:44:39 +0000
+++ environs/jujutest/livetests.go 2013-09-24 06:28:47 +0000
@@ -21,6 +21,7 @@
"launchpad.net/juju-core/environs/sync"
envtesting "launchpad.net/juju-core/environs/testing"
envtools "launchpad.net/juju-core/environs/tools"
+ coreerrors "launchpad.net/juju-core/errors"
"launchpad.net/juju-core/errors"
"launchpad.net/juju-core/instance"
"launchpad.net/juju-core/juju"
@@ -130,6 +131,27 @@
t.bootstrapped = false
}
+func (t *LiveTests) TestPrechecker(c *gc.C) {
+ // Providers may implement Prechecker. If they do, then they should
+ // return nil for empty constraints (excluding the null provider).
+ prechecker, ok := t.Env.(environs.Prechecker)
+ if !ok {
+ return
+ }
+
+ const series = "precise"
+ var cons constraints.Value
+ c.Check(prechecker.PrecheckInstance(series, cons), gc.IsNil)
+
+ err := prechecker.PrecheckContainer(series, instance.LXC)
+ // If err is nil, that is fine, some providers support containers.
+ if err != nil {
+ // But for ones that don't, they should have a standard error format.
+ c.Check(err, gc.ErrorMatches, ".*provider does not support containers")
+ c.Check(err, jc.Satisfies, coreerrors.IsContainersUnsupported)
+ }
+}
+
// TestStartStop is similar to Tests.TestStartStop except
// that it does not assume a pristine environment.
func (t *LiveTests) TestStartStop(c *gc.C) {
« no previous file with comments | « environs/interface.go ('k') | errors/errors.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b