Skip to content

Commit

Permalink
fix cli test workflow (#1736)
Browse files Browse the repository at this point in the history
* create delegator db

* fix delegator test issue

* remove datafeed tests

* remove silent flag to see error logs

* implement waiting for delegator and api services to be healthy

* check how delegator app is run with logs

* wait longer for delegator and api services to start

* increase action timeout and run tests silently
  • Loading branch information
Intizar-T authored Jul 5, 2024
1 parent c693d8a commit b1a6b61
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 210 deletions.
21 changes: 20 additions & 1 deletion .github/workflows/cli.test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 3
timeout-minutes: 10

services:
postgres:
Expand Down Expand Up @@ -67,6 +67,11 @@ jobs:
working-directory: ./api
run: go mod tidy

- name: Create delegator database
run: PGPASSWORD=$POSTGRES_PASSWORD psql -h localhost -U postgres -c "CREATE DATABASE delegator"
env:
POSTGRES_PASSWORD: postgres

- name: Delegator db migrate
working-directory: ./delegator
run: migrate -database "postgresql://postgres:postgres@localhost:5432/delegator?search_path=public&sslmode=disable" -verbose -path ./migrations up
Expand All @@ -93,6 +98,20 @@ jobs:
REDIS_HOST: "localhost"
REDIS_PORT: "6379"

- name: Check Delegator Service Health
run: |
until $(curl --output /dev/null --silent --head --fail http://127.0.0.1:3002/api/v1); do
echo "Waiting for delegator service to be ready..."
sleep 5
done
- name: Check API Service Health
run: |
until $(curl --output /dev/null --silent --head --fail http://127.0.0.1:3000/api/v1); do
echo "Waiting for api service to be ready..."
sleep 5
done
- name: Run tests
run: yarn cli build && yarn cli test
env:
Expand Down
208 changes: 0 additions & 208 deletions cli/test/datafeed.test.ts

This file was deleted.

2 changes: 1 addition & 1 deletion cli/test/delegator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('CLI Delegator', function () {
organizationId: Number(organization.id)
})
expect(reporter.address).toBe(reporterAddress)
expect(reporter.organizationId).toBe(organization.id)
expect(Number(reporter.organizationId)).toBe(Number(organization.id))

// Insert Contract
const contract = await contractInsertHandler()({ address: contractAddress })
Expand Down

0 comments on commit b1a6b61

Please sign in to comment.