@@ -3,9 +3,9 @@ package rdb_test
33import (
44 "testing"
55
6- "github.com/scaleway/scaleway-cli/v2/internal/namespaces/rdb/v1"
7-
6+ "github.com/alecthomas/assert"
87 "github.com/scaleway/scaleway-cli/v2/internal/core"
8+ "github.com/scaleway/scaleway-cli/v2/internal/namespaces/rdb/v1"
99)
1010
1111func Test_AddACL (t * testing.T ) {
@@ -113,11 +113,13 @@ func Test_SetACL(t *testing.T) {
113113 t .Run ("Simple" , core .Test (& core.TestConfig {
114114 Commands : rdb .GetCommands (),
115115 BeforeFunc : createInstance ("PostgreSQL-12" ),
116- Cmd : "scw rdb acl set rules.0.ip= 1.2.3.4 instance-id={{ .Instance.ID }} --wait" ,
116+ Cmd : "scw rdb acl set 1.2.3.4 instance-id={{ .Instance.ID }} descriptions.0=something --wait" ,
117117 Check : core .TestCheckCombine (
118118 core .TestCheckGolden (),
119119 func (t * testing.T , ctx * core.CheckFuncCtx ) {
120120 verifyACL (ctx , t , []string {"1.2.3.4/32" })
121+ acls := ctx .Result .(* rdb.CustomACLResult ).Rules
122+ assert .Equal (t , "something" , acls [0 ].Description )
121123 },
122124 ),
123125 AfterFunc : deleteInstance (),
@@ -129,11 +131,22 @@ func Test_SetACL(t *testing.T) {
129131 createInstance ("PostgreSQL-12" ),
130132 core .ExecBeforeCmd ("scw rdb acl add 1.2.3.4 192.168.1.0/32 10.10.10.10 instance-id={{ .Instance.ID }} --wait" ),
131133 ),
132- Cmd : "scw rdb acl set rules.0.ip= 1.2.3.4 rules.1.ip= 192.168.1.0/31 rules.2.ip= 11.11.11.11 instance-id={{ .Instance.ID }} --wait" ,
134+ Cmd : "scw rdb acl set 1.2.3.4 192.168.1.0/31 11.11.11.11 instance-id={{ .Instance.ID }} descriptions.0=first descriptions.1=second descriptions.2=third --wait" ,
133135 Check : core .TestCheckCombine (
134136 core .TestCheckGolden (),
135137 func (t * testing.T , ctx * core.CheckFuncCtx ) {
136138 verifyACL (ctx , t , []string {"1.2.3.4/32" , "192.168.1.0/31" , "11.11.11.11/32" })
139+ acls := ctx .Result .(* rdb.CustomACLResult ).Rules
140+ for _ , acl := range acls {
141+ switch acl .IP .String () {
142+ case "1.2.3.4/32" :
143+ assert .Equal (t , "first" , acl .Description )
144+ case "192.168.1.0/31" :
145+ assert .Equal (t , "second" , acl .Description )
146+ case "11.11.11.11/32" :
147+ assert .Equal (t , "third" , acl .Description )
148+ }
149+ }
137150 },
138151 ),
139152 AfterFunc : deleteInstance (),
0 commit comments