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 test suite #103

Conversation

chereseeriepa
Copy link

@chereseeriepa chereseeriepa commented Jul 4, 2024

Currently, the test suite is failing to run on leveldb. This PR does the follow:

  • Fixes the seg fault being thrown, only for leveldb.
  • Changes how tests create and use a storage instance. There were conflicts between storageInstances and tests, causing issues in other tests.
  • Adds extra error handling to some tests.
  • Makes sure more tests have unique keys for docs being created, this is related to the conflict issues as well.

TODO:

  • The leveldb tests are now failing. There may be a bug with how data is queried, because the queries (see commented TODO's in the test-suite) are not returning anything. (Note from Cherese: I need to check how queries are being run, I am not familiar with this stack at the moment).

README.md Outdated Show resolved Hide resolved
@chereseeriepa chereseeriepa force-pushed the fix_master_tests_cherese branch from c1bec82 to 32a5e04 Compare July 4, 2024 02:15
@chereseeriepa chereseeriepa force-pushed the fix_master_tests_cherese branch from 32a5e04 to 72672f0 Compare July 4, 2024 02:33
@chereseeriepa chereseeriepa changed the title get rid of seg fault Update test suite Jul 4, 2024
@chereseeriepa chereseeriepa changed the title Update test suite Fix test suite Jul 4, 2024
@@ -4,6 +4,9 @@ import { describe, it, beforeEach, afterEach } from 'vitest';
import { runTestSuite } from '@pluto-encrypted/test-suite';
import { createLevelDBStorage } from '../src'

const SegfaultHandler = require('segfault-handler');
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm maybe

import { addRxPlugin } from "rxdb";
import { RxDBDevModePlugin } from "rxdb/plugins/dev-mode";
import nodeCrypto from "crypto";

// set up segfault handler
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm maybe

let storage: RxStorage<any, any>
let storageInstance: RxStorageInstance<RxDocType, any, any, any> | undefined
const { it, describe } = suite
// let storage: RxStorage<any, any>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm

@@ -372,6 +361,7 @@ export function testCorrectQueries<RxDocType>(
}

// Test output of RxStorageInstance.query();
// TODO: queries arent returning anything
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO for leveldb


await storageInstance.cleanup(Infinity)
// await storageInstance.close()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: do we need to close each instance?

}],
testContext
)
await storageInstance.bulkWrite(
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check the writeResponse

@@ -184,8 +188,16 @@ export class RxStorageIntanceLevelDB<RxDocType> implements RxStorageInstance<
upperBound
);
const indexName = getIndexName(index);
// => '_meta.lwt,key'
// QUESTION: this doesn't seem to map to any of the indexes being entered?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're seeing some weirdness where the queryPlan generates index name which is then used by getIndex and gets nothing ... looking at what's going in with setIndex is seems there is some mis-alignment (i.e. no indexes are being set with value _meta.lwt,key ....

Pausing here for today - the next questions are:

  • why misalignment
  • what should setIndex getIndex be doing? (where's the definition)
  • ....?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you have a query, the storage should check if the current query is satisfied by an index and get the index instead of listing all the rows.

Its done for efficiency, the indexes are just faster to query than whole table if that makes sense.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I know what an index is, have used them a bunch.

What I'm confused about is why the setIndex and getIndex look so wrong

@mixmix mixmix merged commit 451a6f3 into trust0-project:fix_master_tests Jul 15, 2024
0 of 2 checks passed
@mixmix mixmix deleted the fix_master_tests_cherese branch July 15, 2024 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants