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

Tests\Integration\MSFT_xScriptResource.Integration.Tests.ps1: Doesn't Work Outside of AppVeyor #582

Closed
mhendric opened this issue Mar 6, 2019 · 2 comments · Fixed by #594
Labels
bug The issue is a bug.

Comments

@mhendric
Copy link
Contributor

mhendric commented Mar 6, 2019

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

Tests in 'Tests\Integration\MSFT_xScriptResource.Integration.Tests.ps1' currently fail when run from outside of AppVeyor. These tests should be adjusted to run on any supported system.

Verbose logs showing the problem


Executing script C:\Program Files\WindowsPowerShell\Modules\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xScriptResource.Integration.Tests.ps1
WARNING: There is no operation running currently. Stop will return without any action.

  Describing xScript Integration Tests

    Context Get, set, and test scripts specified and Credential not specified
      [+] Should have removed test file before config runs 2ms
      [+] Should compile and apply the MOF without throwing 428ms
      [+] Should have created the test file 2ms
      [+] Should have set file content correctly 4ms

    Context Get, set, and test scripts specified and Credential specified
      [-] Error occurred in Context block 0ms
        COMException: The group name could not be found.
        ExtendedTypeSystemException: The following exception occurred while retrieving member "SetPassword": "The group name could not be found.
        "
        at Get-AppVeyorAdministratorCredential, C:\Program Files\WindowsPowerShell\Modules\xPSDesiredStateConfiguration\Tests\CommonTestHelper.psm1: line 685
        at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xScriptResource.Integration.Tests.ps1: line 96
        at DescribeImpl, C:\Program Files\WindowsPowerShell\Modules\Pester\4.7.1\Functions\Describe.ps1: line 199
WARNING: There is no operation running currently. Stop will return without any action.

The operating system the target node is running

PS C:> Get-ComputerInfo -Property @(
'OsName',
'OsOperatingSystemSKU',
'OSArchitecture',
'WindowsVersion',
'WindowsBuildLabEx',
'OsLanguage',
'OsMuiLanguages')

OsName : Microsoft Windows Server 2019 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture : 64-bit
WindowsVersion : 1809
WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage : en-US
OsMuiLanguages : {en-US}

Version and build of PowerShell the target node is running

PS C:> $PSVersionTable

Name Value


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

Version of the DSC module that was used ('dev' if using current dev branch)

dev

@mhendric mhendric added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. labels Mar 6, 2019
@mhendric
Copy link
Contributor Author

mhendric commented Mar 6, 2019

I'm willing to work on this one (and the other AppVeyor related issues I opened), but would like to discuss what the best approach to this is. It seems that multiple Tests rely on using admin credentials and knowing the password. Part of this assumes that the tests are running on AppVeyor, which implies a known administrator account name. So the tests go in and randomly change the password on this account, and then create a credential object using that randomly generated password. There's a few problems with this:

  1. It relies on running on AppVeyor
  2. It relies on a known Administrator account name (which is different than Administrator in the case of AppVeyor)
  3. The password is not stored between scripts, so all tests that have to use credentials in a job will reset the password for that particular script.

One potential partial solution to this would be to have the test create a new account with Administrator privs, with a randomly generated password, and use that instead of relying on an existing account.

I'm not sure what the best way to re-use those credentials throughout the job is though. A Global variable comes to mind, but I know that's frowned upon.

Tagging @PlagueHO , @johlju , and @tmeckel for comment. Open to comments from the rest of the community too though.

@johlju
Copy link
Member

johlju commented Mar 7, 2019

In the integration test template it was added the possibility of using a JSON file for real scenario testing. It would be great if there were a way to pass in the correct admin and password and the configuration creates the account. Not sure how to pass in an already existing account to use in the real scenario testing (outside of AppVeyor)

@mhendric mhendric added in progress The issue is being actively worked on by someone. and removed help wanted The issue is up for grabs for anyone in the community. labels Mar 8, 2019
@kwirkykat kwirkykat removed the in progress The issue is being actively worked on by someone. label Mar 23, 2019
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.
Projects
None yet
3 participants