liquibase-mongodb icon indicating copy to clipboard operation
liquibase-mongodb copied to clipboard

MongoStatementIT#testCreateIndexChange fails silently

Open jmayday opened this issue 2 years ago • 0 comments

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"}

obraz

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>

jmayday avatar Aug 24 '22 11:08 jmayday