Skip to content

BATS tests - lots of mostly minor cleanup - #1935

Closed
edsantiago wants to merge 4 commits into
podman-container-tools:masterfrom
edsantiago:bats_cleanup
Closed

BATS tests - lots of mostly minor cleanup#1935
edsantiago wants to merge 4 commits into
podman-container-tools:masterfrom
edsantiago:bats_cleanup

Conversation

@edsantiago

Copy link
Copy Markdown
Contributor

First, and possibly most controversial, remove --debug flag.
Output on test failure is painful to read. It is unlikely
(but not inconceivable) that --debug will be of any use.

Second, fix a failure message so it properly uses %s instead
of string interpolation. (If the test name itself includes
a percent sign, we get undefined behavior on output).

Fix a few instances of 'buildah' to be 'run_buildah'.

Remove some unnecessary 'run/echo/check-status' sequences,
sticking with the much cleaner 'test'. When BATS shows
an error of the form 'this failed: [ $status -eq 0 ]'
I weep in despair.

Signed-off-by: Ed Santiago santiago@redhat.com

@edsantiago

Copy link
Copy Markdown
Contributor Author

I don't think this is going to pass tests: I think there's some line-count tests that are failing due to removing --debug, but I can't be sure because there are other problems affecting my test runs (i.e. buildah not working at all on f31/rawhide, and f30 version being incompatible with current tests). And my VM died and I won't be able to get back to this next week. So let's just see what CI has to say, and I'll take a fresh look at this next week.

(And, if there's strong objection to my removing --debug, I'd rather find out earlier than later)

@TomSweeneyRedHat

Copy link
Copy Markdown
Contributor

@edsantiago thanks for the PR. I didn't dive in deeply as the CI tests failed as you expected. However in general the changes LGTM. I'm fine with the --debug removal. I've actually struggled a few times with too much output from a failing test during development.

@rhatdan

rhatdan commented Oct 28, 2019

Copy link
Copy Markdown
Contributor

@edsantiago Still working on this?

@edsantiago

Copy link
Copy Markdown
Contributor Author

Oh yes. It's slow and painstaking but I've fixed several issues including a bug in the tests themselves. Still not running clean all the way through.

First, and possibly most controversial, remove --debug flag.
Output on test failure is painful to read. It is unlikely
(but not inconceivable) that --debug will be of any use.

Second, fix a failure message so it properly uses %s instead
of string interpolation. (If the test name itself includes
a percent sign, we get undefined behavior on output).

Fix a few instances of 'buildah' to be 'run_buildah'.

Remove some unnecessary 'run/echo/check-status' sequences,
sticking with the much cleaner 'test'. When BATS shows
an error of the form 'this failed: [ $status -eq 0 ]'
I weep in despair.

Signed-off-by: Ed Santiago <santiago@redhat.com>
Well, yikes: fix a broken file-mode check in two 'add' tests.
They were expecting 755, but the actual mode is 644. --debug
was spitting out unrelated output, including a 755 that
the test was matching as a substring.

Signed-off-by: Ed Santiago <santiago@redhat.com>
@edsantiago
edsantiago force-pushed the bats_cleanup branch 2 times, most recently from 0f5fd79 to b0ed947 Compare October 29, 2019 21:03
- add explicit --log-level=debug in some buildah-bud invocations
  where we need to check debug output
- use expect_line_count() in one place, to get better diagnostics
- formats test: refactor, make more readable
- imgtype invoker: remove -debug
- fix one more instance of 'step' needing to be 'STEP'
- fix one mkdir to mkdir -p, and run rm -rf beforehand, to deal
  with a failed prior run that might have left state

Signed-off-by: Ed Santiago <santiago@redhat.com>
The newer-than and older-than test was failing (desired result)
but it's because the command had a syntax error (not desired)!

Rewrite that section a little, making it more robust (actually
confirming that mtime is preserved, versus simple mtime match
because of time of execution) and also with more readable
diagnostic in case of error.

Signed-off-by: Ed Santiago <santiago@redhat.com>
@edsantiago

Copy link
Copy Markdown
Contributor Author

Whew - tests are finally green. It is quite a bit changed since the first iteration; most of the new work is in separate commits.

@vrothberg vrothberg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wow, nice work @edsantiago!
LGTM

@vrothberg

Copy link
Copy Markdown
Contributor

@giuseppe @TomSweeneyRedHat @rhatdan PTAL

@giuseppe

Copy link
Copy Markdown
Contributor

let's ship it!

LGTM

@rh-atomic-bot r+

@rh-atomic-bot

Copy link
Copy Markdown

📌 Commit 58ee138 has been approved by giuseppe

@rh-atomic-bot

Copy link
Copy Markdown

⌛ Testing commit 58ee138 with merge b8172dd...

rh-atomic-bot pushed a commit that referenced this pull request Oct 30, 2019
First, and possibly most controversial, remove --debug flag.
Output on test failure is painful to read. It is unlikely
(but not inconceivable) that --debug will be of any use.

Second, fix a failure message so it properly uses %s instead
of string interpolation. (If the test name itself includes
a percent sign, we get undefined behavior on output).

Fix a few instances of 'buildah' to be 'run_buildah'.

Remove some unnecessary 'run/echo/check-status' sequences,
sticking with the much cleaner 'test'. When BATS shows
an error of the form 'this failed: [ $status -eq 0 ]'
I weep in despair.

Signed-off-by: Ed Santiago <santiago@redhat.com>

Closes: #1935
Approved by: giuseppe
rh-atomic-bot pushed a commit that referenced this pull request Oct 30, 2019
Well, yikes: fix a broken file-mode check in two 'add' tests.
They were expecting 755, but the actual mode is 644. --debug
was spitting out unrelated output, including a 755 that
the test was matching as a substring.

Signed-off-by: Ed Santiago <santiago@redhat.com>

Closes: #1935
Approved by: giuseppe
rh-atomic-bot pushed a commit that referenced this pull request Oct 30, 2019
- add explicit --log-level=debug in some buildah-bud invocations
  where we need to check debug output
- use expect_line_count() in one place, to get better diagnostics
- formats test: refactor, make more readable
- imgtype invoker: remove -debug
- fix one more instance of 'step' needing to be 'STEP'
- fix one mkdir to mkdir -p, and run rm -rf beforehand, to deal
  with a failed prior run that might have left state

Signed-off-by: Ed Santiago <santiago@redhat.com>

Closes: #1935
Approved by: giuseppe
rh-atomic-bot pushed a commit that referenced this pull request Oct 30, 2019
The newer-than and older-than test was failing (desired result)
but it's because the command had a syntax error (not desired)!

Rewrite that section a little, making it more robust (actually
confirming that mtime is preserved, versus simple mtime match
because of time of execution) and also with more readable
diagnostic in case of error.

Signed-off-by: Ed Santiago <santiago@redhat.com>

Closes: #1935
Approved by: giuseppe
@rh-atomic-bot

Copy link
Copy Markdown

💔 Test failed - status-travis

@edsantiago

edsantiago commented Oct 30, 2019

Copy link
Copy Markdown
Contributor Author

Test failure looks like a transient:

fatal: unable to access 'https://gitlab.gnome.org/GNOME/libglnx.git/': Failed to connect to gitlab.gnome.org port 443: Connection refused

/retest

@TomSweeneyRedHat

Copy link
Copy Markdown
Contributor

Yeah, homu's been painful the past day or three. Let me poke around.

@TomSweeneyRedHat

Copy link
Copy Markdown
Contributor

LGTM, thanks a bunch @edsantiago, excellent work as usual.

@TomSweeneyRedHat

Copy link
Copy Markdown
Contributor

@rh-atomic-bot retry

@rh-atomic-bot

Copy link
Copy Markdown

⌛ Testing commit 58ee138 with merge eaad6b4...

rh-atomic-bot pushed a commit that referenced this pull request Oct 30, 2019
Well, yikes: fix a broken file-mode check in two 'add' tests.
They were expecting 755, but the actual mode is 644. --debug
was spitting out unrelated output, including a 755 that
the test was matching as a substring.

Signed-off-by: Ed Santiago <santiago@redhat.com>

Closes: #1935
Approved by: giuseppe
rh-atomic-bot pushed a commit that referenced this pull request Oct 30, 2019
- add explicit --log-level=debug in some buildah-bud invocations
  where we need to check debug output
- use expect_line_count() in one place, to get better diagnostics
- formats test: refactor, make more readable
- imgtype invoker: remove -debug
- fix one more instance of 'step' needing to be 'STEP'
- fix one mkdir to mkdir -p, and run rm -rf beforehand, to deal
  with a failed prior run that might have left state

Signed-off-by: Ed Santiago <santiago@redhat.com>

Closes: #1935
Approved by: giuseppe
rh-atomic-bot pushed a commit that referenced this pull request Oct 30, 2019
The newer-than and older-than test was failing (desired result)
but it's because the command had a syntax error (not desired)!

Rewrite that section a little, making it more robust (actually
confirming that mtime is preserved, versus simple mtime match
because of time of execution) and also with more readable
diagnostic in case of error.

Signed-off-by: Ed Santiago <santiago@redhat.com>

Closes: #1935
Approved by: giuseppe
@rh-atomic-bot

Copy link
Copy Markdown

☀️ Test successful - status-papr, status-travis
Approved by: giuseppe
Pushing eaad6b4 to master...

@edsantiago
edsantiago deleted the bats_cleanup branch October 30, 2019 13:40
caiges pushed a commit to caiges/buildah that referenced this pull request Nov 12, 2019
First, and possibly most controversial, remove --debug flag.
Output on test failure is painful to read. It is unlikely
(but not inconceivable) that --debug will be of any use.

Second, fix a failure message so it properly uses %s instead
of string interpolation. (If the test name itself includes
a percent sign, we get undefined behavior on output).

Fix a few instances of 'buildah' to be 'run_buildah'.

Remove some unnecessary 'run/echo/check-status' sequences,
sticking with the much cleaner 'test'. When BATS shows
an error of the form 'this failed: [ $status -eq 0 ]'
I weep in despair.

Signed-off-by: Ed Santiago <santiago@redhat.com>

Closes: podman-container-tools#1935
Approved by: giuseppe
caiges pushed a commit to caiges/buildah that referenced this pull request Nov 12, 2019
Well, yikes: fix a broken file-mode check in two 'add' tests.
They were expecting 755, but the actual mode is 644. --debug
was spitting out unrelated output, including a 755 that
the test was matching as a substring.

Signed-off-by: Ed Santiago <santiago@redhat.com>

Closes: podman-container-tools#1935
Approved by: giuseppe
caiges pushed a commit to caiges/buildah that referenced this pull request Nov 12, 2019
- add explicit --log-level=debug in some buildah-bud invocations
  where we need to check debug output
- use expect_line_count() in one place, to get better diagnostics
- formats test: refactor, make more readable
- imgtype invoker: remove -debug
- fix one more instance of 'step' needing to be 'STEP'
- fix one mkdir to mkdir -p, and run rm -rf beforehand, to deal
  with a failed prior run that might have left state

Signed-off-by: Ed Santiago <santiago@redhat.com>

Closes: podman-container-tools#1935
Approved by: giuseppe
caiges pushed a commit to caiges/buildah that referenced this pull request Nov 12, 2019
The newer-than and older-than test was failing (desired result)
but it's because the command had a syntax error (not desired)!

Rewrite that section a little, making it more robust (actually
confirming that mtime is preserved, versus simple mtime match
because of time of execution) and also with more readable
diagnostic in case of error.

Signed-off-by: Ed Santiago <santiago@redhat.com>

Closes: podman-container-tools#1935
Approved by: giuseppe
edsantiago added a commit to edsantiago/buildah that referenced this pull request Dec 16, 2019
PR podman-container-tools#1935 removed the default --debug logging; so all run_buildah
calls now use the default (error). It is safe to remove unnecessary
instances of --log-level=error .

For ease of review, this commit was entirely machine-generated via:

    $ perl -pi -e 's/ --log-level=error / /' *.bats

Signed-off-by: Ed Santiago <santiago@redhat.com>
rh-atomic-bot pushed a commit that referenced this pull request Dec 17, 2019
PR #1935 removed the default --debug logging; so all run_buildah
calls now use the default (error). It is safe to remove unnecessary
instances of --log-level=error .

For ease of review, this commit was entirely machine-generated via:

    $ perl -pi -e 's/ --log-level=error / /' *.bats

Signed-off-by: Ed Santiago <santiago@redhat.com>

Closes: #2029
Approved by: rhatdan
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Oct 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants