Skip to content

Send SessionRecords to correct location#15937

Merged
bquantump merged 28 commits intoAzure:masterfrom
AME-Redmond:master
Oct 28, 2020
Merged

Send SessionRecords to correct location#15937
bquantump merged 28 commits intoAzure:masterfrom
AME-Redmond:master

Conversation

@nisha-bhatia
Copy link
Copy Markdown
Contributor

Comment thread sdk/core/Azure.Core.TestFramework/src/RecordedTestBase.cs Outdated
@bquantump bquantump changed the title Send SessionRecords to correct location Send SessionRecords to correct location for MGMT Oct 13, 2020
Comment thread sdk/core/Azure.Core.TestFramework/src/RecordedTestBase.cs Outdated
Comment thread sdk/core/Azure.Core.TestFramework/src/RecordedTestBase.cs Outdated
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;

Copy link
Copy Markdown
Member

@bquantump bquantump Oct 14, 2020

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.

Copy link
Copy Markdown
Contributor

@pakrym pakrym Oct 14, 2020

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.

@JoshLove-msft
Copy link
Copy Markdown
Member

We should remove the UpdateSessionRecords target and update all of our documentation that references it:
https://github.com/Azure/azure-sdk-for-net/search?q=UpdateSessionRecords

rpname = testname.Substring(rpnamefirstindex, testname.Length - rpnamefirstindex).ToLower();
rpname.Replace(".", "-");
}
else if (testname.Substring(0,9) == "Management") //Track 1
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.

This test framework is not used for track 1 projects.

nisha-bhatia added 2 commits October 19, 2020 18:19
@nisha-bhatia nisha-bhatia removed the request for review from AlexGhiondea October 20, 2020 01:21
Comment thread sdk/core/Azure.Core.TestFramework/src/RecordedTestBase.cs Outdated
Comment thread sdk/core/Azure.Core.TestFramework/src/RecordedTestBase.cs Outdated
## Recording

When tests are run in recording mode, session records are saved to `artifacts/bin/<ProjectName>/<TargetFramework>/SessionRecords` directory. You can copy recordings to the project directory manually or by executing `dotnet msbuild /t:UpdateSessionRecords` in the test project directory.
When tests are run in recording mode, session records are saved to the project directory manually in a folder named 'Session Records'.
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.

Suggested change
When tests are run in recording mode, session records are saved to the project directory manually in a folder named 'Session Records'.
When tests are run in recording mode, session records are saved to the project directory manually in a folder named 'SessionRecords'.

}

dotnet msbuild /t:UpdateSessionRecords
dotnet msbuild
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.

This is not required

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.

@vinagesh fyi

@pakrym
Copy link
Copy Markdown
Contributor

pakrym commented Oct 27, 2020

<Target Name="AutoUpdateSessionRecords" Condition="'$(AutoUpdateSessionRecords)' == 'true'" DependsOnTargets="UpdateSessionRecordsInner" AfterTargets="Test;VSTest"/>
and
https://github.com/Azure/azure-sdk-for-net/blob/master/eng/pipelines/templates/jobs/archetype-sdk-tests.yml#L145 needs removing as well.

Comment thread eng/TestFramework.targets Outdated
@@ -5,11 +5,6 @@

<Target Name="AutoUpdateSessionRecords" Condition="'$(AutoUpdateSessionRecords)' == 'true'" DependsOnTargets="UpdateSessionRecordsInner" AfterTargets="Test;VSTest"/>
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.

This can be removed as well as UpdateSessionRecordsInner target.

}

dotnet msbuild /t:UpdateSessionRecords
dotnet msbuild
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.

All of these dotnet msbuild invocations are not required

@@ -1 +1 @@
dotnet msbuild /t:UpdateSessionRecords No newline at end of file
dotnet msbuild No newline at end of file
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.

This file is not required as well.

@bquantump
Copy link
Copy Markdown
Member

This appears to be a flakey test as rerunning the failed test allowed it to pass @pakrym
Rerun: https://github.com/Azure/azure-sdk-for-net/runs/1318105030

2020-10-27T23:02:37.0825692Z X AddsDelay [129ms]
2020-10-27T23:02:37.0825955Z Error Message:
2020-10-27T23:02:37.0826248Z Expected: less than or equal to 78
2020-10-27T23:02:37.0826554Z But was: 80
2020-10-27T23:02:37.0826690Z
2020-10-27T23:02:37.0827022Z Stack Trace:
2020-10-27T23:02:37.0827411Z at Azure.Search.Documents.Tests.ManualRetryDelayTests.AddsDelay() in /home/vsts/work/1/s/sdk/search/Azure.Search.Documents/tests/Batching/ManualRetryDelayTests.cs:line 29
2020-10-27T23:02:37.0828094Z
2020-10-27T23:02:37.0828461Z √ AddsMoreDelay [312ms]

@pakrym
Copy link
Copy Markdown
Contributor

pakrym commented Oct 28, 2020

Yes, feel free to file failing tests. This one is already filed at #16291

@bquantump bquantump merged commit d850637 into Azure:master Oct 28, 2020
annelo-msft pushed a commit to annelo-msft/azure-sdk-for-net that referenced this pull request Feb 17, 2021
* send SessionRecords to correct location

* add more error handling

* WIP: added dataplane and Track 2 correct locations for Session Records, remove Track 1, add isMgmtProject attribute to track 2 rps

* Update Directory.Build.props

* Update RecordedTestBase.cs

* add IsTestProject

* remove changes to eventhub

* remove unnecessary imports

* update docs and remove UpdateSessionRecords target

* update documentation and targets

* forgot to remove dotnet build

* Delete UpdateSessionRecords.ps1

Co-authored-by: bquantump <53361486+bquantump@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants