Skip to content

Commit a8ed424

Browse files
committed
Review tweaks.
1 parent 75c3b5c commit a8ed424

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

testing/environ_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (s *fakeHomeSuite) TestFakeHomeSetsConfigJujuHome(c *gc.C) {
5252
c.Assert(osenv.JujuHome(), gc.Equals, expected)
5353
}
5454

55-
func (s *fakeHomeSuite) TestEnvironmentTagValie(c *gc.C) {
55+
func (s *fakeHomeSuite) TestEnvironmentTagValid(c *gc.C) {
5656
asString := testing.EnvironmentTag.String()
5757
tag, err := names.ParseEnvironTag(asString)
5858
c.Assert(err, jc.ErrorIsNil)

upgrades/agentconfig_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,20 +242,29 @@ func (s *migrateAgentEnvUUIDSuite) primeConfig(c *gc.C) {
242242
func (s *migrateAgentEnvUUIDSuite) removeEnvUUIDFromAgentConfig(c *gc.C) {
243243
// Read the file in as simple map[string]interface{} and delete
244244
// the element, and write it back out again.
245+
246+
// First step, read the file contents.
245247
filename := agent.ConfigPath(agent.DefaultDataDir, s.machine.Tag())
246248
data, err := ioutil.ReadFile(filename)
247-
c.Logf("Data in:\n\n%s\n", data)
248249
c.Assert(err, jc.ErrorIsNil)
250+
c.Logf("Data in:\n\n%s\n", data)
251+
252+
// Parse it into the map.
249253
var content map[string]interface{}
250254
err = goyaml.Unmarshal(data, &content)
251255
c.Assert(err, jc.ErrorIsNil)
256+
257+
// Remove the environment value, and marshal back into bytes.
252258
delete(content, "environment")
253259
data, err = goyaml.Marshal(content)
254260
c.Assert(err, jc.ErrorIsNil)
261+
262+
// Write the yaml back out remembering to add the format prefix.
255263
data = append([]byte("# format 1.18\n"), data...)
256264
c.Logf("Data out:\n\n%s\n", data)
257265
err = ioutil.WriteFile(filename, data, 0644)
258266
c.Assert(err, jc.ErrorIsNil)
267+
259268
// Reset test attributes.
260269
cfg, err := agent.ReadConfig(filename)
261270
c.Assert(err, jc.ErrorIsNil)

0 commit comments

Comments
 (0)