Merge ~racb/git-ubuntu:integration-fixes into git-ubuntu:master

Proposed by Robie Basak
Status: Merged
Merged at revision: 1aa8baa53e61958bfb33e26614f79e946ac13c89
Proposed branch: ~racb/git-ubuntu:integration-fixes
Merge into: git-ubuntu:master
Diff against target: 273 lines (+213/-2)
5 files modified
debian/control (+1/-0)
gitubuntu/integration_test.py (+208/-0)
gitubuntu/source_builder.py (+1/-1)
snap-wrappers/wrappers/reconstruct-changelog (+1/-1)
snap/snapcraft.yaml (+2/-0)
Reviewer Review Type Date Requested Status
Bryce Harrington Approve
Server Team CI bot continuous-integration Approve
Christian Ehrhardt  Needs Fixing
Review via email: mp+404448@code.staging.launchpad.net

Commit message

Make Jenkins happy

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:fa330f02f0fb5874d2af825d74e589e1988bbf3e
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/40/
Executed test runs:
    SUCCESS: VM Setup
    SUCCESS: Build
    SUCCESS: VM Reset
    SUCCESS: Unit Tests
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/40//rebuild

review: Approve (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:42904d21aa2715441ececb96956491e46a7bb751
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/41/
Executed test runs:
    SUCCESS: VM Setup
    SUCCESS: Build
    SUCCESS: VM Reset
    SUCCESS: Unit Tests
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/41//rebuild

review: Approve (continuous-integration)
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :
Download full text (5.3 KiB)

7c43469 snapcraft: drop --enable-experimental-package-repositories

  Non important, but for proof this one could mention in the commit message where it was removed
   https://github.com/snapcore/snapcraft/commit/0662e630713b50ae1c4126eddb9b82fff133b6d0
   https://github.com/snapcore/snapcraft/pull/3520

2ac404f source_builder: fix test changelog sign-off line

  That is indeed the right format, and the tests pass still

d8edae8 Add integration test for sed

  Indeed it matches 67206b06 ("Add awk integration test")
  But "awk ''" will return with a good RC, yet OTOH "sed ''" will hang waiting for input.
  In the test it behaves the same :-/

  This hangs here at 2 and never reached 3
$ python3 -c 'import subprocess; print("1"); subprocess.check_call(["awk", ""]); print("2"); subprocess.check_call(["sed", ""]); print("3")'
1
2

I see the test bot passed and it does for
  $ python3.8 -m pytest gitubuntu/integration_test.py::test_sed_runnable).
This is due to the default capture settings in pytest, this one hangs:
  $ python3.8 -m pytest -s gitubuntu/integration_test.py::test_sed_runnable
So I wonder if we should here use the safer:
  subprocess.check_call(["sed", "--version"])

This works with both, otherwise you might one day need to debug anyother case, switch on -s to see the output and then this one blocks you hanging.

31dbb06 Fix and test update-maintainer integration

  +1 to the dependency fix as it was formerly only a build-dependency

  dist-packages/debian/changelog.py is a bit unhappy with our test skeleton file:
    changelog.py:484: UserWarning: Unexpected line while looking for more change data or trailer:
    changelog.py:484: UserWarning: Found eof where expected more change data or trailer

  While those are only internal warnings and the test works fine they could later
  break on us without actually being a finding on git ubuntu.
  The following would fix this.

- -- Test Maintainer <email address hidden> Tue, 01 Jun 2021 14:09:49
+ -- Test Maintainer <email address hidden> Tue, 01 Jun 2021 14:09:49 +0000

fa330f0 Test and fix git-ubuntu.reconstruct-changelog

 I saw these warnings:
   20: from gitubuntu.test_fixtures import pygit2_repo
     unused-import: Unused pygit2_repo imported from gitubuntu.test_fixtures
   167: def test_reconstruct_changelog(pygit2_repo, monkeypatch):
     redefinition of unused 'pygit2_repo' from line 20
 But they seem to be a false positive of my checker.

 Overall the integration of this test is more complex than the test itself and I appreaciate
 the huge comment block above the tree/entry point checks.
 The bot exercised case #5 and I did #4 and both work. I assume you have had a look
 at the others.
 This looks slightly over-complex still - why is ENTRY_POINT_MAP a cascaded map and
 get_entry_point using the name argument?
 Did this before need multiple dict entries?
 You could (for a bit of simplification) drop that double-indirection.

 But this commit LGTM +1 no changes needed unless you want to.

42904d2 Include all dpkg decompressors in the snap

 I wondered about the .deb dependencies, but indirectly they will be in (by apt/dpkg)
...

Read more...

review: Needs Fixing
Revision history for this message
Bryce Harrington (bryce) wrote :

Christian already gave a very thorough review (appreciated!) I just wanted to add a few minor comments...

2ac404fe
  - lgtm
  - The deb-changelog man page doesn't mention the two-space requirement, though it does show it in its example. I couldn't find if this is specified somewhere or is just convention, but in either case this looks correct.

d8edae83
  - Just to confirm what Christian already said, the test will indeed hang:
    >>> import subprocess
    >>> subprocess.check_call(['sed', ''])

    hang hang
    hang hang
    0
  - I agree for simple sanity checking passing --version or --help may suffice.

31dbb06d
  - The code docs for test_update_maintainer() have unbalanced double-quotes.
  - Also, you've used single-quotes for code docs in the other test cases in this file, you might want to do the same with this one for consistency (or update the other test cases in this file to use double-quotes).

