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

test vaults and reserve indexing #38

Merged
merged 1 commit into from
Dec 24, 2024
Merged

Conversation

rabi-siddique
Copy link
Collaborator

@rabi-siddique rabi-siddique commented Dec 19, 2024

This PR automates the testing of Vault and Reserve entities using GraphQL queries to enhance flexibility in matching expected values. It also removes the test cases previously written with @subql/testing, which were restrictive due to issues with dates.

@rabi-siddique rabi-siddique changed the base branch from main to rs-automate-liquidation-testing December 19, 2024 09:22
@rabi-siddique rabi-siddique force-pushed the rs-vault-testing branch 19 times, most recently from 954545d to c591541 Compare December 19, 2024 11:55
@rabi-siddique rabi-siddique changed the title vaults and reserve indexing test vaults and reserve indexing Dec 19, 2024
@rabi-siddique rabi-siddique force-pushed the rs-vault-testing branch 6 times, most recently from d63b5ee to 5f95b40 Compare December 19, 2024 12:53

- name: Wait for GraphQL server
run: sleep 120

Copy link
Collaborator Author

@rabi-siddique rabi-siddique Dec 19, 2024

Choose a reason for hiding this comment

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

For a lesser waiting period it tends to fail:

./scripts/validateData.mjs
API URL set to: http://localhost:3000/
Entity: vaults, Block Height: 742
Error: (TypeError#1)
TypeError#1: fetch failed
  at Function.captureStackTrace (file:///home/runner/work/agoric-subql/agoric-subql/node_modules/ses/src/error/tame-v8-error-constructor.js:229:9)
  at node:internal/deps/undici/undici:12618:11
  at async file:///home/runner/work/agoric-subql/agoric-subql/scripts/validateData.mjs:24:20
TypeError#1 cause: (SocketError#2)
Nested error under TypeError#1
  SocketError#2: other side closed
    at Socket.onSocketEnd (node:internal/deps/undici/undici:9169:26)
    at Socket.emit (node:events:529:35)
    at endReadableNT (node:internal/streams/readable:1400:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

At 60 seconds wait, http://localhost:3000 consistently works and test pass.

Copy link
Member

Choose a reason for hiding this comment

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

Helpful to include a comment with what value you've found to be too small

Alternately, scripts/validateData.mjs could have a "wait and retry" but this is fine

Choose a reason for hiding this comment

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

@rabi-siddique I agree with Turadg's wait and retry suggestion. Such hardcoded sleep times cause flakiness in future. Something like following can be done (as a follow-up)

- name: Wait for GraphQL server to be ready
  run: |
    echo "Waiting for GraphQL server to be ready..."
    until curl -s -o /dev/null -w "%{http_code}" http://localhost:4000/graphql | grep -q "200"; do
      echo "GraphQL server is not ready yet. Retrying in 5 seconds..."
      sleep 5
    done
    echo "GraphQL server is ready!"
  shell: bash

@rabi-siddique rabi-siddique force-pushed the rs-vault-testing branch 11 times, most recently from 6831fd7 to f923a69 Compare December 19, 2024 14:13
Base automatically changed from rs-automate-liquidation-testing to rs-test December 20, 2024 03:34
@rabi-siddique rabi-siddique force-pushed the rs-vault-testing branch 5 times, most recently from 773091e to 4ae66aa Compare December 20, 2024 04:23
Comment on lines 40 to 42
- name: Set Execute Permission for All Scripts
run: chmod +x ./scripts/*.mjs

Copy link
Member

Choose a reason for hiding this comment

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

this should be done in SCM. Git maintains the execution flags.

Suggested change
- name: Set Execute Permission for All Scripts
run: chmod +x ./scripts/*.mjs


- name: Wait for GraphQL server
run: sleep 120

Copy link
Member

Choose a reason for hiding this comment

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

Helpful to include a comment with what value you've found to be too small

Alternately, scripts/validateData.mjs could have a "wait and retry" but this is fine

Comment on lines 50 to 51
blockHeight: 1212
apiUrl: 'http://localhost:3000/'
Copy link
Member

Choose a reason for hiding this comment

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

please move these repeated env vars to the job level

@rabi-siddique rabi-siddique force-pushed the rs-vault-testing branch 2 times, most recently from bf1abec to acbb7ed Compare December 24, 2024 07:19
Base automatically changed from rs-test to ta/ci-test December 24, 2024 07:20
@rabi-siddique rabi-siddique merged commit 8c46106 into ta/ci-test Dec 24, 2024
3 checks passed
@rabi-siddique rabi-siddique deleted the rs-vault-testing branch December 24, 2024 11:22
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.

4 participants