blob: c0191f1fee1616682e1bd184fe32e091a66295f6 [file] [log] [blame]
Samuel A. Falvo II2dd7d2f2014-06-30 16:18:08 -07001// +build acceptance,old
2
Samuel A. Falvo II72ac2dd2013-07-31 13:45:05 -07003package main
4
5import (
Samuel A. Falvo II72ac2dd2013-07-31 13:45:05 -07006 "flag"
Jon Perritt2be65d12013-12-13 17:21:09 -06007 "fmt"
Max Lincoln28b49562013-12-13 13:23:44 -03008 "github.com/rackspace/gophercloud"
Samuel A. Falvo II72ac2dd2013-07-31 13:45:05 -07009)
10
11var quiet = flag.Bool("quiet", false, "Quiet mode, for acceptance testing. $? still indicates errors though.")
12
13func main() {
14 flag.Parse()
15 withIdentity(false, func(acc gophercloud.AccessProvider) {
16 withServerApi(acc, func(servers gophercloud.CloudServersProvider) {
17 log("Creating server")
18 id, err := createServer(servers, "", "", "", "")
19 if err != nil {
20 panic(err)
21 }
22 waitForServerState(servers, id, "ACTIVE")
23 defer servers.DeleteServerById(id)
24
25 log("Updating name of server")
26 newName := randomString("ACPTTEST", 32)
27 newDetails, err := servers.UpdateServer(id, gophercloud.NewServerSettings{
28 Name: newName,
29 })
30 if err != nil {
31 panic(err)
32 }
33 if newDetails.Name != newName {
34 panic("Name change didn't appear to take")
35 }
36
37 log("Done")
38 })
39 })
40}
41
42func log(s string) {
43 if !*quiet {
44 fmt.Println(s)
45 }
46}