Skip to content

Commit

Permalink
remove leak detector
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Arregui committed Apr 23, 2024
1 parent 6a2b07b commit c65330d
Show file tree
Hide file tree
Showing 27 changed files with 5 additions and 118 deletions.
1 change: 0 additions & 1 deletion content/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
"jest": "27.4.7",
"jest-extra-utils": "^0.1.0",
"jest-junit": "^13.0.0",
"jest-leak-detector": "^29.3.1",
"lint-staged": "13.0.3",
"nyc": "^15.1.0",
"prettier": "2.7.1",
Expand Down
9 changes: 5 additions & 4 deletions content/test/integration/E2ETestEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ILoggerComponent } from '@well-known-components/interfaces'
import { createLogComponent } from '@well-known-components/logger'
import { createTestMetricsComponent } from '@well-known-components/metrics'
import { random } from 'faker'
import LeakDetector from 'jest-leak-detector'
import ms from 'ms'
import { DEFAULT_DATABASE_CONFIG, Environment, EnvironmentBuilder, EnvironmentConfig } from '../../src/Environment'
import { stopAllComponents } from '../../src/logic/components-lifecycle'
Expand Down Expand Up @@ -149,7 +148,11 @@ export class ServerBuilder {
private readonly builder: EnvironmentBuilder
private readonly storageBaseFolder: string

constructor(private readonly testEnvCalls: TestEnvCalls, env: Environment, public dao: DAOComponent) {
constructor(
private readonly testEnvCalls: TestEnvCalls,
env: Environment,
public dao: DAOComponent
) {
this.builder = new EnvironmentBuilder(env)
this.storageBaseFolder = env.getConfig(EnvironmentConfig.STORAGE_ROOT_FOLDER) ?? 'storage'
}
Expand Down Expand Up @@ -218,10 +221,8 @@ export function setupTestEnvironment(overrideConfigs?: Record<number, any>) {

afterAll(async () => {
jest.restoreAllMocks()
const detector = new LeakDetector(testEnv)
await testEnv.stop()
testEnv = null as any
expect(await detector.isLeaking()).toBe(false)
})

return () => testEnv
Expand Down
3 changes: 0 additions & 3 deletions content/test/integration/controller/active-entities.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { makeNoopValidator } from '../../helpers/service/validations/NoOpValidat
import { buildDeployData } from '../E2ETestUtils'
import { getIntegrationResourcePathFor } from '../resources/get-resource-path'
import { TestProgram } from '../TestProgram'
import LeakDetector from 'jest-leak-detector'
import { createDefaultServer, resetServer } from '../simpleTestEnvironment'

describe('Integration - Get Active Entities', () => {
Expand All @@ -20,10 +19,8 @@ describe('Integration - Get Active Entities', () => {

afterAll(async () => {
jest.restoreAllMocks()
const detector = new LeakDetector(server)
await server.stopProgram()
server = null as any
expect(await detector.isLeaking()).toBe(false)
})

it('when asking without params, it returns client error', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { makeNoopValidator } from '../../helpers/service/validations/NoOpValidat
import { buildDeployData } from '../E2ETestUtils'
import { createDefaultServer, resetServer } from '../simpleTestEnvironment'
import { TestProgram } from '../TestProgram'
import LeakDetector from 'jest-leak-detector'

describe('Integration - Get Active Entities By Content Hash', () => {
let server: TestProgram
Expand All @@ -17,10 +16,8 @@ describe('Integration - Get Active Entities By Content Hash', () => {

afterAll(async () => {
jest.restoreAllMocks()
const detector = new LeakDetector(server)
await server.stopProgram()
server = null as any
expect(await detector.isLeaking()).toBe(false)
})

it("When the deployment doesn't exist returns 404", async () => {
Expand Down
3 changes: 0 additions & 3 deletions content/test/integration/controller/active-pointers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { getIntegrationResourcePathFor } from '../resources/get-resource-path'
import { TestProgram } from '../TestProgram'
import FormData = require('form-data')
import { resetServer, createDefaultServer } from '../simpleTestEnvironment'
import LeakDetector from 'jest-leak-detector'

interface ActivePointersRow {
entity_id: string
Expand Down Expand Up @@ -37,10 +36,8 @@ describe('Integration - Create entities', () => {
afterAll(async () => {
jest.restoreAllMocks()
stopAllComponents({ fs })
const detector = new LeakDetector(server)
await server.stopProgram()
server = null as any
expect(await detector.isLeaking()).toBe(false)
})

it('when creating a profile, pointer should be stored in active-pointers table', async () => {
Expand Down
3 changes: 0 additions & 3 deletions content/test/integration/controller/audit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { makeNoopValidator } from '../../helpers/service/validations/NoOpValidat
import { buildDeployData, deployEntitiesCombo } from '../E2ETestUtils'
import { createDefaultServer } from '../simpleTestEnvironment'
import { TestProgram } from '../TestProgram'
import LeakDetector from 'jest-leak-detector'

describe('Integration - Audit', () => {
let server: TestProgram
Expand All @@ -16,10 +15,8 @@ describe('Integration - Audit', () => {

afterAll(async () => {
jest.restoreAllMocks()
const detector = new LeakDetector(server)
await server.stopProgram()
server = null as any
expect(await detector.isLeaking()).toBe(false)
})

it('returns 400 when no cid is provided', async () => {
Expand Down
3 changes: 0 additions & 3 deletions content/test/integration/controller/available-content.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import fetch from 'node-fetch'
import { makeNoopValidator } from '../../helpers/service/validations/NoOpValidator'
import { createDefaultServer } from '../simpleTestEnvironment'
import { TestProgram } from '../TestProgram'
import LeakDetector from 'jest-leak-detector'

describe('Integration - Available Content', () => {
let server: TestProgram
Expand All @@ -14,10 +13,8 @@ describe('Integration - Available Content', () => {

afterAll(async () => {
jest.restoreAllMocks()
const detector = new LeakDetector(server)
await server.stopProgram()
server = null as any
expect(await detector.isLeaking()).toBe(false)
})

it('returns 400 when no cid is provided', async () => {
Expand Down
3 changes: 0 additions & 3 deletions content/test/integration/controller/content.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import fetch from 'node-fetch'
import { makeNoopValidator } from '../../helpers/service/validations/NoOpValidator'
import { createDefaultServer } from '../simpleTestEnvironment'
import { TestProgram } from '../TestProgram'
import LeakDetector from 'jest-leak-detector'

describe('Integration - Get Content', () => {
let server: TestProgram
Expand All @@ -14,10 +13,8 @@ describe('Integration - Get Content', () => {

afterAll(async () => {
jest.restoreAllMocks()
const detector = new LeakDetector(server)
await server.stopProgram()
server = null as any
expect(await detector.isLeaking()).toBe(false)
})

it('returns 404 when the content file does not exist', async () => {
Expand Down
3 changes: 0 additions & 3 deletions content/test/integration/controller/deployment-fields.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { makeNoopValidator } from '../../helpers/service/validations/NoOpValidat
import { buildDeployData } from '../E2ETestUtils'
import { createDefaultServer } from '../simpleTestEnvironment'
import { TestProgram } from '../TestProgram'
import LeakDetector from 'jest-leak-detector'

describe('Integration - Deployment Fields', () => {
const fetcher = createFetchComponent()
Expand All @@ -25,10 +24,8 @@ describe('Integration - Deployment Fields', () => {

afterAll(async () => {
jest.restoreAllMocks()
const detector = new LeakDetector(server)
await server.stopProgram()
server = null as any
expect(await detector.isLeaking()).toBe(false)
})

it('When deployments fields filter is used, then the result is the expected', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { makeNoopValidator } from '../../helpers/service/validations/NoOpValidat
import { buildDeployData, EntityCombo } from '../E2ETestUtils'
import { resetServer, createDefaultServer } from '../simpleTestEnvironment'
import { TestProgram } from '../TestProgram'
import LeakDetector from 'jest-leak-detector'

describe('Integration - Deployment Pagination', () => {
const fetcher = createFetchComponent()
Expand Down Expand Up @@ -43,10 +42,8 @@ describe('Integration - Deployment Pagination', () => {

afterAll(async () => {
jest.restoreAllMocks()
const detector = new LeakDetector(server)
await server.stopProgram()
server = null as any
expect(await detector.isLeaking()).toBe(false)
})

it('given local timestamp and asc when getting two elements the next link page is correct', async () => {
Expand Down
3 changes: 0 additions & 3 deletions content/test/integration/controller/entities.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import fetch from 'node-fetch'
import { makeNoopValidator } from '../../helpers/service/validations/NoOpValidator'
import { createDefaultServer } from '../simpleTestEnvironment'
import { TestProgram } from '../TestProgram'
import LeakDetector from 'jest-leak-detector'

describe('Integration - Entities', () => {
let server: TestProgram
Expand All @@ -14,10 +13,8 @@ describe('Integration - Entities', () => {

afterAll(async () => {
jest.restoreAllMocks()
const detector = new LeakDetector(server)
await server.stopProgram()
server = null as any
expect(await detector.isLeaking()).toBe(false)
})

it('returns 500 when there is an exception while deploying the entity', async () => {
Expand Down
3 changes: 0 additions & 3 deletions content/test/integration/controller/entity-metadata.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { makeNoopValidator } from '../../helpers/service/validations/NoOpValidat
import { buildDeployData } from '../E2ETestUtils'
import { createDefaultServer, resetServer } from '../simpleTestEnvironment'
import { TestProgram } from '../TestProgram'
import LeakDetector from 'jest-leak-detector'

describe('Integration - Get wearable image and thumbnail', () => {
let server: TestProgram
Expand All @@ -17,10 +16,8 @@ describe('Integration - Get wearable image and thumbnail', () => {

afterAll(async () => {
jest.restoreAllMocks()
const detector = new LeakDetector(server)
await server.stopProgram()
server = null as any
expect(await detector.isLeaking()).toBe(false)
})

it('when entity does not exist, it should return 404', async () => {
Expand Down
3 changes: 0 additions & 3 deletions content/test/integration/controller/status.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import fetch from 'node-fetch'
import { makeNoopValidator } from '../../helpers/service/validations/NoOpValidator'
import { createDefaultServer } from '../simpleTestEnvironment'
import { TestProgram } from '../TestProgram'
import LeakDetector from 'jest-leak-detector'

describe('Integration - Status', () => {
let server: TestProgram
Expand All @@ -14,10 +13,8 @@ describe('Integration - Status', () => {

afterAll(async () => {
jest.restoreAllMocks()
const detector = new LeakDetector(server)
await server.stopProgram()
server = null as any
expect(await detector.isLeaking()).toBe(false)
})

it('returns 200 when the status is ok', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { AppComponents } from '../../../../src/types'
import { makeNoopServerValidator, makeNoopValidator } from '../../../helpers/service/validations/NoOpValidator'
import { buildDeployData, deployEntitiesCombo, EntityCombo } from '../../E2ETestUtils'
import { TestProgram } from '../../TestProgram'
import LeakDetector from 'jest-leak-detector'
import { createDefaultServer } from '../../simpleTestEnvironment'

const P1 = 'x1,y1'
Expand All @@ -26,10 +25,8 @@ describe('Integration - Concurrent deployments', () => {

afterAll(async () => {
jest.restoreAllMocks()
const detector = new LeakDetector(server)
await server.stopProgram()
server = null as any
expect(await detector.isLeaking()).toBe(false)
})

it('When deployments are executed concurrently, then only one remains active', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { AppComponents } from '../../../../src/types'
import { makeNoopServerValidator, makeNoopValidator } from '../../../helpers/service/validations/NoOpValidator'
import { buildDeployData, buildDeployDataAfterEntity, createIdentity, EntityCombo, Identity } from '../../E2ETestUtils'
import { TestProgram } from '../../TestProgram'
import LeakDetector from 'jest-leak-detector'
import { createDefaultServer } from '../../simpleTestEnvironment'

const P1 = '0,0'
Expand All @@ -31,10 +30,8 @@ describe('Integration - Deployment with Entity Overlaps', () => {

afterAll(async () => {
jest.restoreAllMocks()
const detector = new LeakDetector(server)
await server.stopProgram()
server = null as any
expect(await detector.isLeaking()).toBe(false)
})

let identity: Identity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { AppComponents } from '../../../../src/types'
import { makeNoopServerValidator, makeNoopValidator } from '../../../helpers/service/validations/NoOpValidator'
import { buildDeployData, buildDeployDataAfterEntity, EntityCombo } from '../../E2ETestUtils'
import { TestProgram } from '../../TestProgram'
import LeakDetector from 'jest-leak-detector'
import { createDefaultServer, resetServer } from '../../simpleTestEnvironment'

const P1 = 'x1,y1'
Expand All @@ -36,10 +35,8 @@ describe('Integration - Deployment Filters', () => {

afterAll(async () => {
jest.restoreAllMocks()
const detector = new LeakDetector(server)
await server.stopProgram()
server = null as any
expect(await detector.isLeaking()).toBe(false)
})

let E1: EntityCombo, E2: EntityCombo, E3: EntityCombo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { AppComponents, EntityVersion } from '../../../../src/types'
import { makeNoopServerValidator } from '../../../helpers/service/validations/NoOpValidator'
import { EntityCombo, buildDeployData, createIdentity } from '../../E2ETestUtils'
import { TestProgram } from '../../TestProgram'
import LeakDetector from 'jest-leak-detector'
import { createDefaultServer, resetServer } from '../../simpleTestEnvironment'

const P1 = '0,0'
Expand All @@ -25,10 +24,8 @@ describe('Integration - Deployment with metadata validation', () => {

afterAll(async () => {
jest.restoreAllMocks()
const detector = new LeakDetector(server)
await server.stopProgram()
server = null as any
expect(await detector.isLeaking()).toBe(false)
})

it('When scene metadata is missing, deployment result should include the proper error', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { makeNoopServerValidator } from '../../../helpers/service/validations/No
import { EntityCombo } from '../../E2ETestUtils'
import { getIntegrationResourcePathFor } from '../../resources/get-resource-path'
import { TestProgram } from '../../TestProgram'
import LeakDetector from 'jest-leak-detector'
import { createDefaultServer } from '../../simpleTestEnvironment'

describe('Integration - Deployment synced old entity', () => {
Expand All @@ -18,10 +17,8 @@ describe('Integration - Deployment synced old entity', () => {

afterAll(async () => {
jest.restoreAllMocks()
const detector = new LeakDetector(server)
await server.stopProgram()
server = null as any
expect(await detector.isLeaking()).toBe(false)
})

it('When deploying an entity with cid v0 hashes of entities before ADR 45, it should succeed', async () => {
Expand Down
3 changes: 0 additions & 3 deletions content/test/integration/ports/deployer/order-check.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { makeNoopServerValidator, makeNoopValidator } from '../../../helpers/ser
import { buildDeployData, buildDeployDataAfterEntity, deployEntitiesCombo, EntityCombo } from '../../E2ETestUtils'
import { createDefaultServer } from '../../simpleTestEnvironment'
import { TestProgram } from '../../TestProgram'
import LeakDetector from 'jest-leak-detector'

/**
* This test verifies that the active entity and overwrites are calculated correctly, regardless of the order in which the entities where deployed.
Expand All @@ -28,10 +27,8 @@ describe('Integration - Order Check', () => {

afterAll(async () => {
jest.restoreAllMocks()
const detector = new LeakDetector(server)
await server.stopProgram()
server = null as any
expect(await detector.isLeaking()).toBe(false)
})

beforeAll(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { AppComponents } from '../../../../src/types'
import { makeNoopServerValidator, makeNoopValidator } from '../../../helpers/service/validations/NoOpValidator'
import { buildDeployData, deployEntitiesCombo, EntityCombo } from '../../E2ETestUtils'
import { TestProgram } from '../../TestProgram'
import LeakDetector from 'jest-leak-detector'
import { createDefaultServer } from '../../simpleTestEnvironment'

const P1 = 'X1,Y1'
Expand Down Expand Up @@ -35,10 +34,8 @@ describe('Integration - Same Timestamp Check', () => {

afterAll(async () => {
jest.restoreAllMocks()
const detector = new LeakDetector(server)
await server.stopProgram()
server = null as any
expect(await detector.isLeaking()).toBe(false)
})

it(`When oldest is deployed first, the active is the newest`, async () => {
Expand Down
Loading

0 comments on commit c65330d

Please sign in to comment.