Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tests/lib/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use OCP\Command\IBus;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Files\IRootFolder;
use OCP\IAppConfig;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IUserManager;
Expand Down Expand Up @@ -195,6 +196,22 @@ protected function tearDown(): void {
call_user_func([$this, $methodName]);
}
}

// Clean up encryption state to prevent test pollution
// This ensures encryption_enabled is reset after each test, preventing
// MultiKeyEncryptException failures in subsequent tests when encryption
// is left enabled but user keys don't exist
try {
$appConfig = Server::get(IAppConfig::class);
$currentValue = $appConfig->getValueBool('core', 'encryption_enabled', false);
if ($currentValue) {
$appConfig->setValueBool('core', 'encryption_enabled', false);
$appConfig->deleteKey('core', 'default_encryption_module');
$appConfig->deleteKey('encryption', 'useMasterKey');
}
} catch (\Throwable $e) {
// Ignore - may be called before bootstrap completes
}
}

/**
Expand Down
Loading