-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updating file properties for self-contained zip deployments (#529)
* updating file properties for self-contained zip deployments * retrying delete * fixes * simplifying * another simplification
- Loading branch information
Showing
8 changed files
with
232 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: InternalsVisibleTo("Microsoft.Azure.Functions.SdkTests, PublicKey=00240000048000009400000006020000002400005253413100040000010001005148be37ac1d9f58bd40a2e472c9d380d635b6048278f7d47480b08c928858f0f7fe17a6e4ce98da0e7a7f0b8c308aecd9e9b02d7e9680a5b5b75ac7773cec096fbbc64aebd429e77cb5f89a569a79b28e9c76426783f624b6b70327eb37341eb498a2c3918af97c4860db6cdca4732787150841e395a29cfacb959c1fd971c1")] | ||
[assembly: InternalsVisibleTo("Microsoft.Azure.Functions.SdkE2ETests, PublicKey=00240000048000009400000006020000002400005253413100040000010001005148be37ac1d9f58bd40a2e472c9d380d635b6048278f7d47480b08c928858f0f7fe17a6e4ce98da0e7a7f0b8c308aecd9e9b02d7e9680a5b5b75ac7773cec096fbbc64aebd429e77cb5f89a569a79b28e9c76426783f624b6b70327eb37341eb498a2c3918af97c4860db6cdca4732787150841e395a29cfacb959c1fd971c1")] | ||
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=00240000048000009400000006020000002400005253413100040000010001005148be37ac1d9f58bd40a2e472c9d380d635b6048278f7d47480b08c928858f0f7fe17a6e4ce98da0e7a7f0b8c308aecd9e9b02d7e9680a5b5b75ac7773cec096fbbc64aebd429e77cb5f89a569a79b28e9c76426783f624b6b70327eb37341eb498a2c3918af97c4860db6cdca4732787150841e395a29cfacb959c1fd971c1")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
using ICSharpCode.SharpZipLib.Zip; | ||
using Microsoft.Azure.Functions.SdkE2ETests; | ||
using Microsoft.NET.Sdk.Functions.MSBuild.Tasks; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace Microsoft.Azure.Functions.SdkTests | ||
{ | ||
public class ZipDeployTests | ||
{ | ||
private ITestOutputHelper _testOutputHelper; | ||
|
||
public ZipDeployTests(ITestOutputHelper testOutputHelper) | ||
{ | ||
_testOutputHelper = testOutputHelper; | ||
} | ||
|
||
[Theory] | ||
[InlineData("linux-x64", true)] | ||
[InlineData("win-x64", false)] | ||
[InlineData("win-x64", true)] | ||
public async Task CreateZipFileFromDirectory_SetsExecutableFlag_WhenSelfContained(string rid, bool selfContained) | ||
{ | ||
string testName = nameof(CreateZipFileFromDirectory_SetsExecutableFlag_WhenSelfContained); | ||
string directoryToZip = await TestUtility.InitializeTestAsync(_testOutputHelper, testName); | ||
|
||
string zipName = Path.Combine(Directory.GetParent(directoryToZip).FullName, $"{testName}.zip"); | ||
|
||
if (File.Exists(zipName)) | ||
{ | ||
File.Delete(zipName); | ||
} | ||
|
||
string projectFileDirectory = Path.Combine(TestUtility.SamplesRoot, "FunctionApp", "FunctionApp.csproj"); | ||
|
||
await TestUtility.RestoreAndPublishProjectAsync(projectFileDirectory, directoryToZip, $"-r {rid} --self-contained {selfContained}", _testOutputHelper); | ||
|
||
CreateZipFileTask.CreateZipFileFromDirectory(directoryToZip, zipName); | ||
|
||
using (var zip = new ZipFile(zipName)) | ||
{ | ||
Assert.Equal(Directory.GetFiles(directoryToZip, "*", SearchOption.AllDirectories).Length, zip.Count); | ||
|
||
for (int i = 0; i < zip.Count; i++) | ||
{ | ||
var entry = zip[i]; | ||
if (selfContained && | ||
(entry.Name == "FunctionApp" || entry.Name == "FunctionApp.exe")) | ||
{ | ||
Assert.Equal(3, entry.HostSystem); | ||
Assert.Equal(CreateZipFileTask.UnixExecutablePermissions, entry.ExternalFileAttributes); | ||
} | ||
else | ||
{ | ||
Assert.Equal(0, entry.HostSystem); | ||
Assert.Equal(0, entry.ExternalFileAttributes); | ||
} | ||
} | ||
|
||
zip.Close(); | ||
} | ||
} | ||
} | ||
} |