Skip to content
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

stabilize tests and update libg #15736

Merged
merged 21 commits into from
Jan 16, 2025
Merged

stabilize tests and update libg #15736

merged 21 commits into from
Jan 16, 2025

Conversation

pinzart90
Copy link
Contributor

@pinzart90 pinzart90 commented Dec 21, 2024

Purpose

Update libg (more debug logs)
Stabilize tests

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated
  • This PR contains no files larger than 50 MB

Release Notes

(FILL ME IN) Brief description of the fix / enhancement. Use N/A to indicate that the changes in this pull request do not apply to Release Notes. Mandatory section

Reviewers

(FILL ME IN) Reviewer 1 (If possible, assign the Reviewer for the PR)

(FILL ME IN, optional) Any additional notes to reviewers or testers.

FYIs

(FILL ME IN, Optional) Names of anyone else you wish to be notified of

Copy link

github-actions bot commented Dec 21, 2024

UI Smoke Tests

Test: success. 11 passed, 0 failed.
TestComplete Test Result
Workflow Run: UI Smoke Tests
Check: UI Smoke Tests

var firstASMmodulePath = string.Empty;
foreach (string module in assemblies)
var firstASMmodulePath = string.Empty;
foreach (ProcessModule module in dynamoCLI.Modules)
Copy link
Member

Choose a reason for hiding this comment

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

I think these are IDisposable.

var firstASMmodulePath = string.Empty;
foreach (ProcessModule module in dynamoCLI.Modules)
{
if (module.ModuleName.IndexOf("Analytics.dll", StringComparison.OrdinalIgnoreCase) != -1)
Copy link
Member

Choose a reason for hiding this comment

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

Are all of these modules managed modules? Will this property return both managed and unmanaged?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

both, managed and unmanaged

Process[] procs = Process.GetProcessesByName("excel");
foreach (Process proc in procs)
proc.Kill();
foreach (var process in Process.GetProcessesByName("EXCEL"))
Copy link
Member

Choose a reason for hiding this comment

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

is it better to use your new method for this, or that requires having the windows instance of excel?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, we don't have the handle here. We do however identify the process by the title.

@pinzart90 pinzart90 changed the title update libg stabilize tests and update libg Jan 6, 2025
@QilongTang QilongTang added this to the 3.5 milestone Jan 6, 2025
if (DynamoModel.IsTestMode && !string.IsNullOrEmpty(CreationProperties?.UserDataFolder))
{
var newPath = Path.Combine(Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName, "Webview2Data", $"{Environment.ProcessId}", tag);
if (Directory.Exists(newPath))
Copy link
Contributor

Choose a reason for hiding this comment

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

You mean if directory does not exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed this part. Will try it out in another PR

@@ -131,7 +131,6 @@ void WindowClosed(object sender, EventArgs e)

ss.Closed -= WindowClosed;

Assert.IsNull(ss.webView);// Make sure webview2 was disposed
Copy link
Contributor

Choose a reason for hiding this comment

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

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I found that waiting for the ss.webView object to be disposed is not reliable and not critical for this test.
This is an intentional change

proc.Kill();
foreach (var process in Process.GetProcessesByName("EXCEL"))
{
if (process.MainWindowTitle.Equals("ImportExport_Data To Excel - Excel"))
Copy link
Contributor

Choose a reason for hiding this comment

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

What process is it that does not have this title? IOW, what other titles are there? Is this title specific to Dynamo or the tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The titles are specific to each dyn. If a test runs a dyn that reads/writes an excel file name "test1", then the excel window will have the title "test1 - Excel". This title is set by the excel interop API (AFAIK)

Service.ShutDown();
{
// Lock shutdown sequence in case other tracking calls might be executing concurently.
lock(trackEventLockObj)
Copy link
Member

Choose a reason for hiding this comment

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

so I might be wrong - but in all other cases this lock is held from a worker thread on the thread pool, not from main thread... could this cause a dead lock?

Copy link
Contributor Author

@pinzart90 pinzart90 Jan 16, 2025

Choose a reason for hiding this comment

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

From what I could tell from the logs Looks like there is concurrent access to an analytics resource (a dictionary). The dictionary is changed while it is iterated over in another thread. The Shutdown call is the only one that is not thread safe

@@ -105,7 +105,7 @@ public static bool ExcelProcessRunning
{
get
{
return Process.GetProcessesByName("EXCEL").Length != 0;
return GetExcelProcess(_app) != null;
Copy link
Member

Choose a reason for hiding this comment

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

could you briefly explain these changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With my change we can check if the Excel process that is associated with the COM object "_app" is alive.
Previously we were checking if any process called "EXCEL" was running. It seemed that could get into situations where multiple Excel processes could get mixed up

@@ -139,18 +138,10 @@
<ItemGroup>
<Folder Include="NodesJsonDatasets\" />
</ItemGroup>
<Target Name="CopyDisableADPTestDeps">
Copy link
Member

Choose a reason for hiding this comment

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

nice

@@ -154,10 +154,10 @@ protected void OpenModelInManualMode(string relativeFilePath)
CurrentDynamoModel.ExecuteCommand(new DynamoModel.OpenFileCommand(openPath, true));
}

protected void OpenSampleModel(string relativeFilePath)
protected void OpenSampleModel(string relativeFilePath, bool forceManualExecution = false)
Copy link
Member

Choose a reason for hiding this comment

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

I actually think this is a binary API break for clients who derive from this class for their tests, which is public, I think you need to add a new overload.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, it would break ABI compatibility. Nice catch!

//Todo Ritesh: Locally passing but failing on CI.
//After fixing issue with this test case add Smoke Test Category.
//Todo Ritesh: Locally passing but failing on CI.
//After fixing issue with this test case add Smoke Test Category.
public void ImportExport_Excel_to_Dynamo()
Copy link
Member

Choose a reason for hiding this comment

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

does this pass now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fails on the master-15 machines.

Copy link
Member

@mjkkirschner mjkkirschner left a comment

Choose a reason for hiding this comment

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

one change request WRT to API - rest was just comments you can accept or ignore.

@pinzart90 pinzart90 merged commit 0b11829 into master Jan 16, 2025
23 of 24 checks passed
@pinzart90 pinzart90 deleted the update_libg231 branch January 16, 2025 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants