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

chore: improve smokeTests environment validation and logging #1046

Merged
merged 5 commits into from
Dec 13, 2024

Conversation

aramxc
Copy link
Contributor

@aramxc aramxc commented Dec 13, 2024

Relates to:

N/A

Risks

Low - Changes are isolated to the smoke test script and don't affect production code.

  • Script improvements are defensive in nature (error handling, timeouts)
  • Changes are easily reversible if issues arise

Background

What does this PR do?

Enhances the smoke test script with improved logging, error handling, and process management:

  • Adds strict mode with error handling (set -euo pipefail)
  • Implements process cleanup with trap command (simplifies as well)
  • Adds timeout configuration for application startup
  • Enhances logging of test output and termination status

What kind of change is this?

Improvements (misc. changes to existing features)

Documentation changes needed?

My changes do not require a change to the project documentation.

Testing

Where should a reviewer start?

  1. Review the changes in scripts/smokeTests.sh
  2. Pay particular attention to the error handling and timeout configurations

Detailed testing steps

  1. Run the smoke tests: pnpm run smokeTests
  2. Verify that version information is displayed at start
  3. Verify that the script properly handles timeouts
  4. Verify that process cleanup occurs on both success and failure
  5. Check that error messages are clear and informative

Screenshots

N/A - Command line tool changes only

Deploy Notes

No special deployment steps required - changes only affect development/testing workflow.

@sol.kinetics

- Add strict mode with error handling (set -euo pipefail)
- Add process cleanup with trap command
- Add timeout configuration for application startup
- Add detailed logging of test output and termination status
done
PROJECT_DIR="$(dirname "$PROJECT_DIR")/.."
PROJECT_DIR="$(cd "$PROJECT_DIR"; pwd)"
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
Copy link
Contributor

Choose a reason for hiding this comment

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

The above code can deal with symbolic links, I've been using this template for years in my scripts.

