-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Send SessionRecords to correct location #15937
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
Changes from 2 commits
2f35cb2
1a2e40e
1135d95
2d4ac5a
97f998d
b134864
3495ed0
ce1ce19
bc76a35
ef078fe
1f6fe99
e13a7cf
f412c19
f1bf085
0882dd0
1f1ef68
d336f62
d028fd8
3f7cf13
53fb66e
ea5c645
a1ffb1a
0dfef67
344ef94
17b964f
7f04484
6295a38
b15f7f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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; | ||
|
|
||
| namespace Azure.Core.TestFramework | ||
| { | ||
|
|
@@ -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; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. We can then retrieve the path like this from within RecordedTestBase: string path = ((AssemblyMetadataAttribute) GetType().Assembly.GetCustomAttribute(typeof(AssemblyMetadataAttribute))).Value;
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
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(); | ||
|
bquantump marked this conversation as resolved.
Outdated
|
||
| rpname.Replace(".", "-"); | ||
| } | ||
| else //Track 1 | ||
| { | ||
| int rpnamefirstindex = testname.IndexOf("Management.") + "Management.".Length; | ||
|
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); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed?