openshift-eng / elliott

Apache License 2.0
15 stars 28 forks source link

Move to another API to list advisory builds #553

Closed vfreex closed 1 year ago

vfreex commented 1 year ago

API /api/v1/erratum/{id}/builds_list seems to be problematic. With advisory 114782 it is missing one build.

Use /api/v1/erratum/{id}/builds instead.

openshift-bot commented 1 year ago

Build #1

.package create: /mnt/workspace/jenkins/working/art-tools_elliott_PR-553/.tox/.package
.package installdeps: setuptools>=65.5.1, setuptools_scm[toml]>=6.2
/mnt/workspace/jenkins/working/art-tools_elliott_PR-553/.tox/.package/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py:66: _BetaConfiguration: Support for `[tool.setuptools]` in `pyproject.toml` is still *beta*.
  config = read_configuration(filepath, True, ignore_option_errors, dist)
/mnt/workspace/jenkins/working/art-tools_elliott_PR-553/.tox/.package/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py:66: _BetaConfiguration: Support for `[tool.setuptools]` in `pyproject.toml` is still *beta*.
  config = read_configuration(filepath, True, ignore_option_errors, dist)
py38 create: /mnt/workspace/jenkins/working/art-tools_elliott_PR-553/.tox/py38
py38 installdeps: .[tests]
py38 inst: /mnt/workspace/jenkins/working/art-tools_elliott_PR-553/.tox/.tmp/package/1/rh-elliott-2.0.15.dev74+gd710838.tar.gz
py38 installed: aiodns==3.0.0,aiohttp==3.8.4,aiosignal==1.3.1,astroid==2.15.5,async-timeout==4.0.2,asynctest==0.13.0,attrs==23.1.0,Brotli==1.0.9,cachetools==5.3.0,cchardet==2.1.7,certifi==2023.5.7,cffi==1.15.1,chardet==5.1.0,charset-normalizer==3.1.0,click==8.1.3,colorama==0.4.6,coverage==7.2.6,decorator==5.1.1,defusedxml==0.7.1,dill==0.3.6,distlib==0.3.6,errata-tool==1.30.0,exceptiongroup==1.1.1,filelock==3.12.0,flake8==6.0.0,flexmock==0.11.3,frozenlist==1.3.3,future==0.18.3,gssapi==1.8.2,idna==3.4,iniconfig==2.0.0,isort==5.12.0,jira==3.5.0,jsonpath-rw==1.4.0,koji==1.33.0,lazy-object-proxy==1.9.0,mccabe==0.7.0,mock==5.0.2,multidict==6.0.4,mypy==1.3.0,mypy-extensions==1.0.0,oauthlib==3.2.2,packaging==23.1,platformdirs==3.5.1,pluggy==1.0.0,ply==3.11,pycares==4.3.0,pycodestyle==2.10.0,pycparser==2.21,pyflakes==3.0.1,pygit2==1.10.1,pylint==2.17.4,pyproject-api==1.5.1,pytest==7.3.1,python-bugzilla==3.2.0,python-dateutil==2.8.2,PyYAML==6.0,requests==2.31.0,requests-gssapi==1.2.3,requests-oauthlib==1.3.1,requests-toolbelt==1.0.0,rh-elliott @ file:///mnt/workspace/jenkins/working/art-tools_elliott_PR-553/.tox/.tmp/package/1/rh-elliott-2.0.15.dev74%2Bgd710838.tar.gz,ruamel.yaml==0.17.26,ruamel.yaml.clib==0.2.7,semver==3.0.0,six==1.16.0,tenacity==8.2.2,tomli==2.0.1,tomlkit==0.11.8,tox==4.5.1,typing-extensions==4.6.1,urllib3==2.0.2,virtualenv==20.23.0,wrapt==1.15.0,yarl==1.9.2
py38 run-test-pre: PYTHONHASHSEED='1163161108'
py38 run-test: commands[0] | coverage run --branch --source elliottlib -m unittest discover -t . -s tests/
..............................................Cannot find any corresponding flaw bugs for these trackers: [13]. These trackers do not have a valid whiteboard component value: [12].
..BZ 9 is ignored because its status was MODIFIED at the moment of sweep cutoff (2021-06-30 12:30:00), however its status changed back to ['ASSIGNED'] afterwards
.......................changed 123 from status1 to status2
.123 is already on status1
.changed 123 from status1 to status2
..changed 123 from status1 to status2
.123 is already on status1
.changed 123 from status1 to status2
.....................F.F......................................................................../mnt/workspace/jenkins/working/art-tools_elliott_PR-553/.tox/py38/lib64/python3.8/site-packages/aiohttp/client.py:342: ResourceWarning: Unclosed client session <aiohttp.client.ClientSession object at 0x7f53afd02970>
  _warnings.warn(
ResourceWarning: Enable tracemalloc to get the object allocation traceback
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f53afd02970>
......
======================================================================
FAIL: test_get_builds (tests.test_errata_async.TestAsyncErrataAPI)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python3.8/unittest/async_case.py", line 65, in _callTestMethod
    self._callMaybeAsync(method)
  File "/usr/lib64/python3.8/unittest/async_case.py", line 88, in _callMaybeAsync
    return self._asyncioTestLoop.run_until_complete(fut)
  File "/usr/lib64/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/usr/lib64/python3.8/unittest/async_case.py", line 102, in _asyncioLoopRunner
    ret = await awaitable
  File "/mnt/workspace/jenkins/working/art-tools_elliott_PR-553/.tox/py38/lib/python3.8/site-packages/mock/mock.py", line 1440, in patched
    return await func(*newargs, **newkeywargs)
  File "/mnt/workspace/jenkins/working/art-tools_elliott_PR-553/tests/test_errata_async.py", line 65, in test_get_builds
    _make_request.assert_awaited_once_with(ANY, "GET", "/api/v1/erratum/1/builds_list")
  File "/mnt/workspace/jenkins/working/art-tools_elliott_PR-553/.tox/py38/lib/python3.8/site-packages/mock/mock.py", line 270, in wrapper
    return getattr(mock.mock, attr)(*args, **kwargs)
  File "/mnt/workspace/jenkins/working/art-tools_elliott_PR-553/.tox/py38/lib/python3.8/site-packages/mock/mock.py", line 2375, in assert_awaited_once_with
    return self.assert_awaited_with(*args, **kwargs)
  File "/mnt/workspace/jenkins/working/art-tools_elliott_PR-553/.tox/py38/lib/python3.8/site-packages/mock/mock.py", line 2363, in assert_awaited_with
    raise AssertionError(_error_message()) from cause
AssertionError: expected await not found.
Expected: _make_request(<ANY>, 'GET', '/api/v1/erratum/1/builds_list')
Actual: _make_request(<elliottlib.errata_async.AsyncErrataAPI object at 0x7f53ae3425e0>, 'GET', '/api/v1/erratum/1/builds')

======================================================================
FAIL: test_get_builds_flattened (tests.test_errata_async.TestAsyncErrataAPI)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python3.8/unittest/async_case.py", line 65, in _callTestMethod
    self._callMaybeAsync(method)
  File "/usr/lib64/python3.8/unittest/async_case.py", line 88, in _callMaybeAsync
    return self._asyncioTestLoop.run_until_complete(fut)
  File "/usr/lib64/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/usr/lib64/python3.8/unittest/async_case.py", line 102, in _asyncioLoopRunner
    ret = await awaitable
  File "/mnt/workspace/jenkins/working/art-tools_elliott_PR-553/.tox/py38/lib/python3.8/site-packages/mock/mock.py", line 1440, in patched
    return await func(*newargs, **newkeywargs)
  File "/mnt/workspace/jenkins/working/art-tools_elliott_PR-553/tests/test_errata_async.py", line 77, in test_get_builds_flattened
    _make_request.assert_awaited_once_with(ANY, "GET", "/api/v1/erratum/1/builds_list")
  File "/mnt/workspace/jenkins/working/art-tools_elliott_PR-553/.tox/py38/lib/python3.8/site-packages/mock/mock.py", line 270, in wrapper
    return getattr(mock.mock, attr)(*args, **kwargs)
  File "/mnt/workspace/jenkins/working/art-tools_elliott_PR-553/.tox/py38/lib/python3.8/site-packages/mock/mock.py", line 2375, in assert_awaited_once_with
    return self.assert_awaited_with(*args, **kwargs)
  File "/mnt/workspace/jenkins/working/art-tools_elliott_PR-553/.tox/py38/lib/python3.8/site-packages/mock/mock.py", line 2363, in assert_awaited_with
    raise AssertionError(_error_message()) from cause
AssertionError: expected await not found.
Expected: _make_request(<ANY>, 'GET', '/api/v1/erratum/1/builds_list')
Actual: _make_request(<elliottlib.errata_async.AsyncErrataAPI object at 0x7f53ae270130>, 'GET', '/api/v1/erratum/1/builds')

----------------------------------------------------------------------
Ran 177 tests in 0.876s

FAILED (failures=2)
To fix missing builds in other advisories:
Remove builds: find-builds -k image -a 42 -b operand-nvr-1-0 --remove
Add builds: Same command but without --remove and -a `<target_advisory>`
ERROR: InvocationError for command /mnt/workspace/jenkins/working/art-tools_elliott_PR-553/.tox/py38/bin/coverage run --branch --source elliottlib -m unittest discover -t . -s tests/ (exited with code 1)
___________________________________ summary ____________________________________
ERROR:   py38: commands failed
openshift-bot commented 1 year ago

Build #2

/mnt/workspace/jenkins/working/art-tools_elliott_PR-553/.tox/.package/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py:66: _BetaConfiguration: Support for `[tool.setuptools]` in `pyproject.toml` is still *beta*.
  config = read_configuration(filepath, True, ignore_option_errors, dist)
/mnt/workspace/jenkins/working/art-tools_elliott_PR-553/.tox/.package/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py:66: _BetaConfiguration: Support for `[tool.setuptools]` in `pyproject.toml` is still *beta*.
  config = read_configuration(filepath, True, ignore_option_errors, dist)
py38 inst-nodeps: /mnt/workspace/jenkins/working/art-tools_elliott_PR-553/.tox/.tmp/package/1/rh-elliott-2.0.15.dev75+ga5b1d84.tar.gz
py38 installed: aiodns==3.0.0,aiohttp==3.8.4,aiosignal==1.3.1,astroid==2.15.5,async-timeout==4.0.2,asynctest==0.13.0,attrs==23.1.0,Brotli==1.0.9,cachetools==5.3.0,cchardet==2.1.7,certifi==2023.5.7,cffi==1.15.1,chardet==5.1.0,charset-normalizer==3.1.0,click==8.1.3,colorama==0.4.6,coverage==7.2.6,decorator==5.1.1,defusedxml==0.7.1,dill==0.3.6,distlib==0.3.6,errata-tool==1.30.0,exceptiongroup==1.1.1,filelock==3.12.0,flake8==6.0.0,flexmock==0.11.3,frozenlist==1.3.3,future==0.18.3,gssapi==1.8.2,idna==3.4,iniconfig==2.0.0,isort==5.12.0,jira==3.5.0,jsonpath-rw==1.4.0,koji==1.33.0,lazy-object-proxy==1.9.0,mccabe==0.7.0,mock==5.0.2,multidict==6.0.4,mypy==1.3.0,mypy-extensions==1.0.0,oauthlib==3.2.2,packaging==23.1,platformdirs==3.5.1,pluggy==1.0.0,ply==3.11,pycares==4.3.0,pycodestyle==2.10.0,pycparser==2.21,pyflakes==3.0.1,pygit2==1.10.1,pylint==2.17.4,pyproject-api==1.5.1,pytest==7.3.1,python-bugzilla==3.2.0,python-dateutil==2.8.2,PyYAML==6.0,requests==2.31.0,requests-gssapi==1.2.3,requests-oauthlib==1.3.1,requests-toolbelt==1.0.0,rh-elliott @ file:///mnt/workspace/jenkins/working/art-tools_elliott_PR-553/.tox/.tmp/package/1/rh-elliott-2.0.15.dev75%2Bga5b1d84.tar.gz,ruamel.yaml==0.17.26,ruamel.yaml.clib==0.2.7,semver==3.0.0,six==1.16.0,tenacity==8.2.2,tomli==2.0.1,tomlkit==0.11.8,tox==4.5.1,typing-extensions==4.6.1,urllib3==2.0.2,virtualenv==20.23.0,wrapt==1.15.0,yarl==1.9.2
py38 run-test-pre: PYTHONHASHSEED='3319604571'
py38 run-test: commands[0] | coverage run --branch --source elliottlib -m unittest discover -t . -s tests/
..............................................Cannot find any corresponding flaw bugs for these trackers: [13]. These trackers do not have a valid whiteboard component value: [12].
..BZ 9 is ignored because its status was MODIFIED at the moment of sweep cutoff (2021-06-30 12:30:00), however its status changed back to ['ASSIGNED'] afterwards
.......................changed 123 from status1 to status2
.123 is already on status1
.changed 123 from status1 to status2
..changed 123 from status1 to status2
.123 is already on status1
.changed 123 from status1 to status2
............................................................................................../mnt/workspace/jenkins/working/art-tools_elliott_PR-553/.tox/py38/lib64/python3.8/site-packages/aiohttp/client.py:342: ResourceWarning: Unclosed client session <aiohttp.client.ClientSession object at 0x7f54f28faf70>
  _warnings.warn(
ResourceWarning: Enable tracemalloc to get the object allocation traceback
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f54f28faf70>
......
----------------------------------------------------------------------
Ran 177 tests in 0.882s

OK
To fix missing builds in other advisories:
Remove builds: find-builds -k image -a 42 -b operand-nvr-1-0 --remove
Add builds: Same command but without --remove and -a `<target_advisory>`
py38 run-test: commands[1] | coverage report
Name                                              Stmts   Miss Branch BrPart  Cover
-----------------------------------------------------------------------------------
elliottlib/__init__.py                               12      7      2      1    43%
elliottlib/_version.py                                2      2      0      0     0%
elliottlib/assembly.py                              131     39     76      7    67%
elliottlib/assertion.py                              11      0      6      0   100%
elliottlib/brew.py                                  336    195    134      5    36%
elliottlib/bug/__init__.py                            0      0      0      0   100%
elliottlib/build_finder.py                          114     12     74     15    86%
elliottlib/bzutil.py                                852    347    344     28    55%
elliottlib/cincinnati.py                             21     21      4      0     0%
elliottlib/cli/__init__.py                            0      0      0      0   100%
elliottlib/cli/__main__.py                          272    272     75      0     0%
elliottlib/cli/add_metadata_cli.py                   28     28      4      0     0%
elliottlib/cli/advisory_commons_cli.py               90     90     38      0     0%
elliottlib/cli/advisory_drop_cli.py                  39     39     14      0     0%
elliottlib/cli/advisory_images_cli.py                14     14      2      0     0%
elliottlib/cli/advisory_impetus_cli.py               22     22      6      0     0%
elliottlib/cli/attach_bugs_cli.py                    37     37     18      0     0%
elliottlib/cli/attach_cve_flaws_cli.py              130     66     58      9    45%
elliottlib/cli/change_state_cli.py                   44     44     16      0     0%
elliottlib/cli/cli_opts.py                           15      0     17      0   100%
elliottlib/cli/common.py                             48     12      6      1    69%
elliottlib/cli/create_cli.py                         70     70     20      0     0%
elliottlib/cli/create_placeholder_cli.py             36     36     12      0     0%
elliottlib/cli/create_textonly_cli.py                51     51      8      0     0%
elliottlib/cli/find_bugs_blocker_cli.py              43      4     10      3    87%
elliottlib/cli/find_bugs_qe_cli.py                   36      4      6      0    90%
elliottlib/cli/find_bugs_sweep_cli.py               222     32    124     19    83%
elliottlib/cli/find_builds_cli.py                   269    200    179      2    19%
elliottlib/cli/find_unconsumed_rpms.py               98     98     56      0     0%
elliottlib/cli/get_golang_versions_cli.py            59     14     32      9    73%
elliottlib/cli/list_cli.py                           14     14      2      0     0%
elliottlib/cli/puddle_advisories_cli.py              34     34      8      0     0%
elliottlib/cli/remove_bugs_cli.py                    46      6     14      6    80%
elliottlib/cli/repair_bugs_cli.py                    61      5     26      6    87%
elliottlib/cli/rhcos_cli.py                          93     93     52      0     0%
elliottlib/cli/rpmdiff_cli.py                       102    102     34      0     0%
elliottlib/cli/tag_builds_cli.py                    128    128     62      0     0%
elliottlib/cli/tarball_sources_cli.py                83     83     26      0     0%
elliottlib/cli/validate_rhsa.py                      45     45     16      0     0%
elliottlib/cli/verify_attached_bugs_cli.py          266     94    171     20    57%
elliottlib/cli/verify_attached_operators_cli.py     160     56     80      5    60%
elliottlib/cli/verify_cvp_cli.py                    166    166     78      0     0%
elliottlib/constants.py                              52      0      0      0   100%
elliottlib/cvp.py                                   216    216    113      0     0%
elliottlib/dotconfig.py                              54     11     30      6    75%
elliottlib/errata.py                                344    221    150      4    32%
elliottlib/errata_async.py                          160     20     62      9    86%
elliottlib/exceptions.py                             12      0      0      0   100%
elliottlib/exectools.py                              84      7     24      3    89%
elliottlib/gitdata.py                               171    137     76      0    14%
elliottlib/imagecfg.py                               21      2      0      0    90%
elliottlib/logutil.py                                 9      1      2      1    82%
elliottlib/metadata.py                              154     43     76     18    67%
elliottlib/model.py                                 105     22     30      2    79%
elliottlib/openshiftclient.py                        34     34      8      0     0%
elliottlib/pushd.py                                  21      0      2      0   100%
elliottlib/resultsdb.py                              28     28      4      0     0%
elliottlib/rhcos.py                                  80     80     16      0     0%
elliottlib/rpm_utils.py                              30     14     16      5    46%
elliottlib/rpmcfg.py                                  5      2      0      0    60%
elliottlib/rpmdiff.py                                31      0      0      0   100%
elliottlib/runtime.py                               278    202    106      2    22%
elliottlib/tarball_sources.py                        90     61     34      0    30%
elliottlib/util.py                                  297    139    110     15    50%
-----------------------------------------------------------------------------------
TOTAL                                              6576   3822   2769    201    39%
py38 run-test: commands[2] | flake8
___________________________________ summary ____________________________________
  py38: commands succeeded
  congratulations :)
locriandev commented 1 year ago

Is this meant to be permanent? Noticed you haven't bumped elliott yet

vfreex commented 1 year ago

@locriandev yes, it is permanent. Errata has some "duplicated" API endpoints and we can use another API endpoint to work around this.

Elliott will be bumped with Doozer on Friday.