Commit Graph
22 Commits
Author SHA1 Message Date
Castulo Martinez d0c2f881cf Update testlib to support 3rd-party bundle updates
This commit modifies some of the functions of the test library so it is
possible to update bundles that belong to 3rd-party repositories.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-12 08:41:45 -08:00
Castulo Martinez 24f60f2673 Rebalancing functional tests
This commit separates the 3rd-party tests in their own job since we will
be adding several tests related to 3rd-party in the upcoming days.

This commit also rebalances the tests in the update groups so they are
better balanced.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-11-25 15:13:17 -08:00
Otavio Pontes ac41246a81 3rd_party: Group all 3rd-party repo operations tests
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-11-21 16:34:46 -08:00
Karthik Prabhu Vinod fe0cd44e5e Concrete implementation for third-party repo add
sudo swupd 3rd-party add <repo_name> <upstream_url>

With some clean up from Otavio

Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>
2019-11-21 13:16:33 -08:00
Karthik Prabhu b8837eb482 Removing Extra entry for autoupdate from readme
Signed-off-by: Karthik Prabhu Vinod karthik.prabhu.vinod@intel.com
2019-11-05 10:02:34 -08:00
Karthik Prabhu Vinod c207c9240c Add --path to swupd autoupdate mechanism
Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>

Fixes #527
2019-10-21 12:26:48 -07:00
Otavio Pontes bb1559ef6e compliant: Add check for trailing whitespaces on tests
Note that the clang-format already does this for the source code

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-04 16:05:21 -07:00
Castulo Martinez 4633cba133 Improvements for DEBUG_TEST in test library
When running tests, there is the possibility of preserving your
test environment for debugging purposes.

We were preserving the environment by skipping the execution of
the destroy_test_environment function when the DEBUG_TEST env
variable was set. This had one limitation, this was being done in
the default teardown function, so if the user would define his own
teardown then the DEBUG_TEST had no effect, the same if the user
used global_teardown instead. Another limitation the current
implementation had was that when an environment had been preserved
if the user would forget to clean it up manually before re-running
the test it would cause unexpected results in the test.

This commit removes both limitations by looking for the DEBUG_TEST
variable directly within the destroy_test_environment function so
the env will be preserved regardless of where the function is called
from and removes the environment at the beginning of the test if it
exists.

Closes #651

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2018-10-30 15:00:22 -07:00
Castulo Martinez 8891b7fa85 Adding info about "Getting help" to testlib readme
Some functionality was added to the test library to allow printing
function availability plus usage information.

This commit adds that info to the readme of the library to keep it
accurate. It also adds a table of groups for the tests which will
be useful soon when we start using IDs in the tests.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2018-10-30 09:57:26 -07:00
Castulo Martinez d76b34889d Removing old test library swupd.bash
The old test library swupd.bash was replaced by testlib.bash.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2018-09-27 12:48:14 -07:00
Castulo Martinez 67a926fbce Info about bump_format and update_bundle to docs
Adding documentation about the bump_format and update_bundle
functions to the readme.
2018-09-06 15:00:10 -07:00
Castulo Martinez 59ed44faf8 Ability to create environment with complex bundle
Normal test environments come with a minimal version of os-core
bundle by default (only one file and the tracking file). Users
also have the option of not having os-core at all with the -e
"empty" option.

This commit adds another option "-r" for creating a test environment
that includes a more complete version of the os-core bundle,
with a couple of useful files: os-release and format. This type
of bundle can be useful when working with some type of tests like
updates.
2018-08-22 09:49:43 -07:00
Castulo Martinez 489a11adfc Add function to create new test versions
Some tests need to have not only one but two or more versions of
the server side content (web-dir).

This commit adds a function that can be used to create these new
versions.
2018-08-21 14:13:13 -07:00
Castulo Martinez 1eaca419e0 Updating README from test library
This commit updates the README with the latest functions added to
the test library.
2018-08-21 13:21:02 -07:00
Castulo Martinez 7cecbd2009 Adding the global ignore list for tests
Tests that compare output with an expected output strip text in
ignore files first.

This commit adds a global ignore-list intended to be used as a
fallback for all tests.
2018-08-20 15:11:19 -07:00
Castulo Martinez a087f89d58 Add ability to use existing files creating bundles
When creating a bundle using the testlib functions, if the user
wants the bundle to include files, those files are generated
automatically with random content.

This commit adds the capability of specifying an existing file to
be used for the bundle by using the
"-f <file in manifest>:<file to use>" notation.
2018-08-20 15:11:19 -07:00
Castulo Martinez 8bab78fbe4 Allow leaving a test environment for debugging
Automated tests should create its own test environment including
all needed dependencies when the test starts, and should clean up
after itself once the test is over. Sometimes when developing
these tests, they don't work as expected at first and is difficult
to figure out what the problem is if the test environment is gone.

This commit allow users to temporarily skip the removal of the test
environment so he/she can debug what the problem was by only running
the test with the DEBUG_TEST env variable set to "true".

Example: DEBUG_TEST=true bats my_test.bats
2018-08-15 17:24:28 -07:00
Castulo Martinez 56d3102ed9 Adds capability of using an ignore list in tests
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.
2018-08-07 12:47:51 -07:00
Castulo Martinez 2fcca957da Adding new assertions to the test library
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.
2018-08-07 12:47:51 -07:00
Castulo Martinez ca3a68f634 Rewriting bundle-remove and check-update tests
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.
2018-07-25 10:52:37 -07:00
Castulo Martinez 5d788d136d Adding the last missing tests from bundleadd
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.
2018-07-25 10:52:37 -07:00
Castulo Martinez f5aceccab3 Including documentation for the test library
This commit adds some documentation explaining how to use the test
library to create new tests and how to run them.
2018-07-25 10:52:37 -07:00