vrouters_test.go 949 B

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