fa330f02
  - In the else branch of the if statement that checs os.environ to determine the ENTRY_POINT_DIR, after checking if bindir exists, you can just assign ENTRY_POINT_DIR = bindir.
  - Earlier in that if statement in the elif branch there's another os.path.join() that should probably also do a os.path.exists().
  - ENTRY_POINT_TYPE can be None, so when get_entry_point() uses it as a key to ENTRY_POINT_MAP, it could fail, so maybe use .get() or wrap the return in a try. I see you use .skipif() for the test case but it may be less complicated (and more future-proof) if None was handled in get_entry_point().
  - Since ENTRY_POINT_MAP seems to be used only in get_entry_point, could it just be moved internal to that function? Like Christian already pointed out, I'm also curious why this is a map of maps, when the sub-maps contain only a single entry and have the same key? I agree this would be worth flattening.

42904d21
  - Back to single-quotes in the code docs. :-)
  - I like Christian's suggested improvement to do paired compress/decompress, but I'd suggest this for the test parameterization:

+@pytest.mark.parametrize(['compressor', 'decompressor'], [
...
+ ('gzip', 'gunzip',),
+ ('bzip2', 'bunzip2',),
+ ('xz', 'unxz',), # this serves both the xz and lzma compression types
])

and then use variables compressor and decompressor instead of decompressor[0] and decompressor[0] respectively.

review: Needs Fixing
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:24abd00a19ee5d14fb514d4fae03c2413ee6c143
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/42/
Executed test runs:
    SUCCESS: VM Setup
    SUCCESS: Build
    SUCCESS: VM Reset
    SUCCESS: Unit Tests
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/42//rebuild

review: Approve (continuous-integration)
Revision history for this message
Robie Basak (racb) wrote :
Download full text (10.8 KiB)

Thank you for the reviews!

I think I've addressed everything raised. In general I've adopted every
suggestion, except around get_entry_point and ENTRY_POINT_MAP which I've
explained below and in comments in the code instead.

Range diff: https://paste.ubuntu.com/p/tsTDnzWMkV/

> 7c43469 snapcraft: drop --enable-experimental-package-repositories
>
> Non important, but for proof this one could mention in the commit message where it was removed
> https://github.com/snapcore/snapcraft/commit/0662e630713b50ae1c4126eddb9b82fff133b6d0
> https://github.com/snapcore/snapcraft/pull/3520

OK, but this already landed in
https://code.launchpad.net/~paride/usd-importer/+git/usd-importer/+merge/403740.

> d8edae8 Add integration test for sed
>
> Indeed it matches 67206b06 ("Add awk integration test")
> But "awk ''" will return with a good RC, yet OTOH "sed ''" will hang waiting for input.
> In the test it behaves the same :-/
>
> This hangs here at 2 and never reached 3
> $ python3 -c 'import subprocess; print("1"); subprocess.check_call(["awk", ""]); print("2"); subprocess.check_call(["sed", ""]); print("3")'
> 1
> 2
>
> I see the test bot passed and it does for
> $ python3.8 -m pytest gitubuntu/integration_test.py::test_sed_runnable).
> This is due to the default capture settings in pytest, this one hangs:
> $ python3.8 -m pytest -s gitubuntu/integration_test.py::test_sed_runnable
> So I wonder if we should here use the safer:
> subprocess.check_call(["sed", "--version"])
>
> This works with both, otherwise you might one day need to debug anyother case, switch on -s to see the output and then this one blocks you hanging.

Good spot! Fixed.

> 31dbb06 Fix and test update-maintainer integration
>
> +1 to the dependency fix as it was formerly only a build-dependency
>
> dist-packages/debian/changelog.py is a bit unhappy with our test skeleton file:
> changelog.py:484: UserWarning: Unexpected line while looking for more change data or trailer:
> changelog.py:484: UserWarning: Found eof where expected more change data or trailer
>
> While those are only internal warnings and the test works fine they could later
> break on us without actually being a finding on git ubuntu.
> The following would fix this.
>
> - -- Test Maintainer <email address hidden> Tue, 01 Jun 2021 14:09:49
> + -- Test Maintainer <email address hidden> Tue, 01 Jun 2021 14:09:49 +0000

Fixed. Thanks!

> fa330f0 Test and fix git-ubuntu.reconstruct-changelog
>
> I saw these warnings:
> 20: from gitubuntu.test_fixtures import pygit2_repo
> unused-import: Unused pygit2_repo imported from gitubuntu.test_fixtures
> 167: def test_reconstruct_changelog(pygit2_repo, monkeypatch):
> redefinition of unused 'pygit2_repo' from line 20
> But they seem to be a false positive of my checker.

I think that's because of pytest's magic use of fixtures. They get used as test
function parameters, which isn't normal "use", so it appears to be unused.

> Overall the integration of this test is more complex than the test itself and I appreaciate
> the huge comment block above the tree/entry point checks.
> The bot exercised case #5 and I did #4 and b...

Revision history for this message
Bryce Harrington (bryce) wrote :

Range diff LGTM, thanks for that.

As to ENTRY_POINT_MAP, I wondered if that might be foundation laying for future work, so ok by me to leave that as is for now. +1 to the added docs to explain the intent.

review: Approve

There was an error fetching revisions from git servers. Please try again in a few minutes. If the problem persists, contact Launchpad support.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches