~rogpeppe/juju-core/323-machineagent-api-client

« back to all changes in this revision

Viewing changes to environs/azure/environ_test.go

  • Committer: Tarmac
  • Author(s): Jeroen Vermeulen, Raphael Badin
  • Date: 2013-06-18 08:25:43 UTC
  • mfrom: (1279.3.5 az-config-items2)
  • Revision ID: tarmac-20130618082543-75gr9mvvl9jzgca8
[r=rvb] Add config-related methods in the Azure provider.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright 2013 Canonical Ltd.
 
2
// Licensed under the AGPLv3, see LICENCE file for details.
 
3
 
 
4
package azure
 
5
 
 
6
import (
 
7
        . "launchpad.net/gocheck"
 
8
        "sync"
 
9
)
 
10
 
 
11
type EnvironSuite struct {
 
12
        ProviderSuite
 
13
}
 
14
 
 
15
var _ = Suite(new(EnvironSuite))
 
16
 
 
17
func (EnvironSuite) TestGetSnapshot(c *C) {
 
18
        original := azureEnviron{name: "this-env", ecfg: new(azureEnvironConfig)}
 
19
        snapshot := original.getSnapshot()
 
20
 
 
21
        // The snapshot is identical to the original.
 
22
        c.Check(*snapshot, DeepEquals, original)
 
23
 
 
24
        // However, they are distinct objects.
 
25
        c.Check(snapshot, Not(Equals), &original)
 
26
 
 
27
        // It's a shallow copy; they still share pointers.
 
28
        c.Check(snapshot.ecfg, Equals, original.ecfg)
 
29
 
 
30
        // Neither object is locked at the end of the copy.
 
31
        c.Check(original.Mutex, Equals, sync.Mutex{})
 
32
        c.Check(snapshot.Mutex, Equals, sync.Mutex{})
 
33
}
 
34
 
 
35
func (EnvironSuite) TestName(c *C) {
 
36
        env := azureEnviron{name: "foo"}
 
37
        c.Check(env.Name(), Equals, env.name)
 
38
}