From 1d225c794d2ae9b6339ccd588888c06bc7d3bdd6 Mon Sep 17 00:00:00 2001 From: stephhuynh18 Date: Wed, 14 Dec 2022 20:49:48 -0800 Subject: [PATCH 1/4] add debugging for knex --- ci/ci.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/ci.sh b/ci/ci.sh index 73cfa02..475d722 100755 --- a/ci/ci.sh +++ b/ci/ci.sh @@ -11,6 +11,7 @@ if [[ $NODE_ENV == "local_client-public" ]]; then fi if [[ $NODE_ENV == "local_node-private" ]]; then + export DEBUG="knex:*" # init config and generate peer id node_modules/go-ipfs/go-ipfs/ipfs init From e4630aa1db350217a369cac09b24d2c0a02416a8 Mon Sep 17 00:00:00 2001 From: stephhuynh18 Date: Thu, 15 Dec 2022 19:09:31 -0800 Subject: [PATCH 2/4] More logs --- src/__tests__/indexing.ts | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/__tests__/indexing.ts b/src/__tests__/indexing.ts index b411f92..6980951 100644 --- a/src/__tests__/indexing.ts +++ b/src/__tests__/indexing.ts @@ -40,7 +40,7 @@ const extractDocuments = ( describe('indexing', () => { describe('Using existing model', () => { - jest.setTimeout(1000 * 60) + jest.setTimeout(1000 * 120) const originalDid = ceramic.did as DID const singleNodeTestCases: any[] = [['ceramic', ceramic]] @@ -66,7 +66,8 @@ describe('indexing', () => { if (singleNodeTestCases.length > 0) { test.each(singleNodeTestCases)( 'Can create and query on same node -- %s', - async (_, ceramicInstance: CeramicApi) => { + async (testType, ceramicInstance: CeramicApi) => { + console.log(`START: Can create and query on same node -- ${testType}`) const doc1 = await ModelInstanceDocument.create( ceramicInstance, DATA1, @@ -74,6 +75,10 @@ describe('indexing', () => { { anchor: false } ) + console.log( + `created doc1: streamId -- ${doc1.id.toString()}, tip - ${doc1.tip.toString()} ` + ) + await expect( ceramicInstance.index.count({ model: TEST_MODEL.toString() }) ).resolves.toBeGreaterThanOrEqual(1) @@ -95,6 +100,11 @@ describe('indexing', () => { ) await doc1.replace(DATA2, { anchor: false }) + + console.log( + `replaced doc1: streamId -- ${doc1.id.toString()}, tip - ${doc1.tip.toString()} ` + ) + const doc2 = await ModelInstanceDocument.create( ceramicInstance, DATA3, @@ -102,6 +112,10 @@ describe('indexing', () => { { anchor: false } ) + console.log( + `created doc2: streamId -- ${doc2.id.toString()}, tip - ${doc2.tip.toString()} ` + ) + await TestUtils.delay(5 * 1000) await expect( @@ -130,6 +144,8 @@ describe('indexing', () => { expect(StreamUtils.serializeState(retrievedDoc2.state)).toEqual( StreamUtils.serializeState(doc2.state) ) + + console.log(`END: Can create and query on same node -- ${testType}`) } ) From 6dcf2b3d5c7fcf514a4a3430f992467f7ae8a8d0 Mon Sep 17 00:00:00 2001 From: stephhuynh18 Date: Tue, 27 Dec 2022 11:34:12 -0500 Subject: [PATCH 3/4] Add logs before and after indexing --- src/__tests__/indexing.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/__tests__/indexing.ts b/src/__tests__/indexing.ts index 6980951..bfb926c 100644 --- a/src/__tests__/indexing.ts +++ b/src/__tests__/indexing.ts @@ -46,9 +46,9 @@ describe('indexing', () => { const singleNodeTestCases: any[] = [['ceramic', ceramic]] const twoNodesTestCases: any[] = [] - if (config.jest.services.ceramicClient.indexingEnabled) { - singleNodeTestCases.push(['ceramicClient', ceramicClient]) - } + // if (config.jest.services.ceramicClient.indexingEnabled) { + // singleNodeTestCases.push(['ceramicClient', ceramicClient]) + // } if ( config.jest.services.ceramic.indexingEnabled && @@ -58,16 +58,20 @@ describe('indexing', () => { twoNodesTestCases.push(['creating: ceramicClient, loading: ceramic', ceramicClient, ceramic]) } + beforeEach(() => { + console.log(`START: ${expect.getState().currentTestName}`) + }) + afterEach(() => { ceramic.did = originalDid ceramicClient.did = originalDid + console.log(`END: ${expect.getState().currentTestName}`) }) if (singleNodeTestCases.length > 0) { test.each(singleNodeTestCases)( 'Can create and query on same node -- %s', - async (testType, ceramicInstance: CeramicApi) => { - console.log(`START: Can create and query on same node -- ${testType}`) + async (_, ceramicInstance: CeramicApi) => { const doc1 = await ModelInstanceDocument.create( ceramicInstance, DATA1, @@ -144,8 +148,6 @@ describe('indexing', () => { expect(StreamUtils.serializeState(retrievedDoc2.state)).toEqual( StreamUtils.serializeState(doc2.state) ) - - console.log(`END: Can create and query on same node -- ${testType}`) } ) From 23635a3636e05dd4c376733b77825e078c713f6f Mon Sep 17 00:00:00 2001 From: stephhuynh18 Date: Wed, 28 Dec 2022 10:12:33 -0500 Subject: [PATCH 4/4] remove comment --- src/__tests__/indexing.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/__tests__/indexing.ts b/src/__tests__/indexing.ts index bfb926c..658342d 100644 --- a/src/__tests__/indexing.ts +++ b/src/__tests__/indexing.ts @@ -46,9 +46,9 @@ describe('indexing', () => { const singleNodeTestCases: any[] = [['ceramic', ceramic]] const twoNodesTestCases: any[] = [] - // if (config.jest.services.ceramicClient.indexingEnabled) { - // singleNodeTestCases.push(['ceramicClient', ceramicClient]) - // } + if (config.jest.services.ceramicClient.indexingEnabled) { + singleNodeTestCases.push(['ceramicClient', ceramicClient]) + } if ( config.jest.services.ceramic.indexingEnabled &&