Skip to content

Commit 94795f0

Browse files
authored
Merge pull request #658 from l1b0k/main
fix: requested ip count
2 parents 0329274 + 5bbd590 commit 94795f0

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

pkg/aliyun/client/ecs_options.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ func (c *CreateNetworkInterfaceOptions) ApplyCreateNetworkInterface(options *Cre
5858
if c.NetworkInterfaceOptions.SecurityGroupIDs != nil {
5959
options.NetworkInterfaceOptions.SecurityGroupIDs = c.NetworkInterfaceOptions.SecurityGroupIDs
6060
}
61-
if c.NetworkInterfaceOptions.IPCount > 1 {
61+
if c.NetworkInterfaceOptions.IPCount >= 1 {
6262
options.NetworkInterfaceOptions.IPCount = c.NetworkInterfaceOptions.IPCount
6363
}
6464

65-
if c.NetworkInterfaceOptions.IPv6Count > 1 {
65+
if c.NetworkInterfaceOptions.IPv6Count >= 1 {
6666
options.NetworkInterfaceOptions.IPv6Count = c.NetworkInterfaceOptions.IPv6Count
6767
}
6868
if c.NetworkInterfaceOptions.Tags != nil {

pkg/aliyun/client/ecs_options_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package client
33
import (
44
"testing"
55

6+
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
67
"github.com/stretchr/testify/assert"
78
"k8s.io/apimachinery/pkg/util/wait"
89
)
@@ -56,6 +57,8 @@ func TestCreateNetworkInterfaceOptions_Finish(t *testing.T) {
5657
assert.Equal(t, niOptions.ResourceGroupID, req.ResourceGroupId)
5758
assert.Equal(t, eniDescription, req.Description)
5859
assert.Equal(t, "mockToken", req.ClientToken)
60+
assert.Equal(t, requests.NewInteger(1), req.SecondaryPrivateIpAddressCount)
61+
assert.Equal(t, requests.NewInteger(1), req.Ipv6AddressCount)
5962
assert.NotNil(t, c.Backoff)
6063

6164
// Cleanup
@@ -87,6 +90,7 @@ func TestCreateNetworkInterfaceOptions_ApplyCreateNetworkInterface(t *testing.T)
8790
Trunk: true,
8891
ERDMA: true,
8992
IPCount: 2,
93+
IPv6Count: 1,
9094
},
9195
},
9296
args: args{
@@ -102,7 +106,7 @@ func TestCreateNetworkInterfaceOptions_ApplyCreateNetworkInterface(t *testing.T)
102106
SecurityGroupIDs: []string{"sg-xxxxxx"},
103107
ResourceGroupID: "rg-xxxxxx",
104108
IPCount: 2,
105-
IPv6Count: 0,
109+
IPv6Count: 1,
106110
Tags: map[string]string{"key1": "value1", "key2": "value2"},
107111
InstanceID: "",
108112
InstanceType: "",

0 commit comments

Comments
 (0)