The test library includes many assertions intended to validate
a command's output. These assertions take the command output and
compare it against an expected output. Some of these assertions
take a literal string and others take a string with regular
expression values. However, regardless of what king of string is
being used for the expected output, there are some common lines
in the output that are usually not important and are safe to ignore.
An example would be empty lines or lines with only dots.
This commit adds the capability for those assertions to use an
ignore file to include patterns that could be ignored/removed from
the command's output before comparing it against the expected
output. Also with this commit empty lines and lines with only dots
will be ignored by default. If the assertion needs to validate an
exact output without ignoring anything in the ignore-list nor ignoring
dots and blank lines, then the --identical option can be used with
the assertion.
This commit include two parts.
1) It adds 6 new assertions to the test library:
- assert_is_output
- assert_is_not_output
- assert_regex_is_output
- assert_regex_is_not_output
- assert_regex_in_output
- assert_regex_not_in_output
2) It migrates the tests from the following categories to use the
new library:
- completion
- hashdump
- mirror
- search
Finally this commit changes a few test cases so they use
"assert_is_output" instead of "assert_in_output", that way
we can have a tighter control of the output we want since
assert_is_output requires the whole output to match to a
specific text instead of doing a partial match.
This commit adds the following three funtions to the test library:
- install_bundle
- remove_bundle
- clean_state_dir
These functions are useful specially when the global_setup and the
global_teardown are used instead of test_setup and test_teardown.
These functions allow the user to create all of its test resources
in the global_setup and reuse those same resources throughout all
the tests in the test script. By using the global_setup and
global_teardown functions the test execution time can be greatelly
reduced.
This commit also modifies the add-rc.bats and remove-rc.bats to
leverage the global setup and teardowns to increase the execution
speed. These times were reduced as shown:
- bundleadd_v2/add-rc.bats from 1m50.129s -> 0m20.026s
- bundleremove_v2/remove-rc.bats from 0m59.079s -> 0m15.446s
A new test library.bash was introduced that simplifies the creation
of test environments and test objects.
This commit rewrites all existing tests from
test/functional/bundleremove and test/functional/checkupdate but this
time using the new test library.
NOTE: Once all the tests have been rewriten to use the new lib, they
can be included in the Makefile so they are run with every patch,
and the old tests can be deleted.
A new test library.bash was introduced that simplifies the creation
of test environments and test objects.
This commit rewrites all existing tests from test/functional/bundlelist
but this time using the new test library. Once all the tests have been
rewriten to use the new lib, they can be included in the Makefile so
they are run with every patch, and the old tests can be deleted.
This commit adds the last rewritten tests for bundle-add, these
tests are the equivalent to the ones in the bundleadd directory
but using the new test library.
This commit adds some assertions that can be used to validate
common things in a consistent manner among tests.
The assertions added with this commit are the following:
- assert_status_is
- assert_status_is_not
- assert_dir_exists
- assert_dir_not_exists
- assert_file_exists
- assert_file_not_exists
- assert_in_output
- assert_not_in_output
More assertions may be added as needed while migrating the rest of
the tests to use the new testlib.
There is some stuff that is common for every test file, so this
commit adds a function that generates a new test file based on a
template to facilitate test creation.
The old way of creating new tests require a lot of manual steps to
create the test resources needed to run the tests. This commit is
part of a series of commits to improve the workflow for creation of
new tests.
This commit introduces a new test library that aims to replace the
old swupdlib.bash library which provides many funtions to create
new test resources easily.
The following functions were added in this commit:
- generate_random_content
- generate_random_name
- validate_path
- validate_item
- validate_param
- create_dir
- create_file
- create_link
- create_tar
- create_manifest
- add_to_manifest
- create_test_environment
- destroy_test_environment
- create_bundle
- set_env_variables
- sign_manifest
The tests in bundleadd_v2 would eventually replace those in bundleadd
Related to issue #258