Skip to content

Commit

Permalink
Unearthed a nice li'l bug during migration on london
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixMcFelix committed Jun 26, 2024
1 parent 70263a2 commit 62de75e
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
46 changes: 45 additions & 1 deletion nexus/db-queries/src/db/datastore/vpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2482,7 +2482,7 @@ mod tests {
.await;

// Add another, and get another route.
let (_, sub1) = new_subnet_ez(
let (authz_sub1, sub1) = new_subnet_ez(
&opctx,
&datastore,
&db_vpc,
Expand Down Expand Up @@ -2536,6 +2536,50 @@ mod tests {
)
.await;

// If we use a reserved name, we should be able to update the table.
let sub1 = datastore
.vpc_update_subnet(
&opctx,
&authz_sub1,
VpcSubnetUpdate {
name: Some(
"default-v4".parse::<external::Name>().unwrap().into(),
),
description: None,
time_modified: Utc::now(),
},
)
.await
.unwrap();

verify_all_subnet_routes_in_router(
&opctx,
&datastore,
db_router.id(),
&[&sub1],
)
.await;

// Ditto for adding such a route.
let (_, sub0) = new_subnet_ez(
&opctx,
&datastore,
&db_vpc,
&authz_vpc,
"default-v6",
[172, 30, 0, 0],
22,
)
.await;

verify_all_subnet_routes_in_router(
&opctx,
&datastore,
db_router.id(),
&[&sub0, &sub1],
)
.await;

db.cleanup().await.unwrap();
logctx.cleanup_successful();
}
Expand Down
2 changes: 1 addition & 1 deletion schema/crdb/vpc-subnet-routing/up03.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ SELECT
gen_random_uuid(), vpc_subnet.name,
'VPC Subnet route for ''' || vpc_subnet.name || '''',
now(), now(),
omicron.public.vpc_router.id, 'default',
omicron.public.vpc_router.id, 'vpc_subnet',
'subnet:' || vpc_subnet.name, 'subnet:' || vpc_subnet.name
FROM
(omicron.public.vpc_subnet JOIN omicron.public.vpc
Expand Down

0 comments on commit 62de75e

Please sign in to comment.