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

Refactor/polymorphic tests #15

Merged
merged 19 commits into from
May 21, 2024

Conversation

Keyrxng
Copy link
Contributor

@Keyrxng Keyrxng commented May 20, 2024

Resolves #16

Split from #6

Required by #14

Copy link
Contributor

github-actions bot commented May 20, 2024

Lines Statements Branches Functions
Coverage: NaN%
Unknown% (0/0) Unknown% (0/0) Unknown% (0/0)

JUnit

Tests Skipped Failures Errors Time
0 0 💤 0 ❌ 0 🔥 3.094s ⏱️
Coverage Report (0%)
File% Stmts% Branch% Funcs% LinesUncovered Line #s
All files0000 

@Keyrxng
Copy link
Contributor Author

Keyrxng commented May 20, 2024

the jest workflow shouldn't run yarn build only yarn test which builds for testing

@Keyrxng Keyrxng force-pushed the refactor/polymorphic-tests branch from 97140c3 to 5f7b03f Compare May 20, 2024 23:35
@Keyrxng
Copy link
Contributor Author

Keyrxng commented May 21, 2024

CI is failing here because it's using workflows from development I'm sure

image

Testing it myself my CI keeps throwing this below but as you can see above all test cases are passing, I just need to figure out why my CI seems to be busted. Lots of related gh issues for it, tried a fair few solutions to no avail, yet.

image

@rndquu
Copy link
Member

rndquu commented May 21, 2024

@Keyrxng

  1. Pls update readme
  2. Check this code:
import { HandlerConstructorConfig } from "./dist";
import { RPCHandler } from "./dist";

const config: HandlerConstructorConfig = {
    networkId: 1,
    autoStorage: false,
  };

async function main() {
    const handler = new RPCHandler(config);
    const provider = await handler.getFastestRpcProvider();
    console.log(provider.connection);
    console.log('success');
}

main();

The code above produces this error:

(node:14881) TimeoutOverflowWarning: 1.7976931348623157e+308 does not fit into a 32-bit signed integer.
Timeout duration was set to 1.
[RPCService] Failed to find fastest RPC
/Users/rndquu/Public/projects/backend/rpc-handler/dist/index.js:17021
      throw new Error("Failed to find fastest RPC");
            ^

Error: Failed to find fastest RPC
    at _RPCHandler.testRpcPerformance (/Users/rndquu/Public/projects/backend/rpc-handler/dist/index.js:17021:13)
    at async _RPCHandler.getFastestRpcProvider (/Users/rndquu/Public/projects/backend/rpc-handler/dist/index.js:17001:24)
    at main (/Users/rndquu/Public/projects/backend/rpc-handler/my.ts:11:22)

Pls fix

@Keyrxng
Copy link
Contributor Author

Keyrxng commented May 21, 2024

You should only need to fill in the required config props and your golden. I fresh installed, tried both build envs with your script and with tests/script-test.ts

const config: HandlerConstructorConfig = {
  networkId: 1,
  rpcTimeout: 1500,
  autoStorage: false,
  cacheRefreshCycles: 10,
  networkName: null,
  networkRpcs: null,
  runtimeRpcs: null,
};

@rndquu
Copy link
Member

rndquu commented May 21, 2024

@Keyrxng Why did you remove yarn.lock completely?

@rndquu
Copy link
Member

rndquu commented May 21, 2024

@Keyrxng Could you merge Keyrxng#3 ?

@Keyrxng
Copy link
Contributor Author

Keyrxng commented May 21, 2024

because of the CI errors I was having seeing as the fresh lock didn't change anything and typically no lock is committed.

Think it's best to add it back?

@rndquu
Copy link
Member

rndquu commented May 21, 2024

@Keyrxng Could you describe the main code changes of this exact PR and provide a time estimate for it?

@rndquu
Copy link
Member

rndquu commented May 21, 2024

@Keyrxng Could you describe the main code changes of this exact PR and provide a time estimate for it?

P.S. Tests seems to be passing + the package works fine

@Keyrxng
Copy link
Contributor Author

Keyrxng commented May 21, 2024

  • improve package exports reducing import path down to @packageName
  • fix latency naming convention
  • add configurable and default rpcTimeout
  • refactor tests
  • create test specific esbuild env

time 2-4 hrs

@rndquu

The task I'd say is making the package polymorphic, the latency and timeout fix happening over the course of review. Tests needed refactored because of how the way the build output was changed in improving exports.

@rndquu
Copy link
Member

rndquu commented May 21, 2024

  • improve package exports reducing import path down to @packageName
  • fix latency naming convention
  • add configurable and default rpcTimeout
  • refactor tests
  • create test specific esbuild env

time 2-4 hrs

@rndquu

The task I'd say is making the package polymorphic, the latency and timeout fix happening over the course of review. Tests needed refactored because of how the way the build output was changed in improving exports.

Pls self assign #16

@rndquu rndquu merged commit 5ea0d81 into ubiquity:development May 21, 2024
2 of 4 checks passed
@ubiquibot ubiquibot bot mentioned this pull request May 21, 2024
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.

Polymorphic tests
2 participants