@@ -48,6 +48,27 @@ function DocumentOperationsFailuresSuite() {
4848 internal . debugClearFailAt ( ) ;
4949 db . _drop ( cn ) ;
5050 } ,
51+
52+ testInsertSizeLimit : function ( ) {
53+ let c = db . _create ( cn ) ;
54+
55+ internal . debugSetFailAt ( "addOperationSizeError" ) ;
56+
57+ try {
58+ c . insert ( { _key : "testi" } ) ;
59+ fail ( ) ;
60+ } catch ( e ) {
61+ // Validate that we died with debug
62+ assertEqual ( e . errorNum , ERRORS . ERROR_RESOURCE_LIMIT . code ) ;
63+ }
64+
65+ assertEqual ( 0 , c . count ( ) ) ;
66+
67+ internal . debugClearFailAt ( ) ;
68+
69+ c . insert ( { _key : "testi" } ) ;
70+ assertEqual ( 1 , c . count ( ) ) ;
71+ } ,
5172
5273 testInsertFailure1 : function ( ) {
5374 let c = db . _create ( cn ) ;
@@ -91,6 +112,28 @@ function DocumentOperationsFailuresSuite() {
91112 assertEqual ( 1 , c . count ( ) ) ;
92113 } ,
93114
115+ testRemoveSizeLimit : function ( ) {
116+ let c = db . _create ( cn ) ;
117+ c . insert ( { _key : "testi" } ) ;
118+
119+ internal . debugSetFailAt ( "addOperationSizeError" ) ;
120+
121+ try {
122+ c . remove ( "testi" ) ;
123+ fail ( ) ;
124+ } catch ( e ) {
125+ // Validate that we died with debug
126+ assertEqual ( e . errorNum , ERRORS . ERROR_RESOURCE_LIMIT . code ) ;
127+ }
128+
129+ assertEqual ( 1 , c . count ( ) ) ;
130+
131+ internal . debugClearFailAt ( ) ;
132+
133+ c . remove ( "testi" ) ;
134+ assertEqual ( 0 , c . count ( ) ) ;
135+ } ,
136+
94137 testRemoveFailure1 : function ( ) {
95138 let c = db . _create ( cn ) ;
96139 c . insert ( { _key : "testi" } ) ;
@@ -135,6 +178,30 @@ function DocumentOperationsFailuresSuite() {
135178 assertEqual ( 0 , c . count ( ) ) ;
136179 } ,
137180
181+ testModifySizeLimit : function ( ) {
182+ let c = db . _create ( cn ) ;
183+ c . insert ( { _key : "testi" , value : 1 } ) ;
184+
185+ internal . debugSetFailAt ( "addOperationSizeError" ) ;
186+
187+ try {
188+ c . update ( "testi" , { value : 2 } ) ;
189+ fail ( ) ;
190+ } catch ( e ) {
191+ // Validate that we died with debug
192+ assertEqual ( e . errorNum , ERRORS . ERROR_RESOURCE_LIMIT . code ) ;
193+ }
194+
195+ assertEqual ( 1 , c . count ( ) ) ;
196+ assertEqual ( 1 , c . document ( "testi" ) . value ) ;
197+
198+ internal . debugClearFailAt ( ) ;
199+
200+ c . update ( "testi" , { value : 3 } ) ;
201+ assertEqual ( 1 , c . count ( ) ) ;
202+ assertEqual ( 3 , c . document ( "testi" ) . value ) ;
203+ } ,
204+
138205 testModifyFailure1 : function ( ) {
139206 let c = db . _create ( cn ) ;
140207 c . insert ( { _key : "testi" , value : 1 } ) ;
0 commit comments