Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass throwOnError: true when calling container.Export in unit tests #202

Merged
merged 1 commit into from
Sep 13, 2021

Conversation

0xced
Copy link
Contributor

@0xced 0xced commented Sep 13, 2021

Without it the ExportRunningContainerExploadedShallSucceed test would fail (Assert.IsTrue failed) but hides the actual cause of the error:

Ductus.FluentDocker.Common.FluentDockerException: Exception while un-taring archive ---> SharpCompress.Common.ExtractionException: Entry is a symbolic link but ExtractionOptions.WriteSymbolicLink delegate is null
   at SharpCompress.Common.ExtractionMethods.WriteEntryToFile(IEntry entry, String destinationFileName, ExtractionOptions options, Action`2 openAndWrite)
   at SharpCompress.Readers.IReaderExtensions.WriteEntryToFile(IReader reader, String destinationFileName, ExtractionOptions options)
   at SharpCompress.Common.ExtractionMethods.WriteEntryToDirectory(IEntry entry, String destinationDirectory, ExtractionOptions options, Action`2 write)
   at SharpCompress.Readers.IReaderExtensions.WriteEntryToDirectory(IReader reader, String destinationDirectory, ExtractionOptions options)
   at Ductus.FluentDocker.Extensions.CompressionExtensions.UnTar(String file, String destPath) in Ductus.FluentDocker/Extensions/CompressionExtensions.cs:line 19
   at Ductus.FluentDocker.Services.Extensions.ContainerExtensions.Export(IContainerService service, TemplateString fqPath, Boolean explode, Boolean throwOnError) in Ductus.FluentDocker/Services/Extensions/ContainerExtensions.cs:line 125
--- End of inner exception stack trace ---
    at Ductus.FluentDocker.Services.Extensions.ContainerExtensions.Export(IContainerService service, TemplateString fqPath, Boolean explode, Boolean throwOnError) in Ductus.FluentDocker/Services/Extensions/ContainerExtensions.cs:line 133
   at Ductus.FluentDocker.Tests.ServiceTests.ContainerServiceBasicTests.ExportRunningContainerExploadedShallSucceed() in Ductus.FluentDocker.Tests/ServiceTests/ContainerServiceBasicTests.cs:line 268

Without it the `ExportRunningContainerExploadedShallSucceed` test would fail (Assert.IsTrue failed) but hides the actual cause of the error:
```
Ductus.FluentDocker.Common.FluentDockerException: Exception while un-taring archive ---> SharpCompress.Common.ExtractionException: Entry is a symbolic link but ExtractionOptions.WriteSymbolicLink delegate is null
   at SharpCompress.Common.ExtractionMethods.WriteEntryToFile(IEntry entry, String destinationFileName, ExtractionOptions options, Action`2 openAndWrite)
   at SharpCompress.Readers.IReaderExtensions.WriteEntryToFile(IReader reader, String destinationFileName, ExtractionOptions options)
   at SharpCompress.Common.ExtractionMethods.WriteEntryToDirectory(IEntry entry, String destinationDirectory, ExtractionOptions options, Action`2 write)
   at SharpCompress.Readers.IReaderExtensions.WriteEntryToDirectory(IReader reader, String destinationDirectory, ExtractionOptions options)
   at Ductus.FluentDocker.Extensions.CompressionExtensions.UnTar(String file, String destPath) in Ductus.FluentDocker/Extensions/CompressionExtensions.cs:line 19
   at Ductus.FluentDocker.Services.Extensions.ContainerExtensions.Export(IContainerService service, TemplateString fqPath, Boolean explode, Boolean throwOnError) in Ductus.FluentDocker/Services/Extensions/ContainerExtensions.cs:line 125
--- End of inner exception stack trace ---
    at Ductus.FluentDocker.Services.Extensions.ContainerExtensions.Export(IContainerService service, TemplateString fqPath, Boolean explode, Boolean throwOnError) in Ductus.FluentDocker/Services/Extensions/ContainerExtensions.cs:line 133
   at Ductus.FluentDocker.Tests.ServiceTests.ContainerServiceBasicTests.ExportRunningContainerExploadedShallSucceed() in Ductus.FluentDocker.Tests/ServiceTests/ContainerServiceBasicTests.cs:line 268
```
@mariotoffia mariotoffia merged commit 1057a1f into mariotoffia:master Sep 13, 2021
@0xced 0xced deleted the throwOnError branch May 26, 2023 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants