-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: RD-13918-Disable-ioredis (#538)
* feat: Disable ioredis instrumentation env
- Loading branch information
1 parent
dc738fe
commit f7a04cd
Showing
5 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/instrumentations/ioredis/IORedisInstrumentation.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,29 @@ | ||
import LumigoIORedisInstrumentation from './IORedisInstrumentation'; | ||
import child_process from 'child_process'; | ||
|
||
describe('LumigoIORedisInstrumentation', () => { | ||
const oldEnv = Object.assign({}, process.env); | ||
|
||
beforeEach(() => { | ||
process.env = { ...oldEnv }; | ||
}); | ||
|
||
afterEach(() => { | ||
jest.clearAllMocks(); | ||
process.env = { ...oldEnv }; | ||
}); | ||
|
||
let lumigoIORedisInstrumentation = new LumigoIORedisInstrumentation(); | ||
|
||
test('getInstrumentedModule should return "ioredis"', () => { | ||
expect(lumigoIORedisInstrumentation.getInstrumentedModule()).toEqual('ioredis'); | ||
}); | ||
|
||
test('disable ioredis instrumentation', () => { | ||
const child_process = require('child_process'); | ||
child_process.execSync('npm install ioredis', { stdio: 'inherit' }); | ||
|
||
process.env.LUMIGO_DISABLE_IOREDIS_INSTRUMENTATION = 'true'; | ||
expect(lumigoIORedisInstrumentation.isApplicable()).toEqual(false); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters