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

xSQLServer: Problem running integration tests with fixes in issue #649 #774

Closed
johlju opened this issue Aug 18, 2017 · 2 comments · Fixed by #800
Closed

xSQLServer: Problem running integration tests with fixes in issue #649 #774

johlju opened this issue Aug 18, 2017 · 2 comments · Fixed by #800
Labels
enhancement The issue is an enhancement request.

Comments

@johlju
Copy link
Member

johlju commented Aug 18, 2017

Details of the scenario you tried and the problem that is occurring:
I got a problem when trying to send in a pull request for issue #649. The integration tests fail because in appveyor.yml we are removing all the SQLPS modules because they messed up the mocking of SMO (more information in issue #239). And the integration tests need SQLPS (or SqlServer) PowerShell module to runm with these fixes in issue #649.

Because we are removing that SQLPS module, and there is already SQL Server 2016 Developer edition installed on the AppVeyor build worker, SQL Server Setup does not reinstall SQLPS module.
BUT, if it would, or we just don't remove it, then the unit testing would start to break again. Because the SMO assembly is loaded so our SMO mocks can't load, breaking the unit tests.

The DSC configuration that is using the resource (as detailed as possible):
n/a

Version of the Operating System, SQL Server and PowerShell the DSC Target Node is running:
n/a

What module (SqlServer or SQLPS) and which version of the module the DSC Target Node is running:
n/a

Version of the DSC module you're using, or 'dev' if you're using current dev branch:
Dev

@johlju johlju added enhancement The issue is an enhancement request. in progress The issue is being actively worked on by someone. labels Aug 18, 2017
@johlju
Copy link
Member Author

johlju commented Aug 18, 2017

Currently I'm looking at splitting up the Unit tests and Integration tests so they run in different build workers.

@johlju
Copy link
Member Author

johlju commented Aug 18, 2017

Splitting on different build workers does work. But the test framework currently doesn't handle that, because it will send up an incomplete test result file (the last run only). And the code coverage listing in AppVeyor will not be accurate since it will not take in account the order test run.

I will look at another solution, which means I have to modify a PR I already sent in for making it possible to run ordered integration tests.

Essentially I will in that make sure that integration tests are always run last.

And in appveyor.yml we will either

  • need to save the SQLPS module to a temporary location, so it can be copied back to the correct location by the first integration test
  • or download the SqlServer module in the integration test.

I opt for the last. Or even better, both (but I don't think we go so far now). I think we start with copying SQLPS module back because that is probably what most users still will use. Opened an issue #778 so we get support for SqlServer PowerShell module too.

johlju added a commit to johlju/SqlServerDsc that referenced this issue Aug 19, 2017
- Changes to xSQLServer
  - Updated appveyor.yml so that integration tests can run in AppVeyor (issue dsccommunity#774).
- Changes to xSQLServerSetup
  - Fixed so that the integration test copies back the SQLPS module (issue dsccommunity#774).
johlju added a commit to johlju/SqlServerDsc that referenced this issue Sep 8, 2017
- Changes to xSQLServer
  - Updated appveyor.yml so that integration tests can run in AppVeyor (issue dsccommunity#774).
- Changes to xSQLServerSetup
  - Fixed so that the integration test copies back the SQLPS module (issue dsccommunity#774).
johlju added a commit that referenced this issue Sep 12, 2017
- Changes to xSQLServer
  - Updated appveyor.yml so that integration tests run in order and so that
    the SQLPS module folders are renamed to not disturb the units test, but
    can be renamed back by the integration tests xSQLServerSetup so that the
    integration tests can run successfully.
    (issue #774).
- Changes to xSQLServerHelper
  - Changes to Connect-SQL and Import-SQLPSModule
    - Now it correctly loads the correct assemblies when SqlServer module is
      present (issue #649).
    - Now SQLPS module will be correctly loaded (discovered) after installation
      of SQL Server. Previously resources depending on SQLPS module could fail
      because SQLPS was not found after installation because the PSModulePath
      environment variable in the (LCM) PowerShell session did not contain the new
      module path.
- Changes to xSQLServerSetup
  - Fixed so that the integration test renames back the SQLPS module folders if
    they was renamed by AppVeyor (in the appveyor.yml file).
    (issue #774).
  - Fixed so integration test does not write warnings when SQLPS module is loaded
    (issue #798).
@johlju johlju removed their assignment Oct 27, 2017
@johlju johlju removed the in progress The issue is being actively worked on by someone. label Oct 27, 2017
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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant