File: vrouters_test.go

package info (click to toggle)
golang-github-denverdino-aliyungo 0.0~git20180921.13fa8aa-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 1,824 kB
  • sloc: xml: 1,359; makefile: 3
file content (40 lines) | stat: -rw-r--r-- 949 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package ecs

import (
	"testing"

	"github.com/denverdino/aliyungo/common"
)

func testVRouter(t *testing.T, client *Client, regionId common.Region, vpcId string, vrouterId string, instanceId string) {

	newName := "My_Aliyun_test_VRouter"

	modifyArgs := ModifyVRouterAttributeArgs{
		VRouterId:   vrouterId,
		VRouterName: newName,
		Description: newName,
	}

	err := client.ModifyVRouterAttribute(&modifyArgs)
	if err != nil {
		t.Errorf("Failed to modify VRouters: %v", err)
	}

	args := DescribeVRoutersArgs{
		VRouterId: vrouterId,
		RegionId:  regionId,
	}

	vrouters, _, err := client.DescribeVRouters(&args)
	if err != nil {
		t.Errorf("Failed to describe VRouters: %v", err)
	}
	t.Logf("VRouters: %++v", vrouters)
	if vrouters[0].VRouterName != newName {
		t.Errorf("Failed to modify VRouters with new name: %s", newName)
	}

	testRouteTable(t, client, regionId, vpcId, vrouterId, vrouters[0].RouteTableIds.RouteTableId[0], instanceId)

}