diff options
author | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2021-12-28 15:31:46 +0200 |
---|---|---|
committer | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2021-12-29 11:00:12 +0200 |
commit | 41d8b3f1c543c021a45d69132692b5e4cbefc249 (patch) | |
tree | 1bae8fb0d078ff7084f3a8bf09bb922ea9eed50b /tests | |
parent | 101fa3b692688d01d4b216316805b454003896c4 (diff) |
Tests: clear binary format engine before constructing new core object
This fixes issues on auto-tests where we construct a new
PackageManagerCore instance for each test case.
Installer registers downloaded archives into internal resource
collection mapping with a naming scheme that contains values such as:
"installer://collectionName/resourceName". As the "BinaryFormatEngine
Handler" singleton class retains the resource collection mappings
between mock installer runs, we ran into situations where we would
register different actual paths with the same mapped file names, or
the old resources would not exist anymore on disk, causing failures
at different points.
Change-Id: Ic7ee30886a2c586fbe0efbe4bb4d19a24d9dba83
Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/installer/shared/packagemanager.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/auto/installer/shared/packagemanager.h b/tests/auto/installer/shared/packagemanager.h index 4cc5426ad..e197511f0 100644 --- a/tests/auto/installer/shared/packagemanager.h +++ b/tests/auto/installer/shared/packagemanager.h @@ -30,6 +30,7 @@ #define PACKAGEMANAGER_H #include <packagemanagercore.h> +#include <binaryformatenginehandler.h> #include <binarycontent.h> #include <fileutils.h> #include <settings.h> @@ -45,6 +46,8 @@ struct PackageManager { static PackageManagerCore *getPackageManager(const QString &targetDir, const QString &repository = QString()) { + BinaryFormatEngineHandler::instance()->clear(); + PackageManagerCore *core = new PackageManagerCore(BinaryContent::MagicInstallerMarker, QList<OperationBlob> ()); QString appFilePath = QCoreApplication::applicationFilePath(); core->setAllowedRunningProcesses(QStringList() << appFilePath); |