Commit Graph
313 Commits
Author SHA1 Message Date
Kenneth Hsu a8b0df57d4 Avoid clock issues when quickly running successive backups in tests.
This is an attempt to avoid errors like "System.Exception : The previous
backup has time 9/27/2020 5:25:56 PM, but this backup has time 9/27/2020
5:25:55 PM. Something is wrong with the clock."  We are seeing these
errors often recently in AppVeyor.
2020-09-27 10:44:25 -07:00
Kenneth SkovhedeandGitHub a5cea90867 Merge pull request #4293 from warwickmm/fix_export_encoding
Avoid decoding URL parameters when removing passwords
2020-09-23 11:10:02 +02:00
Dean Ferreyra a3c27a2ba2 Add Assert.Fail to catch unexpected symlink policies 2020-09-13 08:12:23 -07:00
Dean Ferreyra 641a590d89 For "Ignore" policy, also ensure a file doesn't exist 2020-09-12 20:33:39 -07:00
Dean Ferreyra e3b8a12ec1 Unit test improvements per review comments 2020-09-12 17:03:48 -07:00
Dean Ferreyra eafe7320e9 Address review comments 2020-09-12 14:45:55 -07:00
Dean Ferreyra 3366071d04 Add back missing stream reset to AssertFilesAreEqual 2020-09-12 14:29:04 -07:00
Dean Ferreyra 0367418925 Fix typo in log and assert messages 2020-09-12 10:52:01 -07:00
Dean Ferreyra 75b688c999 Restore use of Utility.CompareStreams in AssertFilesAreEqual
For performance reasons, use `Utility.CompareStreams` in
AssertFilesAreEqual.
2020-09-12 08:08:52 -07:00
Dean Ferreyra 2c56634899 Add tolerance to file time comparisons 2020-09-11 23:25:03 -07:00
Dean Ferreyra f4195e4eb0 Address review comments from @warwickmm
Replace `VerifyDir` and `CompareFiles` with
`AssertDirectoryTreesAreEquivalent` and `AssertFilesAreEqual`.

Move `WriteFile` to `TestUtils`.

Add "Symlink" category to start.sh.
2020-09-11 20:06:53 -07:00
Dean Ferreyra f56f64e541 Merge branch 'master' into symlink_unit_tests 2020-09-09 20:03:32 -07:00
Dean Ferreyra be6ac941ea Add symlink policy tests
This adds a basic symlink policy test that performs backups using each
symlink policy.

If you don't have the required privilege in Windows, you can get an
exception trying to create a symbolic link.  If an exception is thrown
trying to create a symbolic link, the exception is trapped and the
test is marked as "Ignored"; e.g.,
```
1) Ignored : Duplicati.UnitTest.SymLinkTests.SymLinkPolicy
Client could not create a symbolic link.  Error reported: (1314) A required privilege is not held by the client. | Read: [C:\td\backup-data\target] | Write: [C:\td\backup-data\symlink]
```
2020-09-07 22:50:21 -07:00
Dean Ferreyra 93601d0a82 Address review comments from @warwickmm 2020-09-07 18:56:59 -07:00
Dean Ferreyra 27da5a4dc7 Include Windows in tests for directory names with wildcards 2020-09-06 15:00:48 -07:00
Kenneth Hsu 7d13d9ed81 Add tests for directory names with wildcards. 2020-09-05 15:05:11 -07:00
Kenneth Hsu c15cdcf26a Remove unused local variable. 2020-08-24 07:49:14 -07:00
Kenneth Hsu 5915fdfba9 Add test for exporting backup configuration to JSON.
This tests that we escape '@' with '%40', as the import code in
escape_uri in AppUtils.js cannot handle '@'.

This concerns issue #3619.
2020-08-24 07:41:00 -07:00
Kenneth Hsu 9dd98457f1 Clean up code. 2020-08-24 07:41:00 -07:00
Kenneth Hsu acba6351dc Extract local function to method. 2020-08-24 07:41:00 -07:00
Kenneth SkovhedeandGitHub ec1975b5a7 Merge pull request #4269 from warwickmm/target_net_471
Target .NET Framework 4.7.1
2020-08-07 10:50:35 +02:00
Kenneth SkovhedeandGitHub 04dd510be0 Merge pull request #4261 from warwickmm/avoid_deleting_unrelated_files
Avoid deleting unrelated files when removing backup configuration
2020-08-07 10:33:31 +02:00
Kenneth SkovhedeandGitHub e5b0ac2749 Merge pull request #4260 from warwickmm/remove_unnecessary_path_combine
Remove unnecessary call to Path.Combine
2020-08-07 10:31:47 +02:00
Kenneth SkovhedeandGitHub 2d628053fa Merge pull request #4259 from warwickmm/test_check_warnings_and_errors
Check for errors and warnings in unit tests
2020-08-07 10:30:21 +02:00
Kenneth SkovhedeandGitHub ac5dda8be7 Merge pull request #4257 from warwickmm/test_invalid_windows_paths
Add tests for invalid Windows paths
2020-08-07 10:29:54 +02:00
warwickmmandGitHub 8f631a99f0 Merge pull request #4274 from dferreyra/CommandLineOperationsTests_setup
Fix setup/teardown for CommandLineOperationsTests
2020-07-31 16:55:26 -07:00
Kenneth Hsu d99d40717d Merge remote-tracking branch 'upstream/master' into test_invalid_windows_paths
This allows us to simplify the ProblematicPathTests because the test
teardown methods can now handle deleting directories containing
problematic paths.
2020-07-31 16:29:28 -07:00
Dean Ferreyra c70508b96e Fix setup/teardown for CommandLineOperationsTests
Change Duplicati.UnitTest.CommandLineOperationsTests to use `Setup()`
instead of `OneTimeSetUp()` to make sure the test files are in place
for each test.

