When adding an upstream bundle, we apply some heuristics to the bundle
files and based on that some files are skipped from being installed.
These heuristics don't apply to 3rd-party bundles.
This commit skips running heuristics when adding 3rd-party bundles.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Sometimes a test fails before finisihing to create all the required
directories under the testdir. So destroy_environment thinks this is
not a valid test environment.
Touching a dot file to show that the directory is a test environment
instead on counting on its content.
Fixes bug #1135
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
When a symlink is added to a 3rd-party repository it will be broken
on the statedir and stat command will fail. We need to use lstat, to
get information about the symlink and not the file that it's pointing
to.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
The repo.ini file was being created in the swupd state directory, this
was not ideal since it prevented the state directory from being used for
multiple target paths.
This commit moves the repo.ini file out of the state directory and into
the 3rd-party content directory.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The testlib had two functions to create 3rd-party repositories that were
very similar but with only one difference, one function only created the
3rd-party repo, the other one created the repo and also added it as if
the user had already done a "swupd 3rd-party add" on it.
This commit merges both functions into one to avoid code duplication,
make the test library easier to maintain, and make it less confusing.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When in a 3rd-party repository one bundle has one binary file that
is exported, and the same file is included in another bundle, only
it is not exported in this bundle, when we remove the bundle that
exports the file, the file should be unexported regardless of the file
still being installed since the bundle that is still in the system is
not exporting it.
Closes#1322
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Some commands were recently added to swupd which require user
interaction under certain circumstances, when this happens the user has
to manually enter either Y/N to continue or abort the current process.
This commit provides a --non-interactive=<yes/no> flag that can be used
to avoid getting this interactive prompts.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
If an update of 3rd-party content includes files with dangerous flags,
the user should be notified and the update should only continue if the
user accepts the risk, otherwise the update should be aborted.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
If a 3rd-party bundle include files that have either the setuid, setgid
or sticky bits set, then it should not be installed since they could
compromise the security of the system. In this case the user should be
asked to see if they want to assume the risk and continue, or abort the
process.
Closes#1281Closes#1282
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When a 3rd-party repository is updated, if one of the updated bundles
has updated binaries, the scripts that export those binaries should also
be updated. This commit implements that update.
Closes#1279
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit makes possible the creation of bundles with exported files
in test environments. These bundles will have the 'x' in the appropriate
place in the manifest plus those bundles that are to be installed in the
environment will have the "exporting script" created in the 3rd-party
bin directory.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This PR re-enables the failing auto-update
tests while moving from travis to github actions
Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>
This commit moves the path where the content from 3rd-party bundles is
going to be installed from opt/3rd-party/<bundle_name> to
/opt/3rd-party/bundles/<bundle_name> so bundle directories are separated
from other top level directories like bin.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The 3rd-party repository directory is currently 3rd_party, this name is
incorrect and needs to be changed to 3rd-party.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Sometimes when a test finds a problem in the source code it is difficult
to determine what is the problem in the code, so the code needs to be
debugged. In order to do this, the test environment of the particular
test has to be created but without running the test, so we can run the
command executed by the test with the debugger.
This commit adds a function (create_test_environment_only) to create a
specific test environment based on a bats file, but without running the
test.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
A spinner was added to swupd to show some kind of progress while
downloading content which its amount is unknown. Once the content is
downloaded the stopped spinner should be removed from the screen. This
commit does that.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When running an operation, swupd uses a certificate to validate things
ilke the MoM and the version file. The certificate that needs to be used
for 3rd-party repos is different than the one that has to be used for
upstream.
This commit enables the use of the 3rd-party repo certificate that will
be installed in the repo's directory with all swupd operations, except
when adding the repository, in those cases, since the os-core bundle
hasn't been installed yet, we need to provide the cert path through
other means, like using the -C flag..
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
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>
This commit adds the ability to remove 3rd-party bundles. If a repo is
not specified the bundle will be searched for in all repositories. All
options from the normal bundle-remove command are supported with
3rd-party bundles.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The os-core file includes the os-release file, which has the
version of a content server. When adding a new 3rd-party repository we
need to install the os-core bundle from that repo so we can track the
current version of the repo.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Instead of getting the current version of a 3rd-party repo during a
bundle-list from the repo.ini file, this commit changes the code so it
is gotten from the os-release file in the appropriate path_prefix for
the repo.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit adds the --repo flag for the 3rd-party bundle-list command
which can be used to specify the repository from which the bundles are
going to be listed.
This commit adds the section that handles the "3rd-party bundle-add"
options into the default config file. It also enables the use of
the 3rd-party command and its subcommands in the config file.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
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>
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>
The tests in usa-config-file.bats are leaving trash behind (the old test
environment). This commit fixes the issue.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
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>
On github actions if you don't limit the number of bytes read from
urandom the system can get stuck in the read command.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Functional tests for the new "--recursive" flag in bundle-remove that
will be used to remove a bundle and its dependencies.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When os-install is used to install an OS and the --bundles option is used
to specify some bundles that should be installed in the system along
with the OS, the bundles specified should be tracked.
Closes#1153
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The bundle-info command shows detailed data related to a specified
bundle. Among the data currently displayed it includes:
- If the bundle is installed or not
- If the bundle is experimental or not
- If the bundle is installed, it shows if there is an existing update
for the bundle
- The latest available version of the bundle
- The size of the bundle and all its dependencies
- The max size needed in disk to install a bundle if not installed
This commit also adds the following command flags:
--version: so a user can display information for a bundle in a
specific version, not only the current version.
--dependencies: this flag can be used to show all optional and required
bundles that are directly and indirectly included by the specified
bundle.
--files: this flag can be used to show all files that are part of a
given bundle.
All flags can be combined to show specific data.
This is the first of a series of PRs to implement the bundle-info
features referred to at #461.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
There was an error in the logic of testlib which was causing the
global_teardown to not be executed when tests were being run with bats
like this "bats <directory>/".
Let's say you have 2 test files with 2 tests each file, if the tests are
run like this "bats my_dir/test1.bats; bats my_dir/test2.bats" (this is
the way make check runs the tests), then the tests are going to be
numbered by bats as 1,2,1,2, and the current logic worked fine. But if
you run the same tests using "bats my_dir/", then the tests are going to be
numbered 1,2,3,4. This difference in the numbering of tests was causing
issues with the library. This commit fixes the issue.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
There was a bug in the logic of the setup function in testlib which was
causing the globale_teardown to be incorrectly called when tests were
being run using "bats <directory>/". This commit fixs the issue.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Sometimes we want to keep a test environment after the test has finished
running so we can see the state directory and target_dir, this is useful
to troubleshoot failing tests. This was being controlled via an
environment variable but it was not always working properly.
This commit des two things:
- Changes the environment variable used to save a test environment from
DEBUG_TEST to KEEP_ENV, that way both env variables can be used
separatelly, the first one to printo more debug info and the second one
to save the test environment.
- Fixes an issue with the tests by adding a --force flag to force the
deletion of the environment even when the environment variable is set.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Sometimes it is difficult to figure out why a test starts failing,
so having a lot more messages printed during the test makes it easier.
This commit adds a function to print messages only when the environment
variable DEBUG_TEST is set to true, this way we can print a lot more
information from the functions in testlib without polluting the output
of a test in a normal run.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
All files that are written by tests should be written in the directory
where the tests were executed and not the directory where code is.
Make distcheck now works fine
Fixes#343
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
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#801Fixes#895Fixes#277
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
When running the check-update command we get the latest version for the
format we are currently in, but we really want to get the latest version
regardless of the format.
This commit fixes the issue.
Closes#482
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When using testlib to create tests, ignore lists can be used which
include lines of output that should be ignored when running tests.
The ignore lists can exist at three different levels:
- an ignore file that applies to all tests
- an ignore file that applies to all files of one theme
- an ignore file that applies to all tests within the same file
There was a bug in this last one that was causing ignore-list files to
be unrecognized unless the test number was also used as part of the
ignore-list name. This was causing issues because the test number
can change depending on how you run the test.
This commit fixes the issue.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The -B/--bundle option is confusing and causing users to wipe out their
systems. This option was really just meant for os-install, so this
commit removes it from "swupd repair".
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>