(
# Wait for the ready message
# Wait for the ready message with timeout
while true; do
Copy link
Contributor

@jzvikart jzvikart Dec 13, 2024

Choose a reason for hiding this comment

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

IMO we shouldn't be using sleep here. We should fix whatever underlying problem is causing the test to fail without it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed - arbitrary sleeps can make tests both slower than necessary and introduce flakiness in my experience. I can create an issue/brainstorm a better termination signal instead

Copy link
Contributor

@jzvikart jzvikart left a comment

Choose a reason for hiding this comment

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

All good.

@monilpat monilpat changed the base branch from main to develop December 13, 2024 20:13
@aramxc aramxc changed the title chore(smokeTests): improve test environment validation and logging chore: improve smokeTests environment validation and logging Dec 13, 2024
Copy link
Collaborator

@monilpat monilpat left a comment

Choose a reason for hiding this comment

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

Thanks so much for doing this - Looks like the integration and smoke test need to be fixed! As well as ci check

@odilitime odilitime merged commit 579dc50 into elizaOS:develop Dec 13, 2024
2 of 4 checks passed
@jkbrooks
Copy link
Contributor

@monilpat @odilitime @aramxc

Gonna revert until we get a better understanding of test fixes. We have two test failures so far

Run pnpm run smokeTests
 WARN  Unsupported engine: wanted: {"node":"23.3.0"} (current: {"node":"v23.4.0","pnpm":"9.4.0"})
> eliza@ smokeTests /home/runner/work/eliza/eliza
> bash ./scripts/smokeTests.sh
node version:
v23.4.0
python version:
Python 3.10.12
make version:
GNU Make 4.3
Built for x8[6](https://github.com/ai16z/eliza/actions/runs/12322632866/job/34396607559#step:5:7)_64-pc-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
gcc version:
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
g++ version:
g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
.                                        |  WARN  Unsupported engine: wanted: {"node":"23.3.0"} (current: {"node":"v23.4.0","pnpm":"9.4.0"})
docs                                     |  WARN  Unsupported engine: wanted: {"node":"23.3.0"} (current: {"node":"v23.4.0","pnpm":"9.4.0"})
Scope: all 38 workspace projects
 ERR_PNPM_OUTDATED_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up to date with package.json
Note that in CI environments this setting is true by default. If you still need to run install in such cases, use "pnpm install --no-frozen-lockfile"
    Failure reason:
    specifiers in the lockfile ({"@0glabs/0g-ts-sdk":"0.2.1","@coinbase/coinbase-sdk":"0.10.0","@vitest/eslint-plugin":"1.0.1","amqplib":"0.10.5","csv-parse":"5.6.0","ollama-ai-provider":"0.16.1","optional":"0.1.4","pnpm":"9.14.4","sharp":"0.33.5","tslog":"4.9.3","@commitlint/cli":"18.6.1","@commitlint/config-conventional":"18.6.3","@typescript-eslint/eslint-plugin":"8.16.0","@typescript-eslint/parser":"8.16.0","concurrently":"9.1.0","cross-env":"[7](https://github.com/ai16z/eliza/actions/runs/12322632866/job/34396607559#step:5:8).0.3","eslint":"9.16.0","eslint-config-prettier":"9.1.0","husky":"9.1.7","lerna":"[8](https://github.com/ai16z/eliza/actions/runs/12322632866/job/34396607559#step:5:9).1.5","only-allow":"1.2.1","prettier":"3.4.1","turbo":"2.3.3","typedoc":"0.26.11","typescript":"5.6.3","vite":"5.4.11","vitest":"2.1.5","zx":"^8.2.4"}) don't match specs in package.json ({"@commitlint/cli":"18.6.1","@commitlint/config-conventional":"18.6.3","@typescript-eslint/eslint-plugin":"8.16.0","@typescript-eslint/parser":"8.16.0","@vitest/eslint-plugin":"1.0.1","concurrently":"[9](https://github.com/ai16z/eliza/actions/runs/12322632866/job/34396607559#step:5:10).1.0","cross-env":"7.0.3","eslint":"9.16.0","eslint-config-prettier":"9.1.0","husky":"9.1.7","lerna":
 WARN  Unsupported engine: wanted: {"node":"23.3.0"} (current: {"node":"v23.4.0","pnpm":"9.4.0"})
> eliza@ build /home/runner/work/eliza/eliza
> turbo run build --filter=!eliza-docs
sh: 1: turbo: not found
 ELIFECYCLE  Command failed.
 WARN   Local package.json exists, but node_modules missing, did you mean to install?
/tmp/tmp.bKYIj6ruZs
node:internal/modules/run_main:[10](https://github.com/ai16z/eliza/actions/runs/12322632866/job/34396607559#step:5:11)4
    triggerUncaughtException(
    ^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'ts-node' imported from /home/runner/work/eliza/eliza/agent/
    at Object.getPackageJSONURL (node:internal/modules/package_json_reader:267:9)
    at packageResolve (node:internal/modules/esm/resolve:768:81)
    at moduleResolve (node:internal/modules/esm/resolve:854:18)
    at defaultResolve (node:internal/modules/esm/resolve:984:[11](https://github.com/ai16z/eliza/actions/runs/12322632866/job/34396607559#step:5:12))
    at nextResolve (node:internal/modules/esm/hooks:748:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:240:30)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:584:35)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:242:38)
    at onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:546:36)
    at TracingChannel.tracePromise (node:diagnostics_channel:344:[14](https://github.com/ai16z/eliza/actions/runs/12322632866/job/34396607559#step:5:15)) {
  code: 'ERR_MODULE_NOT_FOUND'
}
Node.js v23.4.0

and

Run pnpm install -r
.                                        |  WARN  Unsupported engine: wanted: {"node":"23.3.0"} (current: {"node":"v23.4.0","pnpm":"9.4.0"})
docs                                     |  WARN  Unsupported engine: wanted: {"node":"23.3.0"} (current: {"node":"v23.4.0","pnpm":"9.4.0"})
Scope: all 38 workspace projects
 ERR_PNPM_OUTDATED_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up to date with package.json

Note that in CI environments this setting is true by default. If you still need to run install in such cases, use "pnpm install --no-frozen-lockfile"

    Failure reason:
    specifiers in the lockfile ({"@0glabs/0g-ts-sdk":"0.2.1","@coinbase/coinbase-sdk":"0.10.0","@vitest/eslint-plugin":"1.0.1","amqplib":"0.10.5","csv-parse":"5.[6](https://github.com/ai16z/eliza/actions/runs/12322632866/job/34396607559#step:5:7).0","ollama-ai-provider":"0.16.1","optional":"0.1.4","pnpm":"9.14.4","sharp":"0.33.5","tslog":"4.9.3","@commitlint/cli":"18.6.1","@commitlint/config-conventional":"18.6.3","@typescript-eslint/eslint-plugin":"8.16.0","@typescript-eslint/parser":"8.16.0","concurrently":"9.1.0","cross-env":"[7](https://github.com/ai16z/eliza/actions/runs/12322632866/job/34396607559#step:5:8).0.3","eslint":"9.16.0","eslint-config-prettier":"9.1.0","husky":"9.1.7","lerna":"8.1.5","only-allow":"1.2.1","prettier":"3.4.1","turbo":"2.3.3","typedoc":"0.26.11","typescript":"5.6.3","vite":"5.4.11","vitest":"2.1.5","zx":"^[8](https://github.com/ai16z/eliza/actions/runs/12322632866/job/34396607559#step:5:9).2.4"}) don't match specs in package.json ({"@commitlint/cli":"18.6.1","@commitlint/config-conventional":"18.6.3","@typescript-eslint/eslint-plugin":"8.16.0","@typescript-eslint/parser":"8.16.0","@vitest/eslint-plugin":"1.0.1","concurrently":"[9](https://github.com/ai16z/eliza/actions/runs/12322632866/job/34396607559#step:5:10).1.0","cross-env":"7.0.3","eslint":"9.16.0","eslint-config-prettier":"9.1.0","husky":"9.1.7","lerna":"8.1.5","only-allow":"1.2.1","prettier":"3.4.1","turbo":"2.3.3","typedoc":"0.26.11","typescript":"5.6.3","vite":"5.4.11","vitest":"2.1.5","zx":"^8.2.4","@0glabs/0g-ts-sdk":"0.2.1","@coinbase/coinbase-sdk":"0.[10](https://github.com/ai16z/eliza/actions/runs/12322632866/job/34396607559#step:5:11).0","@deepgram/sdk":"^3.9.0","amqplib":"0.10.5","csv-parse":"5.6.0","ollama-ai-provider":"0.16.1","optional":"0.1.4","pnpm":"9.14.4","sharp":"0.33.5","tslog":"4.9.3"})
Error: Process completed with exit code 1.

@odilitime mentioned he may have submitted a PR that instituted a failing test and is talking a look. We don't currently have a rule that all tests must pass in the CI pipeline to be merged in yet although that will come soon

@odilitime
Copy link
Collaborator

to be clear, I'm not looking into it, I already tried to fix it. I'm just not trusting some of the CI tests until someone fixes them. This PR is fine.

@jkbrooks
Copy link
Contributor

gotcha, my b, cancelling my reversion @odilitime #1051 (comment) apologies @monilpat @aramxc

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.

5 participants