1
// Copyright 2013 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
7
. "launchpad.net/gocheck"
11
type EnvironSuite struct {
15
var _ = Suite(new(EnvironSuite))
17
func (EnvironSuite) TestGetSnapshot(c *C) {
18
original := azureEnviron{name: "this-env", ecfg: new(azureEnvironConfig)}
19
snapshot := original.getSnapshot()
21
// The snapshot is identical to the original.
22
c.Check(*snapshot, DeepEquals, original)
24
// However, they are distinct objects.
25
c.Check(snapshot, Not(Equals), &original)
27
// It's a shallow copy; they still share pointers.
28
c.Check(snapshot.ecfg, Equals, original.ecfg)
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{})
35
func (EnvironSuite) TestName(c *C) {
36
env := azureEnviron{name: "foo"}
37
c.Check(env.Name(), Equals, env.name)