forked from scaleway/scaleway-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(lb): add support for private network in lb resource (scaleway#917)
* feat(lb-pn): add private network to lb * feat(lb-pn): remote lb private network * feat(lb-pn): add static_config test * feat(lb-pn): update all lb cassettes * feat(lb-pn): update all lb cassettes * feat(lb-pn): set zone schema * Update scaleway/resource_lb.go Co-authored-by: Rémy Léone <remy.leone@gmail.com> * feat(lb-pn): add wait private network state, update for private networks, test update * feat(lb-pn): add wait private network state, update for private networks, test update * feat(lb): update selector * feat(lb-pn): remove trailing number * feat(lb-pn): simplify static config check helper Co-authored-by: Rémy Léone <remy.leone@gmail.com>
- Loading branch information
Showing
21 changed files
with
7,840 additions
and
5,395 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package scaleway | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/scaleway/scaleway-sdk-go/api/lb/v1" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestIsEqualPrivateNetwork(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
A *lb.PrivateNetwork | ||
B *lb.PrivateNetwork | ||
expected bool | ||
}{ | ||
{ | ||
name: "isEqualDHCP", | ||
A: &lb.PrivateNetwork{PrivateNetworkID: "6ba7b810-9dad-11d1-80b4-00c04fd430c8", DHCPConfig: &lb.PrivateNetworkDHCPConfig{}}, | ||
B: &lb.PrivateNetwork{PrivateNetworkID: "6ba7b810-9dad-11d1-80b4-00c04fd430c8", DHCPConfig: &lb.PrivateNetworkDHCPConfig{}}, | ||
expected: true, | ||
}, | ||
{ | ||
name: "isEqualStatic", | ||
A: &lb.PrivateNetwork{PrivateNetworkID: "6ba7b810-9dad-11d1-80b4-00c04fd430c8", StaticConfig: &lb.PrivateNetworkStaticConfig{IPAddress: []string{"172.16.0.100", "172.16.0.101"}}}, | ||
B: &lb.PrivateNetwork{PrivateNetworkID: "6ba7b810-9dad-11d1-80b4-00c04fd430c8", StaticConfig: &lb.PrivateNetworkStaticConfig{IPAddress: []string{"172.16.0.100", "172.16.0.101"}}}, | ||
expected: true, | ||
}, | ||
{ | ||
name: "areNotEqualStatic", | ||
A: &lb.PrivateNetwork{PrivateNetworkID: "6ba7b810-9dad-11d1-80b4-00c04fd430c8", StaticConfig: &lb.PrivateNetworkStaticConfig{IPAddress: []string{"172.16.0.100", "172.16.0.101"}}}, | ||
B: &lb.PrivateNetwork{PrivateNetworkID: "6ba7b810-9dad-11d1-80b4-00c04fd430c8", StaticConfig: &lb.PrivateNetworkStaticConfig{IPAddress: []string{"172.16.0.101", "172.16.0.101"}}}, | ||
expected: false, | ||
}, | ||
{ | ||
name: "areNotEqualDHCPToStatic", | ||
A: &lb.PrivateNetwork{PrivateNetworkID: "6ba7b810-9dad-11d1-80b4-00c04fd430c8", DHCPConfig: &lb.PrivateNetworkDHCPConfig{}}, | ||
B: &lb.PrivateNetwork{PrivateNetworkID: "6ba7b810-9dad-11d1-80b4-00c04fd430c8", StaticConfig: &lb.PrivateNetworkStaticConfig{IPAddress: []string{"172.16.0.101", "172.16.0.101"}}}, | ||
expected: false, | ||
}, | ||
{ | ||
name: "areNotEqualDHCPToStatic", | ||
A: &lb.PrivateNetwork{PrivateNetworkID: "6ba7b810-9dad-11d1-80b4-00c04fd430c8", StaticConfig: &lb.PrivateNetworkStaticConfig{IPAddress: []string{"172.16.0.101", "172.16.0.101"}}}, | ||
B: &lb.PrivateNetwork{PrivateNetworkID: "6ba7b810-9dad-11d1-80b4-00c04fd430c8", DHCPConfig: &lb.PrivateNetworkDHCPConfig{}}, | ||
expected: false, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
assert.Equal(t, tt.expected, isPrivateNetworkEqual(tt.A, tt.B)) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.