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: add foundation for e2e testing using docker #41

Merged
merged 7 commits into from
Sep 27, 2023

Conversation

ryanchristo
Copy link
Member

@ryanchristo ryanchristo commented Aug 31, 2023

Ref: #16

This pull request sets the foundation for continuous integration tests for the indexer (#16) and was used to test #22. A followup pull request is still needed for #16 to be resolved but this provides some visibility that would be valuable in the meantime.

How to test

View test logs for github actions:

Also, if you want to use for testing locally:

Build docker containers (this takes some time but only needs to be run once or after updating docker files):

docker-compose build

Run docker containers (and continue running non-tester containers after test scripts):

docker-compose up

Run docker containers (and stop all containers after test scripts):

docker-compose up --abort-on-container-exit --exit-code-from tester

Stop and remove containers (clean up previous run before running again):

docker-compose down

Base automatically changed from kyle/22-index-votes to main September 12, 2023 20:59
Comment on lines 3 to 9
on:
push:
# branches:
# - main
pull_request:
# branches:
# - main
Copy link
Member Author

Choose a reason for hiding this comment

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

We can leave this as is for now or re-enable for pushes to main and pull requests against main before merging.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think a good start for this would to have it run on pull requests against main before merging.
Even thought you said it takes a few minutes for these to run, it can and will provide good value.
And I'm sure that's something that can be sped up eventually.

Copy link
Member Author

@ryanchristo ryanchristo Sep 27, 2023

Choose a reason for hiding this comment

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

Sorry, my comment was a bit confusing. Currently with these lines commented out, it will run for every push and every pull request. I had to do this in order for the tests to run in this pull request (before being merged into main). The alternative would be to limit these to running only on push to main and pull request against main.

Copy link
Member Author

Choose a reason for hiding this comment

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

Either way, uncommented for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, looks like tests are running on this pull request even after uncommenting and not sure why I needed to comment out the first time. Maybe a momentary github actions issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good!

Comment on lines +40 to +46
# TODO(#42): executor result should be success after successful execution

# check proposal executor result
#if ! psql "$DATABASE_URL" -c "SELECT * FROM proposals WHERE proposal_id=$proposal_id AND executor_result=PROPOSAL_EXECUTOR_RESULT_SUCCESS;"; then
# echo "indexed proposal with PROPOSAL_EXECUTOR_RESULT_SUCCESS not found"
# exit 1
#fi
Copy link
Member Author

Choose a reason for hiding this comment

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

#42

@ryanchristo ryanchristo marked this pull request as ready for review September 14, 2023 22:06
@ryanchristo ryanchristo changed the title test: docker test setup and test index votes test: add foundation for e2e testing using docker Sep 14, 2023
@ryanchristo ryanchristo requested a review from a team September 14, 2023 22:15
docker/ledger.Dockerfile Outdated Show resolved Hide resolved
docker/ledger.Dockerfile Outdated Show resolved Hide resolved
docker/tester.Dockerfile Outdated Show resolved Hide resolved
docker/ledger.Dockerfile Outdated Show resolved Hide resolved
RUN pip install load_dotenv
RUN pip install psycopg2
RUN pip install sentry_sdk
RUN pip install tenacity
Copy link
Contributor

Choose a reason for hiding this comment

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

Lines 15-18 shouldn't be necessary, poetry install should pick these up since we included them as dependencies via poetry as a package manager

Copy link
Contributor

@wgwz wgwz Sep 27, 2023

Choose a reason for hiding this comment

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

i.e. https://github.com/regen-network/indexer/blob/main/poetry.lock#L258

poetry.lock and poetry install are basically like package.lock and npm install in the python world

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! Yea, for some reason I was hitting errors that these were not installed but that was awhile back and seems to be working fine without these lines now. Not sure why that was an issue previously.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah! Nvm, still hitting the same errors when starting the containers:

ModuleNotFoundError: No module named 'dotenv'

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm going to leave them for now but maybe there is something we can do to prevent needing them in the future.

Copy link
Contributor

Choose a reason for hiding this comment

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

huh, that's weird

Copy link
Contributor

@wgwz wgwz left a comment

Choose a reason for hiding this comment

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

LGTM, left some small comments and also tACK (i tried this locally and worked for me!)

Only other thing i can think is maybe you can add these instructions into a readme.
We've needed a readme in the repo for a while, maybe for now you could just create a basic template for the readme, add these instructions, and then the rest of the readme gets filled out at later time
WDYT?

@ryanchristo
Copy link
Member Author

Only other thing i can think is maybe you can add these instructions into a readme.
We've needed a readme in the repo for a while, maybe for now you could just create a basic template for the readme, add these instructions, and then the rest of the readme gets filled out at later time
WDYT?

Yea, I can add a template with instructions. Good idea.

@ryanchristo ryanchristo merged commit 0d38d66 into main Sep 27, 2023
1 check passed
@ryanchristo ryanchristo deleted the ryan/22-docker-and-test branch September 27, 2023 21:13
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