Add test for alter with bad field type.

This commit is contained in:
Kishore Nallan 2022-05-07 21:00:57 +05:30
parent 284c3d0dc7
commit 3e08b7d556

View File

@ -465,6 +465,17 @@ TEST_F(CollectionSchemaChangeTest, AlterValidations) {
ASSERT_FALSE(alter_op.ok());
ASSERT_EQ("Only `fields` can be updated at the moment.",alter_op.error());
// 9. bad datatype in alter
schema_changes = R"({
"fields": [
{"name": "title", "drop": true},
{"name": "title", "type": "foobar"}
]
})"_json;
alter_op = coll1->alter(schema_changes);
ASSERT_FALSE(alter_op.ok());
ASSERT_EQ("Field `title` has an invalid data type `foobar`, see docs for supported data types.",alter_op.error());
collectionManager.drop_collection("coll1");
}