liquibase-mongodb
liquibase-mongodb copied to clipboard
MongoStatementIT#testCreateIndexChange fails silently
This test fails (silently) when creating index by keys (createIndexNoOptionsTest):
<changeSet id="1" author="alex">
<ext:createIndex collectionName="createIndexTest">
<ext:keys>
{ clientId: 1, type: 1}
</ext:keys>
<ext:options>
{unique: true, name: "ui_tppClientId"}
</ext:options>
</ext:createIndex>
<ext:createIndex collectionName="createIndexNoOptionsTest">
<ext:keys>
{ clientId: 1, type: 1}
</ext:keys>
</ext:createIndex>
</changeSet>
Command failed with error 9 (FailedToParse): 'The 'name' field is a required property of an index specification' on server localhost:27017. The full response is {"ok": 0.0, "errmsg": "The 'name' field is a required property of an index specification", "code": 9, "codeName": "FailedToParse"}
Also, when https://github.com/liquibase/liquibase-mongodb/issues/283 is solved I believe test case with preconditions should be also covered:
<changeSet id="1" author="alex">
<preConditions onFail="MARK_RAN">
<not>
<indexExists indexName="ui_tppClientId"/>
</not>
</preConditions>
<ext:createIndex collectionName="createIndexTest">
<ext:keys>
{ clientId: 1, type: 1}
</ext:keys>
<ext:options>
{unique: true, name: "ui_tppClientId"}
</ext:options>
</ext:createIndex>
<ext:createIndex collectionName="createIndexNoOptionsTest">
<ext:keys>
{ clientId: 1, type: 1}
</ext:keys>
</ext:createIndex>
</changeSet>