Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Add play command to project pipeline schedules#1069

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

twonds
Copy link
Contributor

@twondstwonds commentedApr 9, 2020
edited
Loading

I have added a custom play command to the project pipeline schedules.

I made a previous pull request#1068 but the commits were incorrect. I also fixed the lint errors.

Please let me know if I am missing anything else.

@twonds
Copy link
ContributorAuthor

Where would I add tests for this?

@twondstwondsforce-pushed thefeat/add-custom-pipeline-schedule-play branch fromfc76496 to48bc54fCompareApril 9, 2020 00:19
Copy link
Member

@max-wittigmax-wittig left a comment

Choose a reason for hiding this comment

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

Thanks for your MR! I've added a few comments

@max-wittig
Copy link
Member

Tests are a bit of a mess right now. You can add your tests here:https://github.com/python-gitlab/python-gitlab/blob/master/gitlab/tests/test_gitlab.py or use the newer structure and create a new file here
https://github.com/python-gitlab/python-gitlab/tree/master/gitlab/tests/objects

@twonds
Copy link
ContributorAuthor

Thanks for the feedback! I will make these changes!

@twondstwonds requested a review frommax-wittigApril 13, 2020 22:52
@twonds
Copy link
ContributorAuthor

I am having a tough time getting the tests to execute. Which command should I use? The python functionals tests for v4?

When I runtox -e py_func_v4 2>&1|tee test.log Things seem ok but the configuration isn't valid.

I get the following error.

gitlab Reconfigured!Config file content (/tmp/python-gitlab.cfg):[global]default = localtimeout = 30[local]url = http://localhost:8080private_token = api_version = 4Test environment initialized.Traceback (most recent call last):  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/gitlab/exceptions.py", line 279, in wrapped_f    return f(*args, **kwargs)  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/gitlab/mixins.py", line 470, in download    path, streamed=streamed, raw=True, **kwargs  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/gitlab/__init__.py", line 599, in http_get    "get", path, query_data=query_data, streamed=streamed, **kwargs  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/gitlab/__init__.py", line 574, in http_request    response_body=result.content,gitlab.exceptions.GitlabHttpError: 404: 404 Not found or has expired

@max-wittig
Copy link
Member

You can usetox.

tox -e py_func_v4# for functional tests (will spawn a docker container...)tox -e py38# for unit tests

@max-wittig
Copy link
Member

I've updated the test docs:#1073

@nejch
Copy link
Member

I am having a tough time getting the tests to execute. Which command should I use? The python functionals tests for v4?

When I runtox -e py_func_v4 2>&1|tee test.log Things seem ok but the configuration isn't valid.

I get the following error.

gitlab Reconfigured!Config file content (/tmp/python-gitlab.cfg):[global]default = localtimeout = 30[local]url = http://localhost:8080private_token = api_version = 4Test environment initialized.Traceback (most recent call last):  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/gitlab/exceptions.py", line 279, in wrapped_f    return f(*args, **kwargs)  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/gitlab/mixins.py", line 470, in download    path, streamed=streamed, raw=True, **kwargs  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/gitlab/__init__.py", line 599, in http_get    "get", path, query_data=query_data, streamed=streamed, **kwargs  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/gitlab/__init__.py", line 574, in http_request    response_body=result.content,gitlab.exceptions.GitlabHttpError: 404: 404 Not found or has expired

@twonds the command as Max said above should execute the tests. In your example above, did you remove the private_token from the output or is it empty? That would be an issue.

But the (rather cryptic) 404 error suggests something's wrong with the Project or Group Export test (see404 Not found or has expired). This is unrelated to your changes - the Group Export API is still a bit incomplete so maybe we're not waiting long enough for export creation. Do you consistently get this same error if you re-run tests?

@twonds
Copy link
ContributorAuthor

Thanks! Unit tests work and trying functional tests now. I will implement a test and update this pr

@twonds
Copy link
ContributorAuthor

This time on the functional tests gitlab seemed to come up but the tests did not execute due to a timeout. This timeout could be anything, I have not investigated. What are the minimum resources for running gitlab locally?

