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

Add integration test that starts blender example in goth #281

Merged
merged 8 commits into from
Mar 30, 2021

Conversation

azawlocki
Copy link
Contributor

@azawlocki azawlocki commented Mar 5, 2021

This PR adds a test case that runs our default blender example (examples/blender/blender.py) in a 2-provider test network started by goth.

The test serves mainly as a sanity check and an illustrative example of how to create more test cases using goth.

To run the test case on your local machine, do this in the root directory of the yapapi project:

$ poetry install -E integration-tests
$ pytest -svx  tests/goth/test_run_blender.py

Few basic properties are checked by monitoring output of the requestor script:

  1. Proposals are obtained from the market
  2. Agreement is negotiated with at least one provider
  3. All tasks are sent and computed
  4. For every agreement an invoice is accepted
  5. The executor finally shuts down
  6. The requestor script does not log any message with level ERROR

@azawlocki azawlocki marked this pull request as draft March 5, 2021 19:19
@azawlocki azawlocki force-pushed the integration-tests branch 15 times, most recently from e1cd13f to 475ab70 Compare March 10, 2021 16:50
@@ -0,0 +1,62 @@
# Note: values of keys denoting paths are resolved relative to the directory
# in which this file is located.
# The tokens `~` and `~user` are also replaced by the corresponding users's
Copy link
Contributor

@filipgolem filipgolem Mar 10, 2021

Choose a reason for hiding this comment

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

Suggested change
# The tokens `~` and `~user` are also replaced by the corresponding users's
# The tokens `~` and `~user` are also replaced by user's

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file is now (as of f16cc5a) generated by goth in a separate workflow step.

@azawlocki azawlocki force-pushed the integration-tests branch 2 times, most recently from 556cb07 to c03d5bb Compare March 11, 2021 08:02
@azawlocki azawlocki marked this pull request as ready for review March 25, 2021 09:32
@azawlocki azawlocki changed the title [WIP] Add integration test that starts blender example in goth Add integration test that starts blender example in goth Mar 25, 2021
@azawlocki azawlocki requested review from shadeofblue, kmazurek and a team March 25, 2021 10:00
Copy link
Contributor

@kmazurek kmazurek left a comment

Choose a reason for hiding this comment

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

Looks good, left some minor comments. I am somewhat worried about the maintainability of goth assets, but that's a separate discussion.

# - <your-branch> # put your branch name here to test it @ GH Actions
pull_request:
branches:
- master
Copy link
Contributor

Choose a reason for hiding this comment

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

The workflow tests.yml includes release branches (i.e. - b0.*) on pushes and pull requests. Perhaps they should be added here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added them in 0d80b77

- "8545:8545"

zksync:
image: docker.pkg.github.com/golemfactory/yagna-zksync/yagna-zksync-mock:7a25ed913d4a
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
image: docker.pkg.github.com/golemfactory/yagna-zksync/yagna-zksync-mock:7a25ed913d4a
image: docker.pkg.github.com/golemfactory/yagna-zksync/yagna-zksync-mock:f6d0cf02f6bc

I just realised updating these image hashes is going to be troublesome once tests are split out into project repos. :x

class: "goth.runner.probe.RequestorProbe"

- name: "VM-Wasm-Provider"
class: "goth.runner.provider.ProviderProbeWithLogSteps"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
class: "goth.runner.provider.ProviderProbeWithLogSteps"
class: "goth.runner.provider.ProviderProbe"

Once golemfactory/goth#454 is merged. I'm getting more and more skeptical about having these assets duplicated across repos. :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I've removed the asset files from the repository and instead added a command that creates them every time the tests are run -- see f16cc5a

# - <your-branch> # put your branch name here to test it @ GH Actions
pull_request:
branches:
- master
Copy link
Contributor

Choose a reason for hiding this comment

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

"On pull request" action for yajsapi unit tests looks like this:

Suggested change
- master
- master
- b0.*

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added in 0d80b77

@@ -37,10 +37,11 @@ toml = "^0.10.1"
srvresolver = "^0.3.5"
colorama = "^0.4.4"

goth = {git = "https://github.com/golemfactory/goth.git", branch = "master", optional = true, python = "^3.8.0"}
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 that there should be a comment explaining why goth was added as an optional dependency, not a dev dependency.

@azawlocki:

I couldn't make it work with goth as dev-dependency, as goth requires Python >= 3.8, which conflicts with Python >= 3.6 for the whole project. So goth is now installed with optional = "true" and python = "^3.8.0".
Perhaps it can be moved to dev-dependencies (it would be an optional dev-dependency then, I'm not sure if that would work though).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

a comment added in 0d80b77

pyproject.toml Outdated Show resolved Hide resolved
poetry install -E integration-tests

- name: Log in to GitHub Docker repository
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u ${{github.actor}} --password-stdin
Copy link
Collaborator

@shadeofblue shadeofblue Mar 29, 2021

Choose a reason for hiding this comment

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

do we still need this log-in given that goth repo is now public?

Copy link
Contributor

Choose a reason for hiding this comment

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

We still need this for two reasons:

  1. Pointing the Docker daemon to GitHub's package registry (by default it only uses hub.docker.com).
  2. Basic authentication, I believe this is similar to using GitHub's REST API, i.e. you still need to provide a personal token even when accessing public endpoints, presumably to handle stuff like rate limiting.

@@ -1,6 +1,6 @@
[build-system]
requires = ["poetry"]
build-backend = "poetry.masonry.api"
requires = ["poetry_core>=1.0.0"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

@azawlocki just out of curiosity - where do thse changes come from?

Copy link
Contributor Author

@azawlocki azawlocki Mar 29, 2021

Choose a reason for hiding this comment

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

From the remarks in https://python-poetry.org/docs/pyproject/#poetry-and-pep-517 (I was reading that file looking for a way to add goth as an extra/optional dependency).


[tool.poetry.extras]
cli = ['fire', 'rich']

integration-tests = ['goth', 'pytest', 'pytest-asyncio']
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Copy link
Collaborator

@shadeofblue shadeofblue left a comment

Choose a reason for hiding this comment

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

good_job_pony

@azawlocki azawlocki merged commit 404bbb0 into master Mar 30, 2021
@azawlocki azawlocki deleted the integration-tests branch March 30, 2021 10:28
@azawlocki azawlocki linked an issue Apr 8, 2021 that may be closed by this pull request
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.

CI for yapapi using goth
4 participants