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

Create Integration Tests for Resources #121

Open
PlagueHO opened this issue Oct 14, 2016 · 9 comments · May be fixed by #592
Open

Create Integration Tests for Resources #121

PlagueHO opened this issue Oct 14, 2016 · 9 comments · May be fixed by #592
Labels
enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community.

Comments

@PlagueHO
Copy link
Member

Because AppVeyor CI now supports reboots during the Install phase, it should be possible to add Integration tests for many of the resources in this Module.

See appveyor/ci#204

@iainbrighton
Copy link
Contributor

iainbrighton commented Oct 14, 2016 via email

@PlagueHO
Copy link
Member Author

@iainbrighton - I'm not sure - I only found out tonight (thanks @Indhukrishna).

I just implemented it for xADCSDeployment Integration tests (dsccommunity/ActiveDirectoryCSDsc#19) so that AppVeyor.yml installs ADCS components and restarts the server, then tests execute. Seems to work fine.

Not sure whether or not it will manage if the LCM reboots the node though. I have a feeling restarts are only supported if they occur in the install: step of the AppVeyor pipeline. But worth investigating.

But in theory, this may allow tests to install AD features, promote a DC, perform the restart and then execute integration tests on the xADComputer, xADUser etc.

@PlagueHO
Copy link
Member Author

I have thought about this some more and this might still not be possible.

The problem is that AppVeyor must execute the text under a local account context when it first starts. However, after a test runner machine is promoted to a DC the local account context will no longer exist (domain context only). So depending on how AppVeyor logs into the machine once it has rebooted after the promotion, the next stage may fail because:

  1. Unlikely that Domain context Administrator account will have the same password as Local context Administrator
  2. AppVeyor may specify .\ local username context when logging in. It is possible that it specifies no context in which case we would only need to ensure the Administrator account password in the Domain context matched the Local Administrator account password.

@kwirkykat kwirkykat added the enhancement The issue is an enhancement request. label Oct 18, 2016
@iainbrighton
Copy link
Contributor

@PlagueHO I guess we can, but try it?!

@PlagueHO
Copy link
Member Author

@iainbrighton - gets my vote. I'll try and spare some time this weekend to do a POC.

@johlju johlju added the help wanted The issue is up for grabs for anyone in the community. label May 8, 2018
@kewalaka
Copy link

kewalaka commented Jan 2, 2019

@PlagueHO I happened to have tried this in Ansible just now (using DSC resources to do the AD join because I'm lazy 😄). Prior to AD promoition, I had two admin accounts - the built in local admin & a local vagrant user with admin rights. My Ansible-ised DSC snippet looks like this;

- name: Install AD
  win_dsc:
    resource_name: xADDomain
    DomainName: "{{ addc_domainname }}"
    DomainNetBIOSName: "{{ addc_domainnbtname }}"
    DomainAdministratorCredential_username: "{{ addc_domainadmin }}"
    DomainAdministratorCredential_password: "{{ addc_domainadminpw }}"
    SafemodeAdministratorPassword_username: "{{ addc_safemodeadmin }}"
    SafemodeAdministratorPassword_password: "{{ addc_safemodeadminpw }}"
    module_version: "{{ addc_xactivedirectoryver }}"
  register: InstallAD

The built in local admin account must meet AD password complexity requirements otherwise the upgrade will fail, however other local accounts don't have to.

Post promotion the local vagrant user continues to work, and better yet, using the local context (i.e. ".\vagrant", in my case). I could still log in using the vagrant user even though password complexity was not met. Test machine was Win2016.

A 'whoami' shows I am logged in with a domain admin account. Looking promising!

@PlagueHO
Copy link
Member Author

PlagueHO commented Jan 2, 2019

@kewalaka Nice! It sounds like this could work! Very keen to get some great test automation in for this module.

@johlju
Copy link
Member

johlju commented May 31, 2019

Since AppVeyor only support a reboot during the init stage, it will not work running integrations tests in AppVeyor. I'm working on instructions how to set up a Hyper-V private environment to be able to run integration tests manually.

I'm aiming at using PowerShell Direct in this first round. It will be one of ways to set it up, we need to work on alternatives too.

@johlju
Copy link
Member

johlju commented May 31, 2019

My plan is that the manual testing environment will support testing multiple domain controllers for larger scenarios. But one step at a time.

@SteveL-MSFT SteveL-MSFT removed this from Help Wanted in powershell/dscresources Nov 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community.
Projects
Development

Successfully merging a pull request may close this issue.

5 participants