LEFT | RIGHT |
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 main | 4 package main |
5 | 5 |
6 import ( | 6 import ( |
7 "bytes" | 7 "bytes" |
8 "encoding/json" | 8 "encoding/json" |
9 "fmt" | 9 "fmt" |
10 . "launchpad.net/gocheck" | 10 . "launchpad.net/gocheck" |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 c.Assert(m.Id(), Equals, ac.machineId) | 829 c.Assert(m.Id(), Equals, ac.machineId) |
830 } | 830 } |
831 | 831 |
832 type startMachine struct { | 832 type startMachine struct { |
833 machineId string | 833 machineId string |
834 } | 834 } |
835 | 835 |
836 func (sm startMachine) step(c *C, ctx *context) { | 836 func (sm startMachine) step(c *C, ctx *context) { |
837 m, err := ctx.st.Machine(sm.machineId) | 837 m, err := ctx.st.Machine(sm.machineId) |
838 c.Assert(err, IsNil) | 838 c.Assert(err, IsNil) |
839 » inst, md := testing.StartInstance(c, ctx.conn.Environ, m.Id()) | 839 » inst, hc := testing.StartInstance(c, ctx.conn.Environ, m.Id()) |
840 » err = m.SetProvisioned(inst.Id(), "fake_nonce", md) | 840 » err = m.SetProvisioned(inst.Id(), "fake_nonce", hc) |
841 c.Assert(err, IsNil) | 841 c.Assert(err, IsNil) |
842 } | 842 } |
843 | 843 |
844 type startMissingMachine struct { | 844 type startMissingMachine struct { |
845 machineId string | 845 machineId string |
846 } | 846 } |
847 | 847 |
848 func (sm startMissingMachine) step(c *C, ctx *context) { | 848 func (sm startMissingMachine) step(c *C, ctx *context) { |
849 m, err := ctx.st.Machine(sm.machineId) | 849 m, err := ctx.st.Machine(sm.machineId) |
850 c.Assert(err, IsNil) | 850 c.Assert(err, IsNil) |
851 » _, md := testing.StartInstance(c, ctx.conn.Environ, m.Id()) | 851 » _, hc := testing.StartInstance(c, ctx.conn.Environ, m.Id()) |
852 » err = m.SetProvisioned("i-missing", "fake_nonce", md) | 852 » err = m.SetProvisioned("i-missing", "fake_nonce", hc) |
853 c.Assert(err, IsNil) | 853 c.Assert(err, IsNil) |
854 } | 854 } |
855 | 855 |
856 type startAliveMachine struct { | 856 type startAliveMachine struct { |
857 machineId string | 857 machineId string |
858 } | 858 } |
859 | 859 |
860 func (sam startAliveMachine) step(c *C, ctx *context) { | 860 func (sam startAliveMachine) step(c *C, ctx *context) { |
861 m, err := ctx.st.Machine(sam.machineId) | 861 m, err := ctx.st.Machine(sam.machineId) |
862 c.Assert(err, IsNil) | 862 c.Assert(err, IsNil) |
863 pinger, err := m.SetAgentAlive() | 863 pinger, err := m.SetAgentAlive() |
864 c.Assert(err, IsNil) | 864 c.Assert(err, IsNil) |
865 ctx.st.StartSync() | 865 ctx.st.StartSync() |
866 err = m.WaitAgentAlive(200 * time.Millisecond) | 866 err = m.WaitAgentAlive(200 * time.Millisecond) |
867 c.Assert(err, IsNil) | 867 c.Assert(err, IsNil) |
868 agentAlive, err := m.AgentAlive() | 868 agentAlive, err := m.AgentAlive() |
869 c.Assert(err, IsNil) | 869 c.Assert(err, IsNil) |
870 c.Assert(agentAlive, Equals, true) | 870 c.Assert(agentAlive, Equals, true) |
871 » inst, md := testing.StartInstance(c, ctx.conn.Environ, m.Id()) | 871 » inst, hc := testing.StartInstance(c, ctx.conn.Environ, m.Id()) |
872 » err = m.SetProvisioned(inst.Id(), "fake_nonce", md) | 872 » err = m.SetProvisioned(inst.Id(), "fake_nonce", hc) |
873 c.Assert(err, IsNil) | 873 c.Assert(err, IsNil) |
874 ctx.pingers[m.Id()] = pinger | 874 ctx.pingers[m.Id()] = pinger |
875 } | 875 } |
876 | 876 |
877 type setTools struct { | 877 type setTools struct { |
878 machineId string | 878 machineId string |
879 tools *state.Tools | 879 tools *state.Tools |
880 } | 880 } |
881 | 881 |
882 func (st setTools) step(c *C, ctx *context) { | 882 func (st setTools) step(c *C, ctx *context) { |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 for i, t := range statusTests { | 1118 for i, t := range statusTests { |
1119 c.Logf("test %d: %s", i, t.summary) | 1119 c.Logf("test %d: %s", i, t.summary) |
1120 func() { | 1120 func() { |
1121 // Prepare context and run all steps to setup. | 1121 // Prepare context and run all steps to setup. |
1122 ctx := s.newContext() | 1122 ctx := s.newContext() |
1123 defer s.resetContext(c, ctx) | 1123 defer s.resetContext(c, ctx) |
1124 ctx.run(c, t.steps) | 1124 ctx.run(c, t.steps) |
1125 }() | 1125 }() |
1126 } | 1126 } |
1127 } | 1127 } |
LEFT | RIGHT |