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

Fix functional testing and cached output errors #1334

Conversation

schrolla
Copy link
Collaborator

@schrolla schrolla commented Sep 24, 2024

🗣 Description

This request contains updates to fix failures when running tests that modify configuration setting export results prior to testing. Specifically this update:

  • Makes sure that Invoke-SCuBACached outputs CSV results for only the configured products
  • Modified provider settings file is output to the correct filename
  • The filepath of the export settings file is correctly specified when writing to disk
  • Modifies two MS.SHAREPOINT.2.1v1 test pre-conditions to ensure strict ordering

💭 Motivation and context

Some testing requires manual changes to represent uncommon or undesirable test results. Doing so means the functional test harness may intercept and change those results before running a test. The bug was preventing the modified results from being used in the tests and causing tests to fail when they should pass. We want tests to accurately report their results.

Closes #1328
Closes #1329
Closes #1333
Closes #1337

🧪 Testing

To test this PR, either run the nightly functional test pipeline to validate that all tests using cached results (UpdateProviderExport in preconditions) pass as expected, particularly MS.AAD.3.2v1 and MS.AAD.3.3v1 tests. Or run the functional tests using the ScubaGearCheck.ps1 script as follows (note: this is for internal dev use only and requires additional configuration):

ScubaGearCheck.ps1 -Baseline aad -Tenant 2 -UserAuth:$false -Filter "MS.AAD.3.[23]v1*"

All tests should pass.

Also test via:
Create output with merged json using the default invoke options, then run the following:
Invoke-ScubaCached -OutPath .\path-to-output-folder-from-original-run\ -ExportProvider $false

Also, when running functional tests verify that this error is not present in Defender tests:

WARNING: Error involving the creation of CSV version of output. See the exception message for more details: Cannot find
path 'D:\a\ScubaGear\ScubaGear\repo\M365BaselineConformance_2024_09_24_11_43_30\IndividualReports\AADReport.json' 
because it does not exist.

✅ Pre-approval checklist

  • This PR has an informative and human-readable title.
  • PR targets the correct parent branch (e.g., main or release-name) for merge.
  • Changes are limited to a single goal - eschew scope creep!
  • Changes are sized such that they do not touch excessive number of files.
  • All future TODOs are captured in issues, which are referenced in code comments.
  • These code changes follow the ScubaGear content style guide.
  • Related issues these changes resolve are linked preferably via closing keywords.
  • All relevant type-of-change labels added.
  • All relevant project fields are set.
  • All relevant repo and/or project documentation updated to reflect these changes.
  • Unit tests added/updated to cover PowerShell and Rego changes.
  • Functional tests added/updated to cover PowerShell and Rego changes.
  • All relevant functional tests passed.
  • All automated checks (e.g., linting, static analysis, unit/smoke tests) passed.

✅ Pre-merge checklist

  • PR passed smoke test check.

  • Feature branch has been rebased against changes from parent branch, as needed

    Use Rebase branch button below or use this reference to rebase from the command line.

  • Resolved all merge conflicts on branch

  • Notified merge coordinator that PR is ready for merge via comment mention

✅ Post-merge checklist

  • Feature branch deleted after merge to clean up repository.
  • Verified that all checks pass on parent branch (e.g., main or release-name) after merge.

@schrolla schrolla added bug This issue or pull request addresses broken functionality Testing This issue or task involves testing the automation tool function labels Sep 24, 2024
@schrolla schrolla added this to the Jellyfish milestone Sep 24, 2024
@schrolla schrolla self-assigned this Sep 24, 2024
@schrolla schrolla linked an issue Sep 24, 2024 that may be closed by this pull request
@schrolla schrolla marked this pull request as ready for review September 25, 2024 16:29
@schrolla schrolla changed the title Fix incorrect filename reference in LoadProviderExport Fix functional testing and cached output errors Sep 25, 2024
@buidav
Copy link
Collaborator

buidav commented Sep 26, 2024

There still seems to be errors with the functional tests in Defender, Entra, and SharePoint that all seem unconnected to each other and any other pending PRs.

functionalTests

@schrolla
Copy link
Collaborator Author

The errors we expect to see at this point are 9 test failures for Entra in MS.AAD.7.x related to Get-PrivilegedUser. There is another PR in the works that will resolve those.
The SharePoint error in this run is caused by a race condition where the Selenium server doesn't start in time for the first test, causing it to fail. It is a separate issue to address noted in #1338.

As for Defender, some of the ones in this run are due to issues with the webdriver timing out. A couple look like actual failures. I will look into those a bit more.

There still seems to be errors with the functional tests in Defender, Entra, and SharePoint that all seem unconnected to each other and any other pending PRs.
functionalTests

@buidav
Copy link
Collaborator

buidav commented Sep 26, 2024

The errors we expect to see at this point are 9 test failures for Entra in MS.AAD.7.x related to Get-PrivilegedUser. There is another PR in the works that will resolve those. The SharePoint error in this run is caused by a race condition where the Selenium server doesn't start in time for the first test, causing it to fail. It is a separate issue to address noted in #1338.

As for Defender, some of the ones in this run are due to issues with the webdriver timing out. A couple look like actual failures. I will look into those a bit more.

There still seems to be errors with the functional tests in Defender, Entra, and SharePoint that all seem unconnected to each other and any other pending PRs.
functionalTests

Will approve then for these current changes.

@schrolla
Copy link
Collaborator Author

@nanda-katikaneni Ready for merge.

@schrolla schrolla force-pushed the 1333-functionaltestutils-loadproviderexport-loads-incorrect-file branch from 3d70e0f to c8fafff Compare September 26, 2024 20:12
@schrolla
Copy link
Collaborator Author

Ran another functional test run after rebasing with AAD fixes, and none of the Entra tests fail now. SharePoint is also passing with fixes. Defender individual tests still fail, and I will investigate, although it's possible the concurrency workflow PR may prevent errors there since this branch still runs multiple tests in parallel on the same tenant. Either way, the remaining test issues are not relevant to this particular branches changes.

@adhilto adhilto mentioned this pull request Sep 27, 2024
20 tasks
@nanda-katikaneni nanda-katikaneni merged commit 78fbf93 into main Sep 27, 2024
54 of 57 checks passed
@nanda-katikaneni nanda-katikaneni deleted the 1333-functionaltestutils-loadproviderexport-loads-incorrect-file branch September 27, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue or pull request addresses broken functionality Testing This issue or task involves testing the automation tool function
Projects
None yet
4 participants