Skip to content

Commit

Permalink
Fixed query test cases to only input blob data when server version is…
Browse files Browse the repository at this point in the history
… above 7.0.0
  • Loading branch information
DomPeliniAerospike committed Nov 7, 2023
1 parent 31bb47d commit 602981d
Showing 1 changed file with 28 additions and 34 deletions.
62 changes: 28 additions & 34 deletions test/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,40 +141,6 @@ describe('Queries', function () {
['qidxAggregateMapDoubleNested', 'nested', STRING, MAPKEYS, new Context().addMapKey('doubleNested')]
]

describe('Additional test data', function () {
context('server version 7.0.0 and later', function () {
helper.skipUnlessVersion('>= 7.0.0', this)
it('Adds blob records and indexes', function () {
samples.push({ name: 'blob match', blob: Buffer.from('guava') })
samples.push({ name: 'blob non-match', blob: Buffer.from('pumpkin') })
samples.push({ name: 'blob list match', lblob: [Buffer.from('guava'), Buffer.from('papaya')] })
samples.push({ name: 'blob list non-match', lblob: [Buffer.from('pumpkin'), Buffer.from('turnip')] })
samples.push({ name: 'blob map match', mblob: { a: Buffer.from('guava'), b: Buffer.from('papaya') } })
samples.push({ name: 'blob map non-match', mblob: { a: Buffer.from('pumpkin'), b: Buffer.from('turnip') } })
samples.push({ name: 'blob mapkeys match', mkblob: new Map([[Buffer.from('guava'), 1], [Buffer.from('papaya'), 2]]) })
samples.push({ name: 'blob mapkeys non-match', mkblob: new Map([[Buffer.from('pumpkin'), 3], [Buffer.from('turnip'), 4]]) })
samples.push({ name: 'nested blob match', blob: { nested: Buffer.from('guava') } })
samples.push({ name: 'nested blob non-match', blob: { nested: Buffer.from('pumpkin') } })
samples.push({ name: 'nested blob list match', lblob: { nested: [Buffer.from('guava'), Buffer.from('papaya')] } })
samples.push({ name: 'nested blob list non-match', lblob: { nested: [Buffer.from('pumpkin'), Buffer.from('turnip')] } })
samples.push({ name: 'nested blob map match', mblob: { nested: { a: Buffer.from('guava'), b: Buffer.from('papaya') } } })
samples.push({ name: 'nested blob map non-match', mblob: { nested: { a: Buffer.from('pumpkin'), b: Buffer.from('turnip') } } })
samples.push({ name: 'nested blob mapkeys match', mkblob: { nested: new Map([[Buffer.from('guava'), 1], [Buffer.from('papaya'), 2]]) } })
samples.push({ name: 'nested blob mapkeys non-match', mkblob: { nested: new Map([[Buffer.from('pumpkin'), 3], [Buffer.from('turnip'), 4]]) } })

indexes.push(['qidxBlob', 'blob', BLOB])
indexes.push(['qidxBlobList', 'lblob', BLOB, LIST])
indexes.push(['qidxBlobMap', 'mblob', BLOB, MAPVALUES])
indexes.push(['qidxBlobMapKeys', 'mkblob', BLOB, MAPKEYS])
indexes.push(['qidxBlobListNested', 'lblob', BLOB, LIST, new Context().addMapKey('nested')])
indexes.push(['qidxBlobMapNested', 'mblob', BLOB, MAPVALUES, new Context().addMapKey('nested')])
indexes.push(['qidxBlobMapKeysNested', 'mkblob', BLOB, MAPKEYS, new Context().addMapKey('nested')])
})
})
})

const numberOfSamples = samples.length

let keys = []

function verifyQueryResults (queryOptions, matchName, done) {
Expand All @@ -198,6 +164,34 @@ describe('Queries', function () {
recgen: () => samples.pop(),
metagen: metagen.constant({ ttl: 300 })
}

if (helper.cluster.isVersionInRange('>= 7.0.0')) {
samples.push({ name: 'blob match', blob: Buffer.from('guava') })
samples.push({ name: 'blob non-match', blob: Buffer.from('pumpkin') })
samples.push({ name: 'blob list match', lblob: [Buffer.from('guava'), Buffer.from('papaya')] })
samples.push({ name: 'blob list non-match', lblob: [Buffer.from('pumpkin'), Buffer.from('turnip')] })
samples.push({ name: 'blob map match', mblob: { a: Buffer.from('guava'), b: Buffer.from('papaya') } })
samples.push({ name: 'blob map non-match', mblob: { a: Buffer.from('pumpkin'), b: Buffer.from('turnip') } })
samples.push({ name: 'blob mapkeys match', mkblob: new Map([[Buffer.from('guava'), 1], [Buffer.from('papaya'), 2]]) })
samples.push({ name: 'blob mapkeys non-match', mkblob: new Map([[Buffer.from('pumpkin'), 3], [Buffer.from('turnip'), 4]]) })
samples.push({ name: 'nested blob match', blob: { nested: Buffer.from('guava') } })
samples.push({ name: 'nested blob non-match', blob: { nested: Buffer.from('pumpkin') } })
samples.push({ name: 'nested blob list match', lblob: { nested: [Buffer.from('guava'), Buffer.from('papaya')] } })
samples.push({ name: 'nested blob list non-match', lblob: { nested: [Buffer.from('pumpkin'), Buffer.from('turnip')] } })
samples.push({ name: 'nested blob map match', mblob: { nested: { a: Buffer.from('guava'), b: Buffer.from('papaya') } } })
samples.push({ name: 'nested blob map non-match', mblob: { nested: { a: Buffer.from('pumpkin'), b: Buffer.from('turnip') } } })
samples.push({ name: 'nested blob mapkeys match', mkblob: { nested: new Map([[Buffer.from('guava'), 1], [Buffer.from('papaya'), 2]]) } })
samples.push({ name: 'nested blob mapkeys non-match', mkblob: { nested: new Map([[Buffer.from('pumpkin'), 3], [Buffer.from('turnip'), 4]]) } })

indexes.push(['qidxBlob', 'blob', BLOB])
indexes.push(['qidxBlobList', 'lblob', BLOB, LIST])
indexes.push(['qidxBlobMap', 'mblob', BLOB, MAPVALUES])
indexes.push(['qidxBlobMapKeys', 'mkblob', BLOB, MAPKEYS])
indexes.push(['qidxBlobListNested', 'lblob', BLOB, LIST, new Context().addMapKey('nested')])
indexes.push(['qidxBlobMapNested', 'mblob', BLOB, MAPVALUES, new Context().addMapKey('nested')])
indexes.push(['qidxBlobMapKeysNested', 'mkblob', BLOB, MAPKEYS, new Context().addMapKey('nested')])
}
const numberOfSamples = samples.length
return Promise.all([
putgen.put(numberOfSamples, generators)
.then((records) => { keys = records.map((rec) => rec.key) })
Expand Down

0 comments on commit 602981d

Please sign in to comment.