Description:
Remove hard coded Canonistack image id
Now that we have cloud image metadata for Canonistack, the hard coded
image id and instance type used for live tests are no longer required.
Another change is that the clean up for the live tests was changed to
only remove the fake tools from the public bucket otherwise we were
deleting the entire public bucket and this removed all the legitimate
tools and image metadata files.
Affected files:
A [revision details]
M environs/openstack/live_test.go
M environs/openstack/local_test.go
M environs/openstack/provider.go
M environs/openstack/provider_test.go
M environs/testing/tools.go
Index: environs/openstack/provider.go
=== modified file 'environs/openstack/provider.go'
--- environs/openstack/provider.go 2013-04-22 03:26:40 +0000
+++ environs/openstack/provider.go 2013-04-23 04:03:33 +0000
@@ -77,8 +77,10 @@
# auth-url: https://yourkeystoneurl:443/v2.0/
# override if your workstation is running a different series to which
you are deploying
# default-series: precise
- default-image-id: c876e5fe-abb0-41f0-8f29-f0b47481f523
- default-instance-type: "m1.small"
+ # The attributes below allow user specified defaults to be used if a
suitable image
+ # or instance type cannot be found.
+ # default-image-id: <fallback image id>
+ # default-instance-type: <fallback flavor name>
# The following are used for userpass authentication (the default)
auth-mode: userpass
# Usually set via the env variable OS_USERNAME, but can be specified here
// Out-of-the-box, we support live testing using Canonistack or HP Cloud.
var testConstraints = map[string]openstack.ImageDetails{
- "canonistack": openstack.ImageDetails{
- Flavor: "m1.tiny", ImageId: "c876e5fe-abb0-41f0-8f29-f0b47481f523"},
"hpcloud": openstack.ImageDetails{
Flavor: "standard.xsmall", ImageId: "75845"},
}
@@ -35,14 +33,6 @@
t.Fatalf("Unknown vendor %s. Must be one of %s", *vendor, keys)
}
} else {
- if *imageId == "" {
- t.Fatalf("Must specify image id to use for test instance, "+
- "eg %s for Canonistack", "-image
c876e5fe-abb0-41f0-8f29-f0b47481f523")
- }
- if *flavor == "" {
- t.Fatalf("Must specify flavor to use for test instance, "+
- "eg %s for Canonistack", "-flavor m1.tiny")
- }
testImageDetails = openstack.ImageDetails{*flavor, *imageId}
}
cred, err := identity.CompleteCredentialsFromEnv()
Reviewers: mp+160275_ code.launchpad. net,
Message:
Please take a look.
Description:
Remove hard coded Canonistack image id
Now that we have cloud image metadata for Canonistack, the hard coded
image id and instance type used for live tests are no longer required.
Another change is that the clean up for the live tests was changed to
only remove the fake tools from the public bucket otherwise we were
deleting the entire public bucket and this removed all the legitimate
tools and image metadata files.
https:/ /code.launchpad .net/~wallyworl d/juju- core/openstack- live-test- fixes/+ merge/160275
Requires: /code.launchpad .net/~wallyworl d/juju- core/openstack- image-lookup/ +merge/ 159301
https:/
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/8812053/
Affected files: openstack/ live_test. go openstack/ local_test. go openstack/ provider. go openstack/ provider_ test.go testing/ tools.go
A [revision details]
M environs/
M environs/
M environs/
M environs/
M environs/
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>
Index: environs/ openstack/ live_test. go openstack/ live_test. go' openstack/ live_test. go 2013-04-19 02:39:42 +0000 openstack/ live_test. go 2013-04-23 04:03:33 +0000 oner: false, s.ImageId, s.Flavor,
=== modified file 'environs/
--- environs/
+++ environs/
@@ -70,8 +70,6 @@
// this flag to True.
HasProvisi
},
- testImageId: testImageDetail
- testFlavor: testImageDetail
})
}
@@ -82,8 +80,6 @@ LoggingSuite LiveTests Credentials licStorage environs.Storage
coretesting.
jujutest.
cred *identity.
- testImageId string
- testFlavor string
writeablePub
}
@@ -118,8 +114,7 @@ icStorage != nil { DeleteStorageCo ntent(t. writeablePublic Storage) RemoveFakeTools (c, t.writeablePubl icStorage) TearDownSuite( c) te.TearDownSuit e(c)
return
}
if t.writeablePubl
- err := openstack.
- c.Check(err, IsNil)
+ envtesting.
}
t.LiveTests.
t.LoggingSui
Index: environs/ openstack/ local_test. go openstack/ local_test. go' openstack/ local_test. go 2013-04-19 02:39:42 +0000 openstack/ local_test. go 2013-04-23 04:03:33 +0000 "default- instance- type"] = "m1.small" &localLiveSuite { TestConfig{ config} , LoggingSuite Credentials Credentials Storage environs.Storage
=== modified file 'environs/
--- environs/
+++ environs/
@@ -100,9 +100,7 @@
config[
Suite(
LiveTests: LiveTests{
- cred: cred,
- testImageId: "1",
- testFlavor: "m1.small",
+ cred: cred,
LiveTests: jujutest.LiveTests{
TestConfig: jujutest.
},
@@ -183,9 +181,10 @@
type localServerSuite struct {
coretesting.
jujutest.Tests
- cred *identity.
- srv localServer
- env environs.Environ
+ cred *identity.
+ srv localServer
+ env environs.Environ
+ writeablePublic
}
func (s *localServerSuite) SetUpSuite(c *C) { SetUpTest( c) Storage := openstack. WritablePublicS torage( s.Env) UploadFakeTools (c, writeablePublic Storage) icStorage = openstack. WritablePublicS torage( s.Env) UploadFakeTools (c, s.writeablePubl icStorage) UseTestImageDat a(s.env, false) RemoveTestImage Data(s. env) icStorage != nil { RemoveFakeTools (c, s.writeablePubl icStorage) TearDownTest( c) te.TearDownTest (c)
@@ -206,8 +205,8 @@
"auth-url": s.cred.URL,
})
s.Tests.
- writeablePublic
- envtesting.
+ s.writeablePubl
+ envtesting.
s.env = s.Tests.Env
openstack.
}
@@ -216,6 +215,9 @@
if s.env != nil {
openstack.
}
+ if s.writeablePubl
+ envtesting.
+ }
s.Tests.
s.srv.stop()
s.LoggingSui
Index: environs/ openstack/ provider. go openstack/ provider. go' openstack/ provider. go 2013-04-22 03:26:40 +0000 openstack/ provider. go 2013-04-23 04:03:33 +0000 /yourkeystoneur l:443/v2. 0/ abb0-41f0- 8f29-f0b47481f5 23 instance- type: "m1.small" instance- type: <fallback flavor name>
=== modified file 'environs/
--- environs/
+++ environs/
@@ -77,8 +77,10 @@
# auth-url: https:/
# override if your workstation is running a different series to which
you are deploying
# default-series: precise
- default-image-id: c876e5fe-
- default-
+ # The attributes below allow user specified defaults to be used if a
suitable image
+ # or instance type cannot be found.
+ # default-image-id: <fallback image id>
+ # default-
# The following are used for userpass authentication (the default)
auth-mode: userpass
# Usually set via the env variable OS_USERNAME, but can be specified here
Index: environs/ openstack/ provider_ test.go openstack/ provider_ test.go' openstack/ provider_ test.go 2013-02-27 00:53:19 +0000 openstack/ provider_ test.go 2013-04-23 04:03:33 +0000
=== modified file 'environs/
--- environs/
+++ environs/
@@ -13,8 +13,6 @@
// Out-of-the-box, we support live testing using Canonistack or HP Cloud. openstack. ImageDetails{ ImageDetails{ abb0-41f0- 8f29-f0b47481f5 23"}, ImageDetails{ Fatalf( "Unknown vendor %s. Must be one of %s", *vendor, keys) abb0-41f0- 8f29-f0b47481f5 23") etails = openstack. ImageDetails{ *flavor, *imageId} CompleteCredent ialsFromEnv( )
var testConstraints = map[string]
- "canonistack": openstack.
- Flavor: "m1.tiny", ImageId: "c876e5fe-
"hpcloud": openstack.
Flavor: "standard.xsmall", ImageId: "75845"},
}
@@ -35,14 +33,6 @@
t.
}
} else {
- if *imageId == "" {
- t.Fatalf("Must specify image id to use for test instance, "+
- "eg %s for Canonistack", "-image
c876e5fe-
- }
- if *flavor == "" {
- t.Fatalf("Must specify flavor to use for test instance, "+
- "eg %s for Canonistack", "-flavor m1.tiny")
- }
testImageD
}
cred, err := identity.
Index: environs/ testing/ tools.go testing/ tools.go' testing/ tools.go 2013-04-17 20:41:15 +0000 testing/ tools.go 2013-04-23 04:03:33 +0000
=== modified file 'environs/
--- environs/
+++ environs/
@@ -71,6 +71,20 @@
}
}
+// RemoveFakeTools deletes the fake tools from the supplied storage. me(toolsVersion ) Remove( name) Current. Series != config. DefaultSeries { DefaultSeries me(toolsVersion ) Remove( name) List("tools/ juju-") Remove( name)
+func RemoveFakeTools(c *C, storage environs.Storage) {
+ toolsVersion := version.Current
+ name := tools.StorageNa
+ err := storage.
+ c.Check(err, IsNil)
+ if version.
+ toolsVersion.Series = config.
+ name := tools.StorageNa
+ err := storage.
+ c.Check(err, IsNil)
+ }
+}
+
// RemoveTools deletes all tools from the supplied storage.
func RemoveTools(c *C, storage environs.Storage) {
names, err := storage.
@@ -78,7 +92,7 @@
c.Logf("removing files: %v", names)
for _, name := range names {
err = storage.
- c.Assert(err, IsNil)
+ c.Check(err, IsNil)
}
}