@@ -23,7 +23,10 @@ test('IP pool list', async ({ page }) => {
2323 await expect ( table . getByRole ( 'row' ) ) . toHaveCount ( 5 ) // header + 4 rows
2424
2525 await expectRowVisible ( table , { name : 'ip-pool-1' , Utilization : '6 / 24' } )
26- await expectRowVisible ( table , { name : 'ip-pool-2' , Utilization : '0 / 6' } )
26+ await expectRowVisible ( table , {
27+ name : 'ip-pool-2' ,
28+ Utilization : 'v4' + '0 / 0' + 'v6' + '0 / 32' ,
29+ } )
2730 await expectRowVisible ( table , { name : 'ip-pool-3' , Utilization : '0 / 0' } )
2831 await expectRowVisible ( table , {
2932 name : 'ip-pool-4' ,
@@ -133,12 +136,13 @@ test('IP pool create', async ({ page }) => {
133136} )
134137
135138test ( 'IP range validation and add' , async ( { page } ) => {
136- await page . goto ( '/system/networking/ip-pools/ip-pool-1 ' )
139+ await page . goto ( '/system/networking/ip-pools/ip-pool-2 ' )
137140
138141 // check the utilization bar
139- await expect ( page . getByText ( 'IPv4(IPs)25%' ) ) . toBeVisible ( )
140- await expect ( page . getByText ( 'Allocated6' ) ) . toBeVisible ( )
141- await expect ( page . getByText ( 'Capacity24' ) ) . toBeVisible ( )
142+ await expect ( page . getByText ( 'IPv4(IPs)' ) ) . toBeHidden ( )
143+ await expect ( page . getByText ( 'IPv6(IPs)0%' ) ) . toBeVisible ( )
144+ await expect ( page . getByText ( 'Allocated0' ) ) . toBeVisible ( )
145+ await expect ( page . getByText ( 'Capacity32' ) ) . toBeVisible ( )
142146
143147 await page . getByRole ( 'link' , { name : 'Add range' } ) . click ( )
144148
@@ -148,10 +152,9 @@ test('IP range validation and add', async ({ page }) => {
148152 const submit = dialog . getByRole ( 'button' , { name : 'Add IP range' } )
149153 const invalidMsg = dialog . getByText ( 'Not a valid IP address' )
150154 // exact to differentiate from same text in help message at the top of the form
151- const sameVersionMsg = dialog . getByText ( 'First and last must be the same version' , {
152- exact : true ,
153- } )
155+ const ipv6Msg = dialog . getByText ( 'IPv6 ranges are not yet supported' )
154156
157+ const v4Addr = '192.1.2.3'
155158 const v6Addr = '2001:db8::1234:5678'
156159
157160 await expect ( dialog ) . toBeVisible ( )
@@ -162,50 +165,41 @@ test('IP range validation and add', async ({ page }) => {
162165
163166 await expect ( invalidMsg ) . toHaveCount ( 2 )
164167
165- // fix last
166- await last . fill ( '123.4.56.7' )
167-
168- // first is still bad
168+ // change last to v6, not allowed
169+ await last . fill ( v6Addr )
169170 await expect ( invalidMsg ) . toHaveCount ( 1 )
171+ await expect ( ipv6Msg ) . toHaveCount ( 1 )
170172
171- // change first to a valid ipv6
173+ // change first to v6, still not allowed
172174 await first . fill ( v6Addr )
173-
174- // now we get the error about the same version on first because it has had
175- // an error, so it is now validating onChange, but it doesn't show up on last
176- // until we try to submit
177- await expect ( sameVersionMsg ) . toHaveCount ( 1 )
175+ await expect ( ipv6Msg ) . toHaveCount ( 2 )
178176 await expect ( invalidMsg ) . toBeHidden ( )
179177
180- await submit . click ( )
181- await expect ( sameVersionMsg ) . toHaveCount ( 2 )
182-
183- // now make last also a v6 and we're good
184- await last . fill ( v6Addr )
185-
186- // actually first's error doesn't disappear until we blur it or submit
187- await expect ( sameVersionMsg ) . toHaveCount ( 1 )
188- await expect ( invalidMsg ) . toBeHidden ( )
178+ // now make first v4, then last
179+ await first . fill ( v4Addr )
180+ await expect ( ipv6Msg ) . toHaveCount ( 1 )
181+ await last . fill ( v4Addr )
182+ await expect ( ipv6Msg ) . toBeHidden ( )
189183
190184 await submit . click ( )
191185 await expect ( dialog ) . toBeHidden ( )
192186
193187 const table = page . getByRole ( 'table' )
194- await expectRowVisible ( table , { First : v6Addr , Last : v6Addr } )
188+ await expectRowVisible ( table , { First : v4Addr , Last : v4Addr } )
195189
196190 // now the utilization bars are split in two
197- await expect ( page . getByText ( 'IPv4(IPs)25%' ) ) . toBeVisible ( )
198- await expect ( page . getByText ( 'Allocated6' ) ) . toBeVisible ( )
199- await expect ( page . getByText ( 'Capacity24' ) ) . toBeVisible ( )
200- await expect ( page . getByText ( 'IPv6(IPs)0%' ) ) . toBeVisible ( )
201- await expect ( page . getByText ( 'Allocated0' ) ) . toBeVisible ( )
191+ await expect ( page . getByText ( 'IPv4(IPs)0%' ) ) . toBeVisible ( )
192+ await expect ( page . getByText ( 'Allocated0' ) ) . toHaveCount ( 2 )
202193 await expect ( page . getByText ( 'Capacity1' ) ) . toBeVisible ( )
203194
195+ await expect ( page . getByText ( 'IPv6(IPs)0%' ) ) . toBeVisible ( )
196+ await expect ( page . getByText ( 'Capacity32' ) ) . toBeVisible ( )
197+
204198 // go back to the pool and verify the utilization column changed
205199 await page . getByRole ( 'link' , { name : 'Networking' } ) . click ( )
206200 await expectRowVisible ( table , {
207- name : 'ip-pool-1 ' ,
208- Utilization : 'v4' + '6 / 24 ' + 'v6' + '0 / 1 ' ,
201+ name : 'ip-pool-2 ' ,
202+ Utilization : 'v4' + '0 / 1 ' + 'v6' + '0 / 32 ' ,
209203 } )
210204} )
211205
@@ -264,10 +258,14 @@ test('deleting floating IP decrements utilization', async ({ page }) => {
264258} )
265259
266260test ( 'no ranges means no utilization bar' , async ( { page } ) => {
267- await page . goto ( '/system/networking/ip-pools/ip-pool-2 ' )
261+ await page . goto ( '/system/networking/ip-pools/ip-pool-1 ' )
268262 await expect ( page . getByText ( 'IPv4(IPs)' ) ) . toBeVisible ( )
269263 await expect ( page . getByText ( 'IPv6(IPs)' ) ) . toBeHidden ( )
270264
265+ await page . goto ( '/system/networking/ip-pools/ip-pool-2' )
266+ await expect ( page . getByText ( 'IPv4(IPs)' ) ) . toBeHidden ( )
267+ await expect ( page . getByText ( 'IPv6(IPs)' ) ) . toBeVisible ( )
268+
271269 await page . goto ( '/system/networking/ip-pools/ip-pool-3' )
272270 await expect ( page . getByText ( 'IPv4(IPs)' ) ) . toBeHidden ( )
273271 await expect ( page . getByText ( 'IPv6(IPs)' ) ) . toBeHidden ( )
0 commit comments