test(router): service limit error messages
Assert the user-facing service limit error messages.
@@ -560,7 +560,10 @@ where
mod tests {
use super::*;
use crate::{
- dml_handlers::mock::{MockDmlHandler, MockDmlHandlerCall},
+ dml_handlers::{
+ mock::{MockDmlHandler, MockDmlHandlerCall},
+ CachedServiceProtectionLimit,
+ },
namespace_resolver::{mock::MockNamespaceResolver, NamespaceCreationError},
};
use assert_matches::assert_matches;
@@ -1527,5 +1530,26 @@ mod tests {
RequestLimit,
"this service is overloaded, please try again later",
),
+
+ (
+ DmlHandler(DmlError::Schema(SchemaError::ServiceLimit(Box::new(CachedServiceProtectionLimit::Column {
+ table_name: "bananas".to_string(),
+ existing_column_count: 42,
+ merged_column_count: 4242,
+ max_columns_per_table: 24,
+ })))),
+ "dml handler error: service limit reached: couldn't create columns in table `bananas`; table contains 42 \
+ existing columns, applying this write would result in 4242 columns, limit is 24",
+ ),
+
+ (
+ DmlHandler(DmlError::Schema(SchemaError::ServiceLimit(Box::new(CachedServiceProtectionLimit::Table {
+ existing_table_count: 42,
+ merged_table_count: 4242,
+ table_count_limit: 24,
+ })))),
+ "dml handler error: service limit reached: couldn't create new table; namespace contains 42 existing \
+ tables, applying this write would result in 4242 columns, limit is 24",
+ ),
}
}
