Skip to content

Commit

Permalink
Add storage account name constant (Azure#35)
Browse files Browse the repository at this point in the history
* Add StorageAccountName constant.

* Fix Context calling
  • Loading branch information
romahamu committed Mar 16, 2020
1 parent 768ba77 commit 2ac58a8
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public HpcCacheTestFixture()

using (this.Context = new HpcCacheTestContext(callingClassType, mockName))
{
//this.Context = new HpcCacheTestContext(this);
this.Context = new HpcCacheTestContext(callingClassType, mockName);
try
{
StorageCacheManagementClient storagecacheMgmtClient = this.Context.GetClient<StorageCacheManagementClient>();
Expand Down
11 changes: 10 additions & 1 deletion src/StorageCache/HPCCache.Test/Fixtures/StorageAccountFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public StorageAccountFixture(HpcCacheTestFixture fixture)
var mockName = sf.GetMethod().Name;
using (this.Context = new HpcCacheTestContext(callingClassType, mockName))
{
// this.Context = new HpcCacheTestContext(this);
this.Context = new HpcCacheTestContext(callingClassType, mockName);
this.StorageTarget = this.AddClfsStorageTarget(this.Context);
Match clfsTargetMatch = ClfsTargetRegex.Match(this.StorageTarget.Clfs.Target);
var storageAccountName = clfsTargetMatch.Groups["StorageAccountName"].Value;
Expand Down Expand Up @@ -212,6 +212,15 @@ public void Dispose()
storageTargetName = HpcCacheTestEnvironmentUtilities.StorageTargetName;
}

if (string.IsNullOrEmpty(HpcCacheTestEnvironmentUtilities.StorageAccountName))
{
storageAccountName = string.IsNullOrEmpty(suffix) ? storageAccountName : storageAccountName + suffix;
}
else
{
storageAccountName = HpcCacheTestEnvironmentUtilities.StorageAccountName;
}

var client = context.GetClient<StorageCacheManagementClient>();
client.ApiVersion = Constants.DefaultAPIVersion;
this.fixture.CacheHelper.StoragecacheManagementClient = client;
Expand Down
5 changes: 5 additions & 0 deletions src/StorageCache/HPCCache.Test/Utilities/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,10 @@ public static class Constants
/// Storage target name.
/// </summary>
// public static readonly string StorageTargetName = "msazure";

/// <summary>
/// Storage account name.
/// </summary>
public static readonly string StorageAccountName = "romahamu";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,24 @@ public static string StorageTargetName
}
}

/// <summary>
/// Gets storage account name
/// </summary>
public static string StorageAccountName
{
get
{
try
{
return GetValueFromEnvironment("StorageAccountName");
}
catch (KeyNotFoundException)
{
return null;
}
}
}

/// <summary>
/// Get subscription id.
/// </summary>
Expand Down

0 comments on commit 2ac58a8

Please sign in to comment.