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

Unified Diff: environs/cloudinit/cloudinit_test.go

Issue 70010045: Agent config format 1.18 (Closed)
Patch Set: Agent config format 1.18 Created 11 years, 1 month 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/cloudinit/cloudinit.go ('k') | environs/cloudinit_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: environs/cloudinit/cloudinit_test.go
=== modified file 'environs/cloudinit/cloudinit_test.go'
--- environs/cloudinit/cloudinit_test.go 2014-02-27 04:43:37 +0000
+++ environs/cloudinit/cloudinit_test.go 2014-03-06 12:14:26 +0000
@@ -21,6 +21,7 @@
"launchpad.net/juju-core/names"
"launchpad.net/juju-core/state"
"launchpad.net/juju-core/state/api"
+ "launchpad.net/juju-core/state/api/params"
"launchpad.net/juju-core/testing"
jc "launchpad.net/juju-core/testing/checkers"
"launchpad.net/juju-core/testing/testbase"
@@ -39,6 +40,13 @@
var envConstraints = constraints.MustParse("mem=2G")
+var allMachineJobs = []params.MachineJob{
+ params.JobManageEnviron, params.JobHostUnits,
+}
+var normalMachineJobs = []params.MachineJob{
+ params.JobHostUnits,
+}
+
type cloudinitTest struct {
cfg cloudinit.MachineConfig
setEnvConfig bool
@@ -87,7 +95,8 @@
},
Constraints: envConstraints,
DataDir: environs.DataDir,
- LogDir: environs.LogDir,
+ LogDir: agent.DefaultLogDir,
+ Jobs: allMachineJobs,
CloudInitOutputLog: environs.CloudInitOutputLog,
StateInfoURL: "some-url",
SystemPrivateSSHKey: "private rsa key",
@@ -115,8 +124,6 @@
rm \$bin/tools\.tar\.gz && rm \$bin/juju1\.2\.3-precise-amd64\.sha256
printf %s '{"version":"1\.2\.3-precise-amd64","url":"http://foo\.com/tools/releases/juju1\.2\.3-precise-amd64\.tgz","sha256":"1234","size":10}' > \$bin/downloaded-tools\.txt
mkdir -p '/var/lib/juju/agents/machine-0'
-install -m 644 /dev/null '/var/lib/juju/agents/machine-0/format'
-printf '%s\\n' '.*' > '/var/lib/juju/agents/machine-0/format'
install -m 600 /dev/null '/var/lib/juju/agents/machine-0/agent\.conf'
printf '%s\\n' '.*' > '/var/lib/juju/agents/machine-0/agent\.conf'
install -D -m 644 /dev/null '/etc/apt/preferences\.d/50-cloud-tools'
@@ -134,8 +141,6 @@
cat >> /etc/init/juju-db\.conf << 'EOF'\\ndescription "juju state database"\\nauthor "Juju Team <juju@lists\.ubuntu\.com>"\\nstart on runlevel \[2345\]\\nstop on runlevel \[!2345\]\\nrespawn\\nnormal exit 0\\n\\nlimit nofile 65000 65000\\nlimit nproc 20000 20000\\n\\nexec ` + mongodPath + ` --auth --dbpath=/var/lib/juju/db --sslOnNormalPorts --sslPEMKeyFile '/var/lib/juju/server\.pem' --sslPEMKeyPassword ignored --bind_ip 0\.0\.0\.0 --port 37017 --noprealloc --syslog --smallfiles\\nEOF\\n
start juju-db
mkdir -p '/var/lib/juju/agents/bootstrap'
-install -m 644 /dev/null '/var/lib/juju/agents/bootstrap/format'
-printf '%s\\n' '.*' > '/var/lib/juju/agents/bootstrap/format'
install -m 600 /dev/null '/var/lib/juju/agents/bootstrap/agent\.conf'
printf '%s\\n' '.*' > '/var/lib/juju/agents/bootstrap/agent\.conf'
echo 'Bootstrapping Juju machine agent'.*
@@ -171,7 +176,8 @@
},
Constraints: envConstraints,
DataDir: environs.DataDir,
- LogDir: environs.LogDir,
+ LogDir: agent.DefaultLogDir,
+ Jobs: allMachineJobs,
CloudInitOutputLog: environs.CloudInitOutputLog,
StateInfoURL: "some-url",
SystemPrivateSSHKey: "private rsa key",
@@ -198,7 +204,8 @@
AuthorizedKeys: "sshkey1",
AgentEnvironment: map[string]string{agent.ProviderType: "dummy"},
DataDir: environs.DataDir,
- LogDir: environs.LogDir,
+ LogDir: agent.DefaultLogDir,
+ Jobs: normalMachineJobs,
CloudInitOutputLog: environs.CloudInitOutputLog,
StateServer: false,
Tools: newSimpleTools("1.2.3-linux-amd64"),
@@ -236,8 +243,6 @@
rm \$bin/tools\.tar\.gz && rm \$bin/juju1\.2\.3-linux-amd64\.sha256
printf %s '{"version":"1\.2\.3-linux-amd64","url":"http://foo\.com/tools/releases/juju1\.2\.3-linux-amd64\.tgz","sha256":"1234","size":10}' > \$bin/downloaded-tools\.txt
mkdir -p '/var/lib/juju/agents/machine-99'
-install -m 644 /dev/null '/var/lib/juju/agents/machine-99/format'
-printf '%s\\n' '.*' > '/var/lib/juju/agents/machine-99/format'
install -m 600 /dev/null '/var/lib/juju/agents/machine-99/agent\.conf'
printf '%s\\n' '.*' > '/var/lib/juju/agents/machine-99/agent\.conf'
ln -s 1\.2\.3-linux-amd64 '/var/lib/juju/tools/machine-99'
@@ -253,7 +258,8 @@
AuthorizedKeys: "sshkey1",
AgentEnvironment: map[string]string{agent.ProviderType: "dummy"},
DataDir: environs.DataDir,
- LogDir: environs.LogDir,
+ LogDir: agent.DefaultLogDir,
+ Jobs: normalMachineJobs,
CloudInitOutputLog: environs.CloudInitOutputLog,
StateServer: false,
Tools: newSimpleTools("1.2.3-linux-amd64"),
@@ -275,8 +281,6 @@
inexactMatch: true,
expectScripts: `
mkdir -p '/var/lib/juju/agents/machine-2-lxc-1'
-install -m 644 /dev/null '/var/lib/juju/agents/machine-2-lxc-1/format'
-printf '%s\\n' '.*' > '/var/lib/juju/agents/machine-2-lxc-1/format'
install -m 600 /dev/null '/var/lib/juju/agents/machine-2-lxc-1/agent\.conf'
printf '%s\\n' '.*' > '/var/lib/juju/agents/machine-2-lxc-1/agent\.conf'
ln -s 1\.2\.3-linux-amd64 '/var/lib/juju/tools/machine-2-lxc-1'
@@ -290,7 +294,8 @@
AuthorizedKeys: "sshkey1",
AgentEnvironment: map[string]string{agent.ProviderType: "dummy"},
DataDir: environs.DataDir,
- LogDir: environs.LogDir,
+ LogDir: agent.DefaultLogDir,
+ Jobs: normalMachineJobs,
CloudInitOutputLog: environs.CloudInitOutputLog,
StateServer: false,
Tools: newSimpleTools("1.2.3-linux-amd64"),
@@ -337,7 +342,8 @@
CACert: []byte("CA CERT\n" + testing.CACert),
},
DataDir: environs.DataDir,
- LogDir: environs.LogDir,
+ LogDir: agent.DefaultLogDir,
+ Jobs: allMachineJobs,
CloudInitOutputLog: environs.CloudInitOutputLog,
StateInfoURL: "some-url",
SystemPrivateSSHKey: "private rsa key",
@@ -368,7 +374,7 @@
}
func getAgentConfig(c *gc.C, tag string, scripts []string) (cfg string) {
- re := regexp.MustCompile(`printf '%s\\n' '([^']+)' > .*agents/` + regexp.QuoteMeta(tag) + `/agent\.conf`)
+ re := regexp.MustCompile(`printf '%s\\n' '((\n|.)+)' > .*agents/` + regexp.QuoteMeta(tag) + `/agent\.conf`)
found := false
for _, s := range scripts {
m := re.FindStringSubmatch(s)
@@ -754,7 +760,8 @@
},
Config: minimalConfig(c),
DataDir: environs.DataDir,
- LogDir: environs.LogDir,
+ LogDir: agent.DefaultLogDir,
+ Jobs: normalMachineJobs,
CloudInitOutputLog: environs.CloudInitOutputLog,
MachineNonce: "FAKE_NONCE",
SystemPrivateSSHKey: "private rsa key",
« no previous file with comments | « environs/cloudinit/cloudinit.go ('k') | environs/cloudinit_test.go » ('j') | no next file with comments »

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