Skip to content
Merged
Changes from 2 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2f35cb2
send SessionRecords to correct location
Oct 13, 2020
1a2e40e
Merge branch 'updateRecordingsLocation'
Oct 13, 2020
1135d95
add more error handling
Oct 14, 2020
2d4ac5a
Merge branch 'updateRecordingsLocation'
Oct 14, 2020
97f998d
WIP: added dataplane and Track 2 correct locations for Session Record…
Oct 20, 2020
b134864
Merge branch 'updateRecordingsLocation'
Oct 20, 2020
3495ed0
remove checking if rp is mgmt or dataplane
Oct 20, 2020
ce1ce19
Merge branch 'updateRecordingsLocation'
Oct 20, 2020
bc76a35
Update Directory.Build.props
Oct 20, 2020
ef078fe
Merge branch 'updateRecordingsLocation'
Oct 20, 2020
1f6fe99
Update RecordedTestBase.cs
Oct 20, 2020
e13a7cf
Merge branch 'updateRecordingsLocation'
Oct 20, 2020
f412c19
add IsTestProject
Oct 22, 2020
f1bf085
Merge branch 'updateRecordingsLocation'
Oct 22, 2020
0882dd0
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-net i…
bquantump Oct 23, 2020
1f1ef68
remove changes to eventhub
Oct 23, 2020
d336f62
Merge branch 'updateRecordingsLocation'
Oct 23, 2020
d028fd8
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-net
Oct 23, 2020
3f7cf13
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-net
Oct 23, 2020
53fb66e
remove unnecessary imports
Oct 23, 2020
ea5c645
Merge branch 'updateRecordingsLocation'
Oct 23, 2020
a1ffb1a
update docs and remove UpdateSessionRecords target
Oct 27, 2020
0dfef67
update documentation and targets
Oct 27, 2020
344ef94
forgot to remove dotnet build
Oct 27, 2020
17b964f
Delete UpdateSessionRecords.ps1
Oct 27, 2020
7f04484
Revert "forgot to remove dotnet build"
Oct 28, 2020
6295a38
Revert "Delete UpdateSessionRecords.ps1"
Oct 28, 2020
b15f7f8
Delete UpdateSessionRecords.ps1
Oct 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion sdk/core/Azure.Core.TestFramework/src/RecordedTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using NUnit.Framework;
using static System.Net.Mime.MediaTypeNames;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed?


namespace Azure.Core.TestFramework
{
Expand Down Expand Up @@ -78,7 +80,41 @@ private string GetSessionFilePath()
string className = testAdapter.ClassName.Substring(testAdapter.ClassName.LastIndexOf('.') + 1);

string fileName = name + (IsAsync ? "Async" : string.Empty) + ".json";
return Path.Combine(TestContext.CurrentContext.TestDirectory,

var path = TestContext.CurrentContext.TestDirectory;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an enhancement that we would want to enable for all Track 2 tests. It will be really helpful for users.

It might be better to use an attribute that we include in https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/Directory.Build.props.

  <ItemGroup>
    <AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
    <_Parameter1>SourcePath</_Parameter1>
    <_Parameter2>$(MSBuildProjectDirectory)</_Parameter2>
    </AssemblyAttribute>
  </ItemGroup>

We can then retrieve the path like this from within RecordedTestBase:

string path = ((AssemblyMetadataAttribute) GetType().Assembly.GetCustomAttribute(typeof(AssemblyMetadataAttribute))).Value;

@bquantump bquantump Oct 14, 2020

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were only going to do this for MGMT plane, are you suggesting we do this for data plane as well?

This suggestion seems simpler as well if @nisha-bhatia can get it from this property.

Also, we were going to apply this to track 1 MGMT as well, not just track 2.

@pakrym pakrym Oct 14, 2020

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think making this change both for data and management plane makes sense. There is no need to bifurcate the workflow.

var newpath = path.Substring(0, path.IndexOf("artifacts")) + "sdk";

// check if Track 1 or Track 2
int firstIndex = path.IndexOf("bin\\") + "bin\\".Length;
int lastIndex = path.LastIndexOf(".Tests");
var testname = path.Substring(firstIndex, lastIndex - firstIndex);
Comment thread
bquantump marked this conversation as resolved.
Outdated
var rpname = "";
if (testname[0] == 'A') //Track 2
{
int rpnamefirstindex = testname.IndexOf("ResourceManager.") + "ResourceManager.".Length;
rpname = testname.Substring(rpnamefirstindex, testname.Length - rpnamefirstindex).ToLower();
Comment thread
bquantump marked this conversation as resolved.
Outdated
rpname.Replace(".", "-");
}
else //Track 1
{
int rpnamefirstindex = testname.IndexOf("Management.") + "Management.".Length;
Comment thread
bquantump marked this conversation as resolved.
Outdated
rpname = testname.Substring(rpnamefirstindex, testname.Length - rpnamefirstindex).ToLower();
rpname.Replace(".", "-");
}
var directories = Directory.GetDirectories(newpath);
for (int i = 0; i < directories.Length; i++)
{
int directoryIndex = directories[i].IndexOf("sdk\\") + "sdk\\".Length;
directories[i] = directories[i].Substring(directoryIndex, directories[i].Length - directoryIndex);
}
var rpexists = directories.Contains(rpname);
if (!rpexists)
{
throw new Exception();
}
newpath += "\\" + rpname + "\\";
newpath += testname + "\\tests\\";
return Path.Combine(newpath,
"SessionRecords",
additionalParameterName == null ? className : $"{className}({additionalParameterName})",
fileName);
Expand Down