Commit Graph
359 Commits
Author SHA1 Message Date
Riccardo Paolo Bestetti 528478fda4 Implement exponential backoff for backend errors 2022-01-20 23:22:08 +01:00
Dean Ferreyra c50223eafe Renames relating to the extended device path prefix, \\?\ 2021-11-12 07:29:43 -08:00
Dean Ferreyra 44673ef759 Changes to IOTests per review, plus other improvements
Add path to assertion messages to pinpoint test case on failures.
2021-11-10 20:33:17 -08:00
Dean Ferreyra 158614d59a Refactor \\?\ prefix tests, rename source files, plus other review issues 2021-11-09 22:50:41 -08:00
Dean Ferreyra 423921d1c2 Revert "Change Duplicati.UnitTest project to get System.Net.Http from NuGet"
This reverts commit 2f5bb306bd.

This was an experiment that was accidentally committed.
2021-11-08 20:19:22 -08:00
Dean Ferreyra 459d1f27f6 Formalize inclusion of code from https://github.com/dotnet
Fix SystemIOWindows.PathGetFullPath per review comments.

Add unit tests for SystemIOWindows.PathGetFullPath and SystemIOWindows.PrefixWithUNC.  Also, fix a bug in the SystemIOWindows.PrefixWithUNC change that was exposed by these new unit tests.

In BackendToolTests, remove unused [Setup] and [TearDown] methods.
2021-11-08 07:42:07 -08:00
Dean Ferreyra 2f5bb306bd Change Duplicati.UnitTest project to get System.Net.Http from NuGet 2021-11-06 23:20:04 -07:00
Dean Ferreyra 0e8280f6f3 Fix SystemIOWindows handling of relative paths
The handling of relative paths in SystemIOWindows was broken by changes for #4256.

Change SystemIOWindows.PrefixWithUNC to only prefix paths with `\\?\` when they can be prefixed; i.e., only prefix paths that are fully qualified and that don't contain relative path components like `.` or `..`.  This way, relative paths passed to SystemIOWindows methods work correctly again.  Also support network paths specified using forward slashes; e.g., `//example.com/share/foo.txt`.

