@@ -33,7 +33,7 @@ var ListExpected = []instanceactions.InstanceAction{
3333 },
3434}
3535
36- // HandleAddressListSuccessfully sets up the test server to respond to a ListAddresses request.
36+ // HandleInstanceActionListSuccessfully sets up the test server to respond to a ListAddresses request.
3737func HandleInstanceActionListSuccessfully (t * testing.T ) {
3838 th .Mux .HandleFunc ("/servers/asdfasdfasdf/os-instance-actions" , func (w http.ResponseWriter , r * http.Request ) {
3939 th .TestMethod (t , r , "GET" )
@@ -65,15 +65,32 @@ func HandleInstanceActionListSuccessfully(t *testing.T) {
6565 })
6666}
6767
68+ var (
69+ expectedUpdateAt = time .Date (2018 , 04 , 25 , 1 , 26 , 36 , 0 , time .UTC )
70+ expectedEventHost = "compute"
71+ expectedEventHostID = "2091634baaccdc4c5a1d57069c833e402921df696b7f970791b12ec6"
72+ expectedEvents = []instanceactions.Event {{
73+ Event : "compute_stop_instance" ,
74+ Host : & expectedEventHost ,
75+ HostID : & expectedEventHostID ,
76+ Result : "Success" ,
77+ StartTime : time .Date (2018 , 04 , 25 , 1 , 26 , 36 , 0 , time .UTC ),
78+ FinishTime : time .Date (2018 , 04 , 25 , 1 , 26 , 36 , 0 , time .UTC ),
79+ Traceback : "" ,
80+ }}
81+ )
82+
6883// GetExpected represents an expected repsonse from a Get request.
69- var GetExpected = instanceactions.InstanceAction {
84+ var GetExpected = instanceactions.InstanceActionDetail {
7085 Action : "stop" ,
71- InstanceUUID : "fcd19ef2-b593-40b1-90a5-fc31063fa95c " ,
86+ InstanceUUID : "4bf3473b-d550-4b65-9409-292d44ab14a2 " ,
7287 Message : "" ,
7388 ProjectID : "6f70656e737461636b20342065766572" ,
74- RequestID : "req-f8a59f03-76dc-412f-92c2-21f8612be728" ,
75- StartTime : time .Date (2018 , 04 , 25 , 1 , 26 , 29 , 000000 , time .UTC ),
89+ RequestID : "req-0d819d5c-1527-4669-bdf0-ffad31b5105b" ,
90+ StartTime : time .Date (2018 , 04 , 25 , 1 , 26 , 36 , 0 , time .UTC ),
91+ UpdatedAt : & expectedUpdateAt ,
7692 UserID : "admin" ,
93+ Events : & expectedEvents ,
7794}
7895
7996// HandleInstanceActionGetSuccessfully sets up the test server to respond to a Get request.
@@ -85,15 +102,27 @@ func HandleInstanceActionGetSuccessfully(t *testing.T) {
85102 w .Header ().Add ("Content-Type" , "application/json" )
86103 fmt .Fprintf (w , `{
87104 "instanceAction":
88- {
89- "action": "stop",
90- "instance_uuid": "fcd19ef2-b593-40b1-90a5-fc31063fa95c",
91- "message": null,
92- "project_id": "6f70656e737461636b20342065766572",
93- "request_id": "req-f8a59f03-76dc-412f-92c2-21f8612be728",
94- "start_time": "2018-04-25T01:26:29.000000",
95- "user_id": "admin"
96- }
105+ {
106+ "action": "stop",
107+ "events": [
108+ {
109+ "event": "compute_stop_instance",
110+ "finish_time": "2018-04-25T01:26:36.00000",
111+ "host": "compute",
112+ "hostId": "2091634baaccdc4c5a1d57069c833e402921df696b7f970791b12ec6",
113+ "result": "Success",
114+ "start_time": "2018-04-25T01:26:36.00000",
115+ "traceback": null
116+ }
117+ ],
118+ "instance_uuid": "4bf3473b-d550-4b65-9409-292d44ab14a2",
119+ "message": null,
120+ "project_id": "6f70656e737461636b20342065766572",
121+ "request_id": "req-0d819d5c-1527-4669-bdf0-ffad31b5105b",
122+ "start_time": "2018-04-25T01:26:36.00000",
123+ "updated_at": "2018-04-25T01:26:36.00000",
124+ "user_id": "admin"
125+ }
97126 }` )
98127 })
99128}
0 commit comments