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

SqlDatabaseObjectPermission: Unit tests throw error relating to incorrect use of 'Microsoft.Management.Infrastructure.CimInstance' with missing Where() method #1648

Closed
SphenicPaul opened this issue Dec 12, 2020 · 1 comment · Fixed by #1649
Labels
bug The issue is a bug. tests The issue or pull request is about tests only.

Comments

@SphenicPaul
Copy link
Contributor

Details of the scenario you tried and the problem that is occurring

Having forked and cloned the SqlServerDsc repository, and having attempted to run the unit tests (after no changes), there are 12 unit test failures within the DSC_SqlDatabaseObjectPermission.Tests.ps1, tests script, all giving the same failure...

Method invocation failed because [Microsoft.Management.Infrastructure.CimInstance] does not contain a method named 'Where'.

This seems a similar problem/issue as encountered in #1600

Verbose logs showing the problem

N/A

Suggested solution to the issue

Within the tests\Unit\DSC_SqlDatabaseObjectPermission.Tests.ps1 script, replace the references/usages of $comparedReturnValue.Actual.Where to $comparedReturnValue.Actual | Where-Object -FilterScript

The DSC configuration that is used to reproduce the issue (as detailed as possible)

N/A

SQL Server edition and version the target node is running

N/A

SQL Server PowerShell modules present on the target node

N/A

The operating system the target node is running

OsName : Microsoft Windows 10 Pro
OsOperatingSystemSKU : 48
OsArchitecture : 64-bit
WindowsVersion : 2004
WindowsBuildLabEx : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage : en-GB
OsMuiLanguages : {en-GB}

Version and build of PowerShell the target node is running

PSVersion 5.1.19041.610
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.610
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Version of the DSC module that was used

N/A

@SphenicPaul
Copy link
Contributor Author

SphenicPaul commented Dec 12, 2020

I've raised PR #1649 that should hopefully resolve this - I've now been able to successfully run these unit tests locally (without error/failures) following these changes.

@johlju johlju added bug The issue is a bug. tests The issue or pull request is about tests only. labels Dec 13, 2020
johlju pushed a commit that referenced this issue Dec 13, 2020
…ere()` method error (#1649)

- SqlDatabaseObjectPermission
  - Updated unit tests to remove errors relating to missing `Where()` method (issue #1648).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug. tests The issue or pull request is about tests only.
Projects
None yet
2 participants