@@ -1548,6 +1548,37 @@ async fn test_ephemeral_ip_ip_version_conflict(
15481548 ) ;
15491549}
15501550
1551+ /// Test that specifying both `pool` and IP version where the pool's version
1552+ /// doesn't match the requested version returns an error.
1553+ #[ nexus_test]
1554+ async fn test_ephemeral_ip_pool_version_mismatch (
1555+ cptestctx : & ControlPlaneTestContext ,
1556+ ) {
1557+ let client = & cptestctx. external_client ;
1558+
1559+ // Create default IPv4 pool
1560+ create_default_ip_pool ( & client) . await ;
1561+ create_project ( & client, PROJECT_NAME ) . await ;
1562+ instance_for_external_ips ( client, INSTANCE_NAMES [ 0 ] , false , false , & [ ] )
1563+ . await ;
1564+
1565+ let url = instance_ephemeral_ip_url ( INSTANCE_NAMES [ 0 ] , PROJECT_NAME ) ;
1566+
1567+ // Request IPv6 from the IPv4 pool -> should fail
1568+ NexusRequest :: new (
1569+ RequestBuilder :: new ( client, Method :: POST , & url)
1570+ . body ( Some ( & params:: EphemeralIpCreate {
1571+ pool : Some ( NameOrId :: Name ( "default" . parse ( ) . unwrap ( ) ) ) ,
1572+ ip_version : Some ( views:: IpVersion :: V6 ) ,
1573+ } ) )
1574+ . expect_status ( Some ( StatusCode :: BAD_REQUEST ) ) ,
1575+ )
1576+ . authn_as ( AuthnMode :: PrivilegedUser )
1577+ . execute ( )
1578+ . await
1579+ . unwrap ( ) ;
1580+ }
1581+
15511582#[ nexus_test]
15521583async fn can_list_instance_snat_ip ( cptestctx : & ControlPlaneTestContext ) {
15531584 let client = & cptestctx. external_client ;
0 commit comments