Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: knex timeout acquiring a connection error #161

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
20 changes: 19 additions & 1 deletion src/__tests__/indexing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand All @@ -58,9 +58,14 @@ 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) {
Expand All @@ -74,6 +79,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)
Expand All @@ -95,13 +104,22 @@ 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,
{ model: TEST_MODEL },
{ anchor: false }
)

console.log(
`created doc2: streamId -- ${doc2.id.toString()}, tip - ${doc2.tip.toString()} `
)

await TestUtils.delay(5 * 1000)

await expect(
Expand Down