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

Side by Side Diff: environs/config/config_test.go

Issue 96140044: Introduce lxc-use-clone, ContainerManagerConfig
Patch Set: Introduce lxc-use-clone, ContainerManagerConfig Created 9 years, 10 months ago
Left:
Right:
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 unified diff | Download patch
« no previous file with comments | « environs/config/config.go ('k') | state/api/params/params.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012, 2013 Canonical Ltd. 1 // Copyright 2012, 2013 Canonical Ltd.
2 // Licensed under the AGPLv3, see LICENCE file for details. 2 // Licensed under the AGPLv3, see LICENCE file for details.
3 3
4 package config_test 4 package config_test
5 5
6 import ( 6 import (
7 "fmt" 7 "fmt"
8 "regexp" 8 "regexp"
9 stdtesting "testing" 9 stdtesting "testing"
10 "time" 10 "time"
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 1021
1022 // These attributes are added if not set. 1022 // These attributes are added if not set.
1023 attrs["development"] = false 1023 attrs["development"] = false
1024 attrs["logging-config"] = "<root>=WARNING;unit=DEBUG" 1024 attrs["logging-config"] = "<root>=WARNING;unit=DEBUG"
1025 attrs["ca-private-key"] = "" 1025 attrs["ca-private-key"] = ""
1026 attrs["image-metadata-url"] = "" 1026 attrs["image-metadata-url"] = ""
1027 attrs["tools-metadata-url"] = "" 1027 attrs["tools-metadata-url"] = ""
1028 attrs["tools-url"] = "" 1028 attrs["tools-url"] = ""
1029 attrs["image-stream"] = "" 1029 attrs["image-stream"] = ""
1030 attrs["proxy-ssh"] = false 1030 attrs["proxy-ssh"] = false
1031 attrs["lxc-use-clone"] = false
1031 1032
1032 // Default firewall mode is instance 1033 // Default firewall mode is instance
1033 attrs["firewall-mode"] = string(config.FwInstance) 1034 attrs["firewall-mode"] = string(config.FwInstance)
1034 c.Assert(cfg.AllAttrs(), jc.DeepEquals, attrs) 1035 c.Assert(cfg.AllAttrs(), jc.DeepEquals, attrs)
1035 c.Assert(cfg.UnknownAttrs(), jc.DeepEquals, map[string]interface{}{"unkn own": "my-unknown"}) 1036 c.Assert(cfg.UnknownAttrs(), jc.DeepEquals, map[string]interface{}{"unkn own": "my-unknown"})
1036 1037
1037 newcfg, err := cfg.Apply(map[string]interface{}{ 1038 newcfg, err := cfg.Apply(map[string]interface{}{
1038 "name": "new-name", 1039 "name": "new-name",
1039 "new-unknown": "my-new-unknown", 1040 "new-unknown": "my-new-unknown",
1040 }) 1041 })
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 new: testing.Attrs{"state-port": 42}, 1104 new: testing.Attrs{"state-port": 42},
1104 err: `cannot change state-port from 37017 to 42`, 1105 err: `cannot change state-port from 37017 to 42`,
1105 }, { 1106 }, {
1106 about: "Cannot change the api-port from implicit-default to different va lue", 1107 about: "Cannot change the api-port from implicit-default to different va lue",
1107 new: testing.Attrs{"api-port": 42}, 1108 new: testing.Attrs{"api-port": 42},
1108 err: `cannot change api-port from 17070 to 42`, 1109 err: `cannot change api-port from 17070 to 42`,
1109 }, { 1110 }, {
1110 about: "Cannot change the bootstrap-timeout from implicit-default to dif ferent value", 1111 about: "Cannot change the bootstrap-timeout from implicit-default to dif ferent value",
1111 new: testing.Attrs{"bootstrap-timeout": 5}, 1112 new: testing.Attrs{"bootstrap-timeout": 5},
1112 err: `cannot change bootstrap-timeout from 600 to 5`, 1113 err: `cannot change bootstrap-timeout from 600 to 5`,
1114 }, {
1115 about: "Cannot change lxc-use-clone",
1116 old: testing.Attrs{"lxc-use-clone": false},
1117 new: testing.Attrs{"lxc-use-clone": true},
1118 err: `cannot change lxc-use-clone from false to true`,
1113 }} 1119 }}
1114 1120
1115 func (*ConfigSuite) TestValidateChange(c *gc.C) { 1121 func (*ConfigSuite) TestValidateChange(c *gc.C) {
1116 files := []testing.TestFile{ 1122 files := []testing.TestFile{
1117 {".ssh/identity.pub", "identity"}, 1123 {".ssh/identity.pub", "identity"},
1118 } 1124 }
1119 h := testing.MakeFakeHomeWithFiles(c, files) 1125 h := testing.MakeFakeHomeWithFiles(c, files)
1120 defer h.Restore() 1126 defer h.Restore()
1121 1127
1122 for i, test := range validationTests { 1128 for i, test := range validationTests {
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 -----BEGIN RSA PRIVATE KEY----- 1443 -----BEGIN RSA PRIVATE KEY-----
1438 MIIBOgIBAAJAZabKgKInuOxj5vDWLwHHQtK3/45KB+32D15w94Nt83BmuGxo90lw 1444 MIIBOgIBAAJAZabKgKInuOxj5vDWLwHHQtK3/45KB+32D15w94Nt83BmuGxo90lw
1439 -----END RSA PRIVATE KEY----- 1445 -----END RSA PRIVATE KEY-----
1440 `[1:] 1446 `[1:]
1441 1447
1442 var invalidCACert = ` 1448 var invalidCACert = `
1443 -----BEGIN CERTIFICATE----- 1449 -----BEGIN CERTIFICATE-----
1444 MIIBOgIBAAJAZabKgKInuOxj5vDWLwHHQtK3/45KB+32D15w94Nt83BmuGxo90lw 1450 MIIBOgIBAAJAZabKgKInuOxj5vDWLwHHQtK3/45KB+32D15w94Nt83BmuGxo90lw
1445 -----END CERTIFICATE----- 1451 -----END CERTIFICATE-----
1446 `[1:] 1452 `[1:]
OLDNEW
« no previous file with comments | « environs/config/config.go ('k') | state/api/params/params.go » ('j') | no next file with comments »

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