Waiting for GitLab to reconfigure.. (130s)Waiting for GitLab to reconfigure.. (135s)gitlab Reconfigured!Config file content (/tmp/python-gitlab.cfg):[global]default = localtimeout = 30[local]url = http://localhost:8080private_token = 8yVpYsVj_LQWx_D-EANrapi_version = 4Test environment initialized.Traceback (most recent call last):  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/.tox/py_func_v4/lib/python3.7/site-packages/urllib3/connectionpool.py", line 426, in _make_request    six.raise_from(e, None)  File "<string>", line 3, in raise_from  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/.tox/py_func_v4/lib/python3.7/site-packages/urllib3/connectionpool.py", line 421, in _make_request    httplib_response = conn.getresponse()  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1344, in getresponse    response.begin()  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 306, in begin    version, status, reason = self._read_status()  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 267, in _read_status    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 589, in readinto    return self._sock.recv_into(b)socket.timeout: timed outDuring handling of the above exception, another exception occurred:Traceback (most recent call last):  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/.tox/py_func_v4/lib/python3.7/site-packages/requests/adapters.py", line 449, in send    timeout=timeout  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/.tox/py_func_v4/lib/python3.7/site-packages/urllib3/connectionpool.py", line 725, in urlopen    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/.tox/py_func_v4/lib/python3.7/site-packages/urllib3/util/retry.py", line 403, in increment    raise six.reraise(type(error), error, _stacktrace)  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/.tox/py_func_v4/lib/python3.7/site-packages/urllib3/packages/six.py", line 735, in reraise    raise value  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/.tox/py_func_v4/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen    chunked=chunked,  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/.tox/py_func_v4/lib/python3.7/site-packages/urllib3/connectionpool.py", line 428, in _make_request    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/.tox/py_func_v4/lib/python3.7/site-packages/urllib3/connectionpool.py", line 336, in _raise_timeout    self, url, "Read timed out. (read timeout=%s)" % timeout_valueurllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=8080): Read timed out. (read timeout=30)During handling of the above exception, another exception occurred:Traceback (most recent call last):  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/tools/python_test_v4.py", line 526, in <module>    discussion = commit.discussions.get(discussion.id)  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/gitlab/exceptions.py", line 279, in wrapped_f    return f(*args, **kwargs)  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/gitlab/mixins.py", line 50, in get    server_data = self.gitlab.http_get(path, **kwargs)  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/gitlab/__init__.py", line 599, in http_get    "get", path, query_data=query_data, streamed=streamed, **kwargs  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/gitlab/__init__.py", line 537, in http_request    result = self.session.send(prepped, timeout=timeout, **settings)  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/.tox/py_func_v4/lib/python3.7/site-packages/requests/sessions.py", line 643, in send    r = adapter.send(request, **kwargs)  File "/Users/christopherzo/src/github.com/zillow/python-gitlab/.tox/py_func_v4/lib/python3.7/site-packages/requests/adapters.py", line 529, in send    raise ReadTimeout(e, request=request)requests.exceptions.ReadTimeout: HTTPConnectionPool(host='localhost', port=8080): Read timed out. (read timeout=30)ERROR: 'python /Users/christopherzo/src/github.com/zillow/python-gitlab/tools/python_test_v4.py' failedDeactivating Python virtualenv...Deleting python virtualenv...Stopping gitlab-test docker container...Done.ERROR: InvocationError for command /Users/christopherzo/src/github.com/zillow/python-gitlab/tools/py_functional_tests.sh -a 4 (exited with code 1)_________________________________________________________________________________________________ summary _________________________________________________________________________________________________ERROR:   py_func_v4: commands failed

@nejch
Copy link
Member

The Travis builds run on 2 cores with 7.5GB, but the functional tests do fail sometimes. I've also had issues with an 8GB VM with 2 cores.

It's actually possible the tests were running but failed somewhere randomly on timeout. Currently there's still not much visibility into what's happening with functional tests unless they explicitly fail on an assert. Is this consistently failing if you retry?

fix: remove version from setupfeat: add pipeline schedule play error exceptiondocs: add documentation for pipeline schedule play
@twondstwondsforce-pushed thefeat/add-custom-pipeline-schedule-play branch from212ea77 to07b9988CompareApril 20, 2020 23:18
@twonds
Copy link
ContributorAuthor

Is this consistently failing if you retry?

Yes, same error for each attempt

@twonds
Copy link
ContributorAuthor

I have added a test

@nejch
Copy link
Member

@twonds I think maybe your test was lost in your last force-push 😊

@twonds
Copy link
ContributorAuthor

twonds commentedApr 21, 2020
edited
Loading

I think maybe your test was lost in your last force-push 😊

Hah, I have been a poor contributor in this pull request. I can not get used to commit lint, causing git rebase screw ups. I also can not get functional tests working. :)

@nejch
Copy link
Member

I think maybe your test was lost in your last force-push blush

Hah, I have been a poor contributor in this pull request. I can not get used to commit lint, causing git rebase screw ups. I also can not get functional tests working. :)

Not at all, you've been very responsive :)

I can't see what you've tried for functional tests, but I just had a look and realized the functional tests would take a bit of scaffolding before you could even add a schedule play test, we'd first need a project with pipelines created and schedules etc, which aren't yet tested atm. So I wouldn't worry about it if it's too convoluted for a first contribution.

Since you have unit tests now, I'd just get the pipeline green again (run black withtox -e black, it's a bit opinionated about style so might clash with your linter) and ping the reviewers again ;)

@twonds
Copy link
ContributorAuthor

Thanks@nejch .@max-wittig I think this is ready. Thanks for your patience!

Copy link
Member

@max-wittigmax-wittig left a comment

Choose a reason for hiding this comment

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

@twonds Thanks for your patience!

@max-wittigmax-wittig merged commit9d66cb3 intopython-gitlab:masterApr 22, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@max-wittigmax-wittigmax-wittig approved these changes

Assignees

@twondstwonds

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@twonds@max-wittig@nejch

[8]ページ先頭

©2009-2025 Movatter.jp