This fixes #4273.
2020-07-31 07:47:09 -07:00
Dean Ferreyra 2e777b2711 Change tests to work with long paths in Windows
Change SystemIOWindows.PathGetFullPath() to convert forward
slashes to backslashes.

Change Duplicati.UnitTest.BasicSetupHelper.ZipFileExtractToDirectory()
to rely on slash fix-ups.
2020-07-30 05:08:18 -07:00
Dean Ferreyra 73e31a79a1 Change tests to work with long paths in Windows
Even in .NET 4.6.2
`System.IO.Compression.ZipFile.ExtractToDirectory()` cannot handle
long paths.  Replace call to
`System.IO.Compression.ZipFile.ExtractToDirectory()` with an
equivalent that extracts files to a temporary location and uses I/O
functions that support long paths to move them to their final
location.

In CommandLineOperationsTests.cs, use ISystemIO functions to handle
potentially long paths.

Add a fix to RecoveryTool for long paths that was missed by #4258.

This fixes #3863.
2020-07-28 05:51:53 -07:00
Kenneth Hsu e964072690 Target .NET Framework 4.7.1.
This updates all projects to target .NET Framework 4.7.1.  The
TencentCOS and Tardigrade backends depend on .NET Standard 2.0.  When a
.NET Framework prior to 4.7.1 is targeted, the system cannot be sure
that all the dependencies exist, so it copies all dependent assemblies
to the output directory.  This causes many assemblies from the System
namespace to become bundled in the release.

https://stackoverflow.com/a/48875007

We had previously attempted to make individual projects target 4.7.1
(see pull request #4242), but this can cause compatibility issues when
4.6.2 projects depend on 4.7.1. projects.

This will require Mono 5.10.0 or greater (previously, we required 5.0.0
or greater).

https://www.mono-project.com/docs/about-mono/releases/5.10.0/#class-libraries

This fixes issue #4234.
2020-07-26 19:46:01 -07:00
Kenneth Hsu ef8209bc21 Add test to verify number of included paths. 2020-07-23 19:46:23 -07:00
Kenneth Hsu 443514dabd Rename test method. 2020-07-23 19:44:10 -07:00
Kenneth Hsu 466bc3786b Extract creation of problematic file to method. 2020-07-23 19:43:24 -07:00
Kenneth Hsu 1b7d1533ee Add test for excluding problematic paths. 2020-07-23 19:40:00 -07:00
Kenneth Hsu 0314c388ef Rename test method. 2020-07-21 13:49:41 -07:00
Kenneth Hsu 00cd10062b Add test to check that only backend files with correct prefix are deleted.
This concerns issue #2678.
2020-07-21 13:20:42 -07:00
Kenneth Hsu 77a4918f36 Add test to check that only relevant backend files are deleted.
This concerns issues #3845, and #4244.
2020-07-21 13:20:42 -07:00
Kenneth Hsu f47299d7a1 Remove unnecessary call to Path.Combine. 2020-07-20 20:08:14 -07:00
Kenneth Hsu 27c5b9ef5a Check for errors and warnings in unit tests. 2020-07-19 19:51:05 -07:00
Kenneth Hsu 654ca45892 Verify contents of restored problematic paths.
This is somewhat redundant since the RestoreHandler verifies the hash of
the restored file, but it doesn't hurt to check again.
2020-07-19 14:07:26 -07:00
Kenneth Hsu 941c8892b0 Rename test methods. 2020-07-18 18:54:10 -07:00
Kenneth Hsu c8b1e093fb Add test to backup and restore paths with problematic suffixes.
Paths that end with a dot or space are problematic on Windows.

This concerns issue #3839.
This concerns pull request #4256.
2020-07-18 18:20:27 -07:00
Kenneth Hsu 7f6411eca9 Add test to backup and restore problematic long path.
This tests a path that exceeds typical limits on Windows.

This concerns issue #3839.
This concerns pull request #4256.
2020-07-18 18:15:34 -07:00
Kenneth Hsu a837144b42 Add class to help remove problematic paths from tests.
This will make it easier to create and clean up tests that involve
problematic paths (e.g., paths that end with a dot or space on Windows).
2020-07-18 18:10:02 -07:00
Dean Ferreyra 6acbbf2136 Support problematic Windows paths
Allow historically problematic Windows paths (i.e., files or
directories that end in a dot or a space) to be backed up with
Duplicati in Windows.

This fixes #3839.
2020-07-17 21:50:29 -07:00
Kenneth SkovhedeandGitHub 3a8214a0dd Merge branch 'master' into check_errors_and_warnings_in_tests 2020-07-09 13:18:28 +02:00
Kenneth Hsu 4a1697bb27 Remove commented-out code. 2020-07-08 17:37:08 -07:00
Kenneth Hsu c992e9f76e Remove source before testing resoration of inheritance breaks.
This will be a better check for the restoration of inheritance breaks,
and also allow us to expect zero warnings as a result.
2020-07-07 19:21:35 -07:00
Kenneth Hsu 0e994ea4f1 Avoid checking for warnings in some BorderTests.
The current test data sometimes yields a "No block hash found for file"
warning.
2020-07-07 19:21:35 -07:00