| 1 | package ecs |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "github.com/denverdino/aliyungo/common" |
| 7 | ) |
| 8 | |
| 9 | func testVRouter(t *testing.T, client *Client, regionId common.Region, vpcId string, vrouterId string, instanceId string) { |
| 10 | |
| 11 | newName := "My_Aliyun_test_VRouter" |
| 12 | |
| 13 | modifyArgs := ModifyVRouterAttributeArgs{ |
| 14 | VRouterId: vrouterId, |
| 15 | VRouterName: newName, |
| 16 | Description: newName, |
| 17 | } |
| 18 | |
| 19 | err := client.ModifyVRouterAttribute(&modifyArgs) |
| 20 | if err != nil { |
| 21 | t.Errorf("Failed to modify VRouters: %v", err) |
| 22 | } |
| 23 | |
| 24 | args := DescribeVRoutersArgs{ |
| 25 | VRouterId: vrouterId, |
| 26 | RegionId: regionId, |
| 27 | } |
| 28 | |
| 29 | vrouters, _, err := client.DescribeVRouters(&args) |
| 30 | if err != nil { |
| 31 | t.Errorf("Failed to describe VRouters: %v", err) |
| 32 | } |
| 33 | t.Logf("VRouters: %++v", vrouters) |
| 34 | if vrouters[0].VRouterName != newName { |
| 35 | t.Errorf("Failed to modify VRouters with new name: %s", newName) |
| 36 | } |
| 37 | |
| 38 | testRouteTable(t, client, regionId, vpcId, vrouterId, vrouters[0].RouteTableIds.RouteTableId[0], instanceId) |
| 39 | |
| 40 | } |