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

various fixes & improvements #46

Merged
merged 1 commit into from
Jan 29, 2025
Merged

various fixes & improvements #46

merged 1 commit into from
Jan 29, 2025

Conversation

vgao1996
Copy link
Contributor

@vgao1996 vgao1996 commented Jan 28, 2025

  • use npx aptos workspace run
  • set the number of jobs based on the number of CPU cores and amount of memory
  • added a CLI version checker that runs before all tests
  • added a prerequisites section to the README

@vgao1996 vgao1996 requested a review from 0xmaayan January 28, 2025 07:36
@vgao1996 vgao1996 force-pushed the vg-01 branch 2 times, most recently from 6482137 to 10ba6d2 Compare January 28, 2025 08:12

export type TestOptionsArguments = {
timeout: string;
grep: string;
jobs: number;
};

function max_num_jobs(): number {
Copy link
Collaborator

Choose a reason for hiding this comment

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

running npx aptos-workspace test when docker is not available does not output the error reason (i.e docker is not available)

Aptos CLI version 6.0.2 detected.
Spinning up the server to run tests, hold on...


  1) "before all" hook: beforeAll in "{root}"

  2) "before all" hook: beforeAll in "{root}"

  0 passing (1m)
  2 failing

  1) "before all" hook: beforeAll in "{root}":
     Error: Failed to spawn test node: Timeout waiting for ports
      at Function.spawn (/Users/maayansavir/work/aptos_repos/workspace/workspace/src/internal/node.ts:57:43)
      at async exports.b (/Users/maayansavir/work/aptos_repos/workspace/workspace/src/internal/rootHook.ts:23:24)
      at async Context.beforeAll (/Users/maayansavir/work/aptos_repos/workspace/workspace/src/internal/rootHook.ts:10:5)

  2) "before all" hook: beforeAll in "{root}":
     Error: Failed to spawn test node: Timeout waiting for ports
      at Function.spawn (/Users/maayansavir/work/aptos_repos/workspace/workspace/src/internal/node.ts:57:43)
      at async exports.b (/Users/maayansavir/work/aptos_repos/workspace/workspace/src/internal/rootHook.ts:23:24)
      at async Context.beforeAll (/Users/maayansavir/work/aptos_repos/workspace/workspace/src/internal/rootHook.ts:10:5)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now I'll probably just add another check that tries to run the docker command once. Later we'll see if there's a better way to detect it.

if (semver.lt(version, minimumVersion)) {
return reject(
new Error(
`Aptos CLI version needs to be at least ${minimumVersion}, please run "npx aptos update aptos" to update.`
Copy link
Collaborator

Choose a reason for hiding this comment

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

"aptos" is installed via different services, depends on the user machine. running npx aptos --update uses the aptos-cli bin which understands the user OS and updates it accordingly.

For example, when I run npx aptos update aptos getting error

{
  "Error": "Unexpected error: Detected this CLI comes from homebrew, use `brew upgrade aptos` instead"
}
Suggested change
`Aptos CLI version needs to be at least ${minimumVersion}, please run "npx aptos update aptos" to update.`
`Aptos CLI version needs to be at least ${minimumVersion}, please run "npx aptos --update" to update.`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Weird I tried npx aptos --update initially, but it didn't really update the CLI version properly -- like it said it was updated to 6.0.2, but when I ran npx aptos --version it still returned 5.1.0.


public static async spawn(): Promise<TestNode> {
const id = generateRandomId(4);

const configVerbose = getUserConfigVerbose();

const cliCommand = "aptos-workspace-server";
const cliArgs: string[] = [];
const cliCommand = "npx";
Copy link
Collaborator

Choose a reason for hiding this comment

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

would be great to clean up a bit the output when running npx aptos workspace run on cli when docker is not available

Created test directory: /var/folders/9k/9m6fp1vj0sx79mys877nfvy00000gn/T/.tmpQ6w03p
Starting node..
Starting postgres..

One or more services failed to start, will run shutdown steps

Running shutdown steps
Removed docker volume aptos-workspace-0a56d71e-5a74-4d4a-a974-1814ce9e165b-postgres
details = """
panicked at config/src/config/network_config.rs:257:89:
called `Result::unwrap()` on an `Err` value: No such file or directory (os error 2)"""
backtrace = """
   0:        0x10345344c - __mh_execute_header
   1:        0x103453418 - __mh_execute_header
   2:        0x103455dfc - __mh_execute_header
   3:        0x103455d9c - __mh_execute_header
   4:        0x102a37184 - __mh_execute_header
   5:        0x1043038f8 - __mh_execute_header
   6:        0x104305c40 - __mh_execute_header
   7:        0x104305968 - __mh_execute_header
   8:        0x104303414 - __mh_execute_header
   9:        0x1048c6538 - __ZN7rocksdb6ribbon6detail34BandingConfigHelper1MaybeSupportedILNS0_25ConstructionFailureChanceE1ELy128ELb0ELb0ELb1EE11GetNumSlotsEj
  10:        0x1048c64c4 - __ZN7rocksdb6ribbon6detail34BandingConfigHelper1MaybeSupportedILNS0_25ConstructionFailureChanceE1ELy128ELb0ELb0ELb1EE11GetNumSlotsEj
  11:        0x10277d30c - __mh_execute_header
  12:        0x1030aa050 - __mh_execute_header
  13:        0x10314e4c8 - __mh_execute_header
  14:        0x103152ed4 - __mh_execute_header
  15:        0x103150980 - __mh_execute_header
  16:        0x103427a48 - __mh_execute_header
  17:        0x103428324 - __mh_execute_header
  18:        0x1042e2898 - __mh_execute_header
  19:        0x19d8e02e4 - __pthread_deallocate
"""

details = """
panicked at config/src/config/network_config.rs:257:89:
called `Result::unwrap()` on an `Err` value: No such file or directory (os error 2)"""
backtrace = """
   0:        0x10345344c - __mh_execute_header
   1:        0x103453418 - __mh_execute_header
   2:        0x103455dfc - __mh_execute_header
   3:        0x103455d9c - __mh_execute_header
   4:        0x102a37184 - __mh_execute_header
   5:        0x1043038f8 - __mh_execute_header
   6:        0x104305c40 - __mh_execute_header
   7:        0x104305968 - __mh_execute_header
   8:        0x104303414 - __mh_execute_header
   9:        0x1048c6538 - __ZN7rocksdb6ribbon6detail34BandingConfigHelper1MaybeSupportedILNS0_25ConstructionFailureChanceE1ELy128ELb0ELb0ELb1EE11GetNumSlotsEj
  10:        0x1048c64c4 - __ZN7rocksdb6ribbon6detail34BandingConfigHelper1MaybeSupportedILNS0_25ConstructionFailureChanceE1ELy128ELb0ELb0ELb1EE11GetNumSlotsEj
  11:        0x10277d30c - __mh_execute_header
  12:        0x10277deac - __mh_execute_header
  13:        0x1032ae384 - __mh_execute_header
  14:        0x1032b19c8 - __mh_execute_header
  15:        0x1032a52dc - __mh_execute_header
  16:        0x10329bb38 - __mh_execute_header
  17:        0x1032a64b0 - __mh_execute_header
  18:        0x1032a6678 - __mh_execute_header
  19:        0x1032a7c90 - __mh_execute_header
  20:        0x1043a964c - __mh_execute_header
  21:        0x1043a60cc - __mh_execute_header
  22:        0x104399b48 - __mh_execute_header
  23:        0x1043a7df8 - __mh_execute_header
  24:        0x1043a5b68 - __mh_execute_header
  25:        0x1043a9534 - __mh_execute_header
  26:        0x1043b2a4c - __mh_execute_header
  27:        0x1043aee2c - __mh_execute_header
  28:        0x104399410 - __mh_execute_header
  29:        0x1043b0d7c - __mh_execute_header
  30:        0x1043aff60 - __mh_execute_header
  31:        0x1043afcf8 - __mh_execute_header
  32:        0x1043b1a98 - __mh_execute_header
  33:        0x104398b74 - __mh_execute_header
  34:        0x10439a6ec - __mh_execute_header
  35:        0x1042e2898 - __mh_execute_header
  36:        0x19d8e02e4 - __pthread_deallocate
"""

{
  "Error": "Unexpected error: one or more services failed to start: failed to start indexer api server: one or more dependencies failed to start: failed to create docker network: Docker is not available, confirm it is installed and running. See https://aptos.dev/guides/local-development-network#faq for assistance. (version_home): error trying to connect: No such file or directory (os error 2): No such file or directory (os error 2)"

@vgao1996 vgao1996 force-pushed the vg-01 branch 2 times, most recently from ba376c1 to 8d2d29d Compare January 29, 2025 19:11
@vgao1996 vgao1996 force-pushed the vg-01 branch 2 times, most recently from 3e8fa73 to 4f0220e Compare January 29, 2025 20:18
@vgao1996 vgao1996 merged commit de78e23 into main Jan 29, 2025
4 checks passed
@vgao1996 vgao1996 deleted the vg-01 branch January 29, 2025 20:21
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.

2 participants