Simplify SystemIOWindows.GetFullPath since Path.GetFullPath will honor `\\?\` prefixes and can replace forward slashes with backslashes, etc.

Copy and adapt source for Path.IsPathFullyQualified from https://github.com/dotnet/runtime, which is MIT licensed.

Add unit test for Duplicati.CommandLine.BackendTool to validate the fix.

This fixes #4632.
2021-11-06 17:14:18 -07:00
Kenneth SkovhedeandGitHub 976173fd49 Merge pull request #4512 from warwickmm/make_filters_match_newline
Make dot in filter regex match newline characters
2021-08-11 10:30:59 +02:00
marodev e87688d9d3 Fix ReSharper's "Use string interpolation expression" / Code Smell 2021-05-15 17:02:57 +02:00
Kenneth Hsu a58f6b5d69 Add test for restoring file with newline character in name.
This concerns #4508.
2021-05-14 18:36:28 -07:00
Kenneth Hsu 4cc7beea2c Add test for restoring directory containing problematic filenames. 2021-05-14 18:34:52 -07:00
Kenneth Hsu 53621c984d Simplify verification of restored file in test. 2021-05-14 18:34:52 -07:00
warwickmmandGitHub 50ed059e11 Merge pull request #4469 from tygill/fix/ms-graph-throttling
Fix OneDrive throttling and respect retry-after header.
2021-05-04 09:42:52 -07:00
warwickmmandGitHub da2e51a80b Merge pull request #4431 from warwickmm/add_workflow_for_tests
Add GitHub workflow to run tests
2021-05-03 11:47:18 -07:00
Tyler Gill 70583f5d93 Add a bit more test coverage. 2021-03-20 12:29:57 -06:00
Tyler Gill 719adbf1f1 Clean up a few more bugs and inconsistencies in ReadLimitLengthStream. 2021-03-19 13:59:09 -06:00
Tyler Gill 7f1b6bc7a2 Fix some bugs in ReadLimitLengthStream changes, and add a unit test for some of the new behavior.
Also make NonSeekableStream block seeks via the Position setter.
2021-03-18 12:24:11 -06:00
Kenneth Skovhede 88a1ec59c3 Added delay to purge-broken-files unittest.
Since the repair introduces artifical filelists, there is sometimes a race in CI where the purge is faster than a second causing the time sequences to not line up during testing.
2021-03-08 11:53:13 +01:00
Kenneth SkovhedeandGitHub 5498f16f7a Merge pull request #4414 from warwickmm/test/run_script_after
Add test for run-script-after option
2021-03-06 15:00:38 +01:00
Kenneth SkovhedeandGitHub 90a8c34c06 Merge pull request #4398 from warwickmm/bugfix/repair_missing_blocklists
Fix bug in repairing multiple missing blocklist hashes
2021-03-06 14:23:20 +01:00
Kenneth SkovhedeandGitHub 713b0b0746 Merge pull request #4417 from warwickmm/handle_unsupported_run_script_exit_codes
Abort with error if run-script-before script returns unsupported code
2021-03-06 14:12:33 +01:00
Kenneth Hsu d6e9e08272 Increase tolerance for last write time tests on macOS.
There are occasionally times where the difference is greater than 500ms.

1) Failed : Duplicati.UnitTest.BorderTests.Run100k
  Restore, creation time mismatch for /Users/runner/duplicati_testdata/backup-data/c-m2 and /Users/runner/duplicati_testdata/restored/c-m2
  Expected: 2021-02-08 18:39:04.9202665 +/- 00:00:00.5000000
  But was:  2021-02-08 18:39:05.572262
  at Duplicati.UnitTest.TestUtils.AssertFilesAreEqual (System.String
  expectedFile, System.String actualFile, System.Boolean verifymetadata,
  System.String contextMessage) [0x0016f] in
  /Users/runner/work/duplicati/duplicati/Duplicati/UnitTest/TestUtils.cs:256
2021-02-08 11:48:05 -08:00
Kenneth Hsu cb89d50862 Increase tolerance for last write time tests on macOS.
There are occasionally times where the difference is greater than 200ms.

1) Failed : Duplicati.UnitTest.BorderTests.Run100k
  Restore, creation time mismatch for /Users/runner/duplicati_testdata/backup-data/b-p500 and /Users/runner/duplicati_testdata/restored/b-p500
  Expected: 2021-02-08 00:34:08.0221856 +/- 00:00:00.2500000
  But was:  2021-02-08 00:34:08.296859

  at Duplicati.UnitTest.TestUtils.AssertFilesAreEqual (System.String
  expectedFile, System.String actualFile, System.Boolean verifymetadata,
  System.String contextMessage) [0x0016f] in
  /Users/runner/work/duplicati/duplicati/Duplicati/UnitTest/TestUtils.cs:256
2021-02-07 20:22:23 -08:00
Kenneth Hsu 1e8752a0cd Increase tolerance for last write time tests on macOS.
There are occasionally times where the difference is greater than 100ms.
2021-02-07 13:59:34 -08:00
Kenneth Hsu 6ec037acc0 Use helper method to determine platform.
We should eventually make this method use
RuntimeInformation.IsOSPlatform.
2021-02-07 11:59:20 -08:00
Kenneth Hsu 97c33a0e13 Fix comment style. 2021-02-07 11:58:37 -08:00
Thomas SuckowandKenneth Hsu 06850697bd Relax unit test file time checking on osx 2021-02-07 11:58:02 -08:00
Kenneth Hsu 64410b4284 Dispose HttpWebResponse after use.
This seems to help avoid "System.Net.WebException : The operation has
timed out." issues when downloading test data.
2021-02-07 11:12:39 -08:00
Kenneth Hsu c47ab50892 Revert "Test deliberate test failure."
This reverts commit aca2f18634.
2021-02-06 18:38:48 -08:00
Kenneth Hsu aca2f18634 Test deliberate test failure. 2021-02-06 11:51:30 -08:00
Kenneth Hsu 11bd54d160 Fix test for DUPLICATI__PARSED_RESULT on Windows. 2021-01-14 20:21:47 -08:00
Kenneth Hsu 148788a879 Add test for DUPLICATI__PARSED_RESULT environment variable.
This concerns issue #4222.
2021-01-14 19:39:03 -08:00
Kenneth Hsu c11f7c2e47 Avoid testing scripts with exit code -1.
The behavior is not consistent or well-defined across shells.

https://unix.stackexchange.com/questions/418784/what-is-the-min-and-max-values-of-exit-codes-in-linux
2021-01-10 15:53:51 -08:00
Kenneth Hsu 359ae2c85b Add test for unsupported script exit codes. 2021-01-10 10:44:58 -08:00
Kenneth Hsu c377e33e3d Remove spaces around redirection operator.
This was failing in AppVeyor with the message:

Expected string length 5 but was 6. Strings differ at index 5.
Expected: "Hello"
But was:  "Hello "
2021-01-09 12:26:20 -08:00
Kenneth Hsu 232544e5a3 Remove quotes from echo statement in run-script-after test.
The behavior appears to be different between Windows and Linux.
2021-01-09 12:00:01 -08:00
Kenneth Hsu 80028005c1 Add test for run-script-after. 2021-01-09 11:14:31 -08:00
Kenneth Hsu d4b349bb99 Add test for repairing multiple missing blocklist hashes.
This concerns issue #4397.
2020-12-26 21:43:43 -08:00
Kenneth SkovhedeandGitHub ca073a2d0c Merge pull request #4380 from warwickmm/fix_purge_broken_files_dry_run
Fix error encountered during dry-run of purge-broken-files
2020-12-19 14:44:21 +01:00
Kenneth Hsu 780f53b89a Add test for purging broken files with dry-run.
This concerns #4379.
2020-11-30 19:56:08 -08:00
Kenneth Hsu 6570cd954c Add test for specifying remote URL using run-script-before.
This concerns issue #3651.
2020-11-01 14:19:09 -08:00
Kenneth Hsu ca5aad9ccb Allow custom commands to be provided to CreateScript test helper. 2020-11-01 13:14:00 -08:00
Kenneth SkovhedeandGitHub 40416560e6 Merge pull request #4352 from duplicati/feature/new_unittest_datahost
Changed unittes datahost to reduce S3 transfer charges
2020-10-27 11:28:50 +01:00
Kenneth Skovhede 5fd1c883e3 Changed to using a proxied host to reduce S3 transfer charges from unittests 2020-10-19 00:44:10 +02:00
Kenneth Hsu d5b6386cfe Use helper method to compare contents of directories. 2020-09-27 14:06:03 -07:00
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