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

test/system: Simplify running a subset of the tests with Bats >= 1.7.0 #1317

Merged

Conversation

debarshiray
Copy link
Member

The 000-setup.bats and 999-teardown.bats files were added [1] at a time
when Bats didn't offer any hooks for suite-wide setup and teardown.

That changed in Bats 1.7.0, which introduced the setup_suite and
teardown_suite hooks. These hooks make it easier to run a subset of the
tests, which is a good thing.

In the past, to run a subset of the tests, one had to do:

  $ bats ./test/system/000-setup.bats ./test/system/002-help.bats \
      ./test/system/999-teardown.bats

Now, one only has to do:

  $ bats ./test/system/002-help.bats

Commit e22a82f already added a dependency on Bats >= 1.7.0.
Therefore, it should be exploited wherever possible to simplify things.

[1] Commit 54a2ca1
#751

[2] Bats commit fb467ec3f04e322a
bats-core/bats-core#39
https://bats-core.readthedocs.io/en/stable/writing-tests.html

@debarshiray debarshiray requested a review from HarryMichal as a code owner June 21, 2023 07:06
All the other Bats files for the system tests are indented by two
spaces, not four.

This will make the subsequent commit easier to read.

containers#1317
The 000-setup.bats and 999-teardown.bats files were added [1] at a time
when Bats didn't offer any hooks for suite-wide setup and teardown.

That changed in Bats 1.7.0, which introduced the setup_suite and
teardown_suite hooks.  These hooks make it easier to run a subset of the
tests, which is a good thing.

In the past, to run a subset of the tests, one had to do:
  $ bats ./test/system/000-setup.bats ./test/system/002-help.bats \
      ./test/system/999-teardown.bats

Now, one only has to do:
  $ bats ./test/system/002-help.bats

Commit e22a82f already added a dependency on Bats >= 1.7.0.
Therefore, it should be exploited wherever possible to simplify things.

[1] Commit 54a2ca1
    containers#751

[2] Bats commit fb467ec3f04e322a
    bats-core/bats-core#39
    https://bats-core.readthedocs.io/en/stable/writing-tests.html

containers#1317
@debarshiray debarshiray force-pushed the wip/rishi/test-system-setup_suite branch from 7e7895c to c37c523 Compare June 21, 2023 07:07
@debarshiray debarshiray marked this pull request as draft June 21, 2023 07:09
@debarshiray debarshiray changed the title est/system: Simplify running a subset of the tests with Bats >= 1.7.0 [WIP] test/system: Simplify running a subset of the tests with Bats >= 1.7.0 Jun 21, 2023
@softwarefactory-project-zuul
Copy link

Build succeeded.
https://softwarefactory-project.io/zuul/t/local/buildset/5d7adc9b38864e4b96cf1ed64a549277

✔️ unit-test SUCCESS in 9m 27s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 3m 51s
✔️ unit-test-restricted SUCCESS in 8m 31s
✔️ system-test-fedora-rawhide SUCCESS in 24m 36s
✔️ system-test-fedora-38 SUCCESS in 23m 49s
✔️ system-test-fedora-37 SUCCESS in 21m 51s

@softwarefactory-project-zuul
Copy link

Build succeeded.
https://softwarefactory-project.io/zuul/t/local/buildset/6ebcc772987a43d3ab5e7a0057f2559b

✔️ unit-test SUCCESS in 8m 24s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 2m 55s
✔️ unit-test-restricted SUCCESS in 8m 25s
✔️ system-test-fedora-rawhide SUCCESS in 21m 28s
✔️ system-test-fedora-38 SUCCESS in 21m 09s
✔️ system-test-fedora-37 SUCCESS in 20m 43s

@debarshiray debarshiray marked this pull request as ready for review June 21, 2023 07:58
@debarshiray debarshiray changed the title [WIP] test/system: Simplify running a subset of the tests with Bats >= 1.7.0 test/system: Simplify running a subset of the tests with Bats >= 1.7.0 Jun 21, 2023
@debarshiray debarshiray merged commit 7a387dc into containers:main Jun 21, 2023
@debarshiray debarshiray deleted the wip/rishi/test-system-setup_suite branch June 21, 2023 07:59
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.

1 participant