@@ -39,7 +39,7 @@ describe('#integration-rx summary', () => {
39
39
session = driver . rxSession ( )
40
40
41
41
protocolVersion = await sharedNeo4j . cleanupAndGetProtocolVersion ( driver )
42
- await dropConstraintsAndIndices ( driver )
42
+ await dropConstraintsAndIndices ( driver , protocolVersion )
43
43
} )
44
44
45
45
afterEach ( async ( ) => {
@@ -140,7 +140,7 @@ describe('#integration-rx summary', () => {
140
140
await normalSession . close ( )
141
141
}
142
142
143
- await dropConstraintsAndIndices ( driver )
143
+ await dropConstraintsAndIndices ( driver , protocolVersion )
144
144
} )
145
145
146
146
afterEach ( async ( ) => {
@@ -240,7 +240,7 @@ describe('#integration-rx summary', () => {
240
240
await normalSession . close ( )
241
241
}
242
242
243
- await dropConstraintsAndIndices ( driver )
243
+ await dropConstraintsAndIndices ( driver , protocolVersion )
244
244
} )
245
245
246
246
afterEach ( async ( ) => {
@@ -755,16 +755,22 @@ describe('#integration-rx summary', () => {
755
755
expect ( summary . counters . containsUpdates ( ) ) . toBeFalsy ( )
756
756
}
757
757
758
- async function dropConstraintsAndIndices ( driver ) {
758
+ async function dropConstraintsAndIndices ( driver , protocolVersion ) {
759
759
const session = driver . session ( )
760
760
try {
761
- const constraints = await session . run ( 'CALL db.constraints()' )
761
+ const showConstraints = shouldUseShowConstraints ( protocolVersion )
762
+ ? 'SHOW CONSTRAINTS'
763
+ : 'CALL db.constraints()'
764
+ const constraints = await session . run ( showConstraints )
762
765
for ( let i = 0 ; i < constraints . records . length ; i ++ ) {
763
766
const name = constraints . records [ i ] . toObject ( ) . name
764
767
await session . run ( 'DROP CONSTRAINT ' + name ) // ${getName(constraints.records[i])}`)
765
768
}
766
769
767
- const indices = await session . run ( 'CALL db.indexes()' )
770
+ const showIndexes = shouldUseShowIndexes ( protocolVersion )
771
+ ? 'SHOW INDEXES'
772
+ : 'CALL db.indexes()'
773
+ const indices = await session . run ( showIndexes )
768
774
for ( let i = 0 ; i < indices . records . length ; i ++ ) {
769
775
const name = indices . records [ i ] . toObject ( ) . name
770
776
await session . run ( 'DROP INDEX ' + name ) // ${getName(constraints.records[i])}`)
@@ -777,4 +783,12 @@ describe('#integration-rx summary', () => {
777
783
function isNewConstraintIndexSyntax ( protocolVersion ) {
778
784
return protocolVersion > 4.3
779
785
}
786
+
787
+ function shouldUseShowConstraints ( protocolVersion ) {
788
+ return protocolVersion > 4.2
789
+ }
790
+
791
+ function shouldUseShowIndexes ( protocolVersion ) {
792
+ return protocolVersion > 4.2
793
+ }
780
794
} )
0 commit comments