Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
sergionoviello committed Jun 21, 2024
1 parent 10e97c3 commit fedf2b4
Showing 1 changed file with 39 additions and 39 deletions.
78 changes: 39 additions & 39 deletions test/persistence.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,45 +319,6 @@ describe('given the migration is enabled', function () {
})
})

describe('given reading from replica is not enabled', function () {
before(function (done) {
process.env.noverbose = true
process.env.RADAR_MIGRATION_ENABLED = 'true'
process.env.RADAR_ELASTICACHE_ENABLED = 'false'

PersistenceTestHelper.connectWithReplica()

Persistence.connect(function () {
client = Persistence.redis()
replicaClient = Persistence.redisReplica()
Persistence.delWildCard('*', done)
})
})

after(function (done) {
Persistence.delWildCard('*', function () {
Persistence.disconnect(function () {
SentinelHelper.stop({ redis: { ports: [16379] } })
SentinelHelper.stop({ redis: { ports: [16380] } })
done()
})
})
})

describe('readKey', function () {
it('reads via the main client', function (done) {
const key = 'persistence.read.replica.messages.object.test'

client.set(key, JSON.stringify('this string should be returned'))
replicaClient.set(key, JSON.stringify('this string should NOT be returned'))
Persistence.readKey(key, function (result) {
assert.deepEqual('this string should be returned', result)
done()
})
})
})
})

describe('given reading from replica is enabled', function () {
before(function (done) {
process.env.noverbose = true
Expand Down Expand Up @@ -503,3 +464,42 @@ describe('given reading from replica is enabled', function () {
})
})
})

describe('given reading from replica is not enabled', function () {
before(function (done) {
process.env.noverbose = true
process.env.RADAR_MIGRATION_ENABLED = 'true'
process.env.RADAR_ELASTICACHE_ENABLED = 'false'

PersistenceTestHelper.connectWithReplica()

Persistence.connect(function () {
client = Persistence.redis()
replicaClient = Persistence.redisReplica()
Persistence.delWildCard('*', done)
})
})

after(function (done) {
Persistence.delWildCard('*', function () {
Persistence.disconnect(function () {
SentinelHelper.stop({ redis: { ports: [16379] } })
SentinelHelper.stop({ redis: { ports: [16380] } })
done()
})
})
})

describe('readKey', function () {
it('reads via the main client', function (done) {
const key = 'persistence.read.replica.messages.object.test'

client.set(key, JSON.stringify('this string should be returned'))
replicaClient.set(key, JSON.stringify('this string should NOT be returned'))
Persistence.readKey(key, function (result) {
assert.deepEqual('this string should be returned', result)
done()
})
})
})
})

0 comments on commit fedf2b4

Please sign in to comment.