30 Commits
Author SHA1 Message Date
Brett T. Warden 8742b3a168 Redirect URL override messages to STDERR
Previously, these messages were printed to STDOUT:
Overriding version and content URLs with...
Overriding content URL with...
Overriding version URL with...

But especially with --quiet, the output to STDOUT should be strictly the
requested data. So print these as warnings instead.
2024-08-26 13:25:12 -07:00
William Douglas 776f8c92b0 Update use bats setup and teardown features
Instead of relying on a custom global_setup and global_teardown
functions, migrate to the use of bats' setup_file and teardown_file
functions.

Signed-off-by: William Douglas <william.douglas@intel.com>
2023-02-17 12:58:05 -08:00
Castulo Martinez 7dd6fc221a Testlib: renaming variables for consistency
Environment variables are used everywhere in testilb. This environment
variables are global variables that define the way testlib behaves.
However is was confusing to use the variables because they were
inconsistent between each other, for example some variables that define
paths would have absolute paths while other would have relative paths,
making it error prone while using them.

This commit makes the environment variables more consistent by following
a name convention for each type of variable, as an example, variables
that define absolute paths follow this convention ABS_<path_name>_DIR,
while variables that define relative paths are defined like this
<path_name>_DIR.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-06-16 11:42:13 -07:00
Castulo Martinez 04dfaa1db7 Allow paths that contain symlinks for cachedir
When the path provided by a user for the --statedir (or --cachedir)
contains a symlink swupd will fail to extrar tar files since
libarchive does not support extracting files through symlinks.

This commit fixes the issue allowing users to use symlinks in the
--statediri/--cachedir path.

Closes #1581

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-06-15 15:24:34 -07:00
Otavio Pontes 5bb4ef2337 swupd.bash: Make swupd.bash POSIX compliant
Bash autocomplete scripts should be POSIX compliant, so fixing that and
adding a test to validate this.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-19 13:47:49 -07:00
Otavio Pontes d29865f8a9 swupd.bash: Fixing tests
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-05 09:09:53 -07:00
Otavio Pontes 64d8222e4e test: Rebalance weights
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-17 18:44:18 -07:00
Otavio Pontes eeb3d61fea testlib: Always remove test enviroment implicitly at the end of tests
Current implementation was only removing test enviroment for envs created
on test setup. And test_teardown function needed to be overriden in case
global_setup() was used.

Now always cleaning the enviroment for both use cases, test_setup() and
global_setup(). The user doesn't have the control anymore on that and
if the user wants to keep the env KEEP_ENV variable should be used.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-07 13:52:49 -07:00
Otavio Pontes b1e849327d testlib: never create test enviroment for the user
Test environment can be created on global_setup() or test_setup() and that
change the behavior of several operations on testlib.

Because of that, let the user create the test environment as desired instead
of forcing it on test_setup()

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-07 13:52:49 -07:00
Otavio Pontes 2fe40faf10 test: Group tests that can be run only on in CI
2 groups were created:
 - slow: Tests that are very slow because of sleeps, so we can run them all
   in parallel
 - system: Tests that make change to the system, so they can cause problems
   when running in parallel, so we run them in series.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-01 08:38:15 -07:00
Otavio Pontes 4a67f4443e Rename variable used to identify if tests are running in a CI
Rename from TRAVIS to RUNNING_IN_CI

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-02-20 14:34:44 -08:00
Otavio Pontes d61288464d tests: Auto rebalance tests based on how long they take to long
This patch adds 2 scripts used to balance test execution. The weight_tests.bash
runs all tests and sets a weight to them based on how long they take to run. The
other, filter_bats_list.bash, use this information to split the tests in groups to
be executed by github actions.
When a new test is added the script will consider it with an average weight, so this
shouldn't unbalance the system right away. After some time, if we notice that the
system is not balanced anymore we can just run the weight_tests.bash again to rebalance.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-02-20 13:22:31 -08:00
Castulo Martinez c8ecede8ae Avoid running heuristics/scripts with 3rd-party
Heuristics and post-update scripts that apply to upstream bundles don't
apply to bundles installed from 3rd-party repositories. This commit
enables/disables these actions on demand so 3rd-party bundles are
installed correctly.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-11-27 14:56:10 -08:00
Otavio Pontes d175af3fd5 test: Don't conflict config tests with other tests
Always save the config file in another directory so we won't have
problems on running the config tests in parallel. Before this patch
if you run the config tests in parallel with any other tests you could
end up having false-negatives.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-11-12 13:15:24 -08:00
Karthik Prabhu Vinod 4af2023020 Fix Download to Downloading
Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>
2019-09-24 14:34:13 -07:00
Otavio Pontes d895218082 verify: Remove whitespace before ...
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-09-24 10:17:54 -07:00
Karthik Prabhu Vinod 74bcdd2fe4 Progress bar for manifest download
This ensures we have a callback function
for full_file curl download. The function
implements a spinner for progress

Fixes #1060

Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>
2019-09-23 10:36:50 -07:00
Otavio Pontes 0696de4435 curl: Initialize curl as needed
Instead of initializing curl library on start, initialize it only when needed.
The advantage of this approach is that we can run some commands offline, if
there's no file to download.

Fixes #801
Fixes #895
Fixes #277

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-08-20 10:48:20 -07:00
Otavio Pontes 0968948389 test: Rename the name of the distro for tests
We don't need to have a real distribution name for tests. Use a swupd
specific value.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-07-19 14:20:00 -07:00
Castulo Martinez e0256bee24 Make "diagnose --picky" a superset of "diagnose"
Running "swupd diagnose --picky" result in only identifying the extra
files in the system, but doesn't run the other standard checks that a
"swupd diagnose" do. "swupd diagnose --picky" should do everything
"swupd diagnose" does plus searching for the extra files.

This commit fixes the issue by making diagnose --picky a superset of
diagnose. The commit also makes some changes in the output of --picky so
it is consistent with the rest of the diagnose output.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-07-19 10:46:20 -07:00
Brandon Hong b09bdddabe Update testcases to reflect new info format
Signed-off-by: Brandon Hong <brandon.hong@intel.com>
2019-07-19 10:10:10 -07:00
Otavio Pontes 0a84e15aac test: Don't run config file tests on developers machine
config file tests require one special configuration on build time, so
skiping this unless we are running on travis.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-07-18 14:56:32 -07:00
Castulo Martinez c2a4763ff3 Adding configuration file parser for swupd
swupd has many flags that can be used for fine tunning its
functionality. In some cases users may want to include a flag with every
swupd command they run.

This commit gives the ability to provide swupd flags via options in a
configuration file that swupd will read before running the command.

The configuration file is an INI style file tha  can include sections
so users can specify options that should only apply to a specific
command. The biggest advantage of this is to be able to fine tune the
flags that should apply for each command.

For example a user could set a global flag that would apply to every
swupd command, and then turn that flag off for a specific command by
unsetting it in the command's section.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-06-28 13:06:11 -07:00
Castulo Martinez 43ba5def2a Require a force flag to continue with insecure URL
Currently users can set content and version urls based on http or https
protocols. This pose a security risk if users decide to use http.

This commit blocks swupd from working with http unless is specifically
allowed by using the --allow-insecure-http flag.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-06-27 14:48:50 -07:00
Castulo Martinez 67e4e8dda9 Autocompletion for --debug and --quiet
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-03-28 13:05:36 -07:00
Castulo Martinez c545a02378 Use logger to print all messages in screen
swupd prints some messages to stdout and others to stderr, this makes
the code somewhat confusing and also it creates a mess regarding which
messages go where. Messages are usually printed using fprintf() and
printf().

This commit replaces all calls to printf and fprintf with one of the
functions that are part of the logger. This will bring many advantages
to the code:
 - readability, it is straightforward to identify where a message needs
to go based on the name of the logger functions.
 - consistency, the output will go to either stderr or stdout depending
on the type of message being printed.
 - the format of the messages will also be consistent, so for example,
if the message is an error the message will automatically include the
"Error: " label in the beginning of the message, this way we avoid
having things like "ERROR:", "error - ", etc...

Closes #864
Closes #294
Closes #489
Closes #433

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-03-25 16:07:40 -07:00
Otavio Pontes 3798a7efe3 test: Swupd-search test was incorrect
And it fails when using current version of swupd-search.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-03-06 09:44:20 -08:00
Otavio Pontes 78f93d11ea modules: Take swupd-inspector out of swupd
We needed on sample for external binaries, but as now we have swupd-search we
can take swupd inspector out.

Also move local search to list of external modules and fix all related tests

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-03-05 16:55:49 -08:00
Otavio Pontes 085b520050 Add swupd-inspector command into swupd
Use a binary launcher to load swupd-inspector and execute that
when swupd inspector is run.

Closes #826

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-02-22 09:36:39 -08:00
Castulo Martinez cf8f81ccb4 Test for configurable download retries
This commit adds the tests to validate the configurable retries
for sync downloads.

It also moves the tests for autocompletion from their own "completion"
directory to a more general "usability" directory so we can add more
tests in that directory in the future.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-02-01 12:30:45 -08:00