Skip to content

Commit 1ac40ad

Browse files
committed
Initial commit.
1 parent fba2162 commit 1ac40ad

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

src/WebJobs.Script.WebHost/Models/AzureStorageInfoValue.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,12 @@ public static AzureStorageInfoValue FromEnvironmentVariable(KeyValuePair<string,
8383
}
8484

8585
var parts = environmentVariable.Value?.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
86-
if (parts == null || parts.Length != 4)
86+
if (parts == null)
87+
{
88+
return null;
89+
}
90+
91+
if (parts.Length != 4 && parts.Length != 5)
8792
{
8893
return null;
8994
}

test/WebJobs.Script.Tests.Integration/Management/AzureStorageInfoValueTests.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,20 @@ namespace Microsoft.Azure.WebJobs.Script.Tests.Integration.Management
1010
public class AzureStorageInfoValueTests
1111
{
1212
[Theory]
13-
[InlineData(null, null, null, null, null, null, false)]
14-
[InlineData("", null, "", "", "", "", false)]
15-
[InlineData("AZUREFILESSTORAGE_storageid", AzureStorageType.AzureFiles, "", "", "", "", false)]
16-
[InlineData("AZUREBLOBSTORAGE_storageid", AzureStorageType.AzureBlob, "", "", "", "", false)]
17-
[InlineData("AZUREFILESSTORAGE_storageid", AzureStorageType.AzureFiles, "", "sharename", "accesskey", "mountpath", false)]
18-
[InlineData("AZUREFILESSTORAGE_storageid", AzureStorageType.AzureFiles, "accountname", "sharename", "accesskey", "mountpath", true)]
19-
[InlineData("AZUREBLOBSTORAGE_storageid", AzureStorageType.AzureBlob, "accountname", "", "accesskey", "mountpath", false)]
20-
[InlineData("AZUREBLOBSTORAGE_storageid", AzureStorageType.AzureBlob, "accountname", "sharename", "accesskey", "mountpath", true)]
21-
public void Builds_AzureStorageInfoValue(string id, AzureStorageType? type, string accountName, string shareName, string accessKey, string mountPath, bool isValid)
13+
[InlineData(null, null, null, null, null, null, null, false)]
14+
[InlineData("", null, "", "", "", "", "", false)]
15+
[InlineData("AZUREFILESSTORAGE_storageid", AzureStorageType.AzureFiles, "", "", "", "", "", false)]
16+
[InlineData("AZUREBLOBSTORAGE_storageid", AzureStorageType.AzureBlob, "", "", "", "", "", false)]
17+
[InlineData("AZUREFILESSTORAGE_storageid", AzureStorageType.AzureFiles, "", "sharename", "accesskey", "mountpath", "", false)]
18+
[InlineData("AZUREFILESSTORAGE_storageid", AzureStorageType.AzureFiles, "accountname", "sharename", "accesskey", "mountpath", "", true)]
19+
[InlineData("AZUREFILESSTORAGE_storageid", AzureStorageType.AzureFiles, "accountname", "sharename", "accesskey", "mountpath", "smb", true)]
20+
[InlineData("AZUREBLOBSTORAGE_storageid", AzureStorageType.AzureBlob, "accountname", "", "accesskey", "mountpath", "", false)]
21+
[InlineData("AZUREBLOBSTORAGE_storageid", AzureStorageType.AzureBlob, "accountname", "sharename", "accesskey", "mountpath", "", true)]
22+
[InlineData("AZUREFILESSTORAGE_storageid", AzureStorageType.AzureFiles, "accountname", "sharename", "accesskey", "mountpath", "http", true)]
23+
public void Builds_AzureStorageInfoValue(string id, AzureStorageType? type, string accountName, string shareName, string accessKey, string mountPath, string protocol, bool isValid)
2224
{
2325
var key = id;
24-
var value = $"{accountName}|{shareName}|{accessKey}|{mountPath}";
26+
var value = $"{accountName}|{shareName}|{accessKey}|{mountPath}|{protocol}";
2527
var environmentVariable = new KeyValuePair<string, string>(key, value);
2628
var azureStorageInfoValue = AzureStorageInfoValue.FromEnvironmentVariable(environmentVariable);
2729
if (isValid)

0 commit comments

Comments
 (0)