Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Integration tests that depend on other modules fail #168

Closed
johlju opened this issue Jul 24, 2017 · 5 comments
Closed

Integration tests that depend on other modules fail #168

johlju opened this issue Jul 24, 2017 · 5 comments

Comments

@johlju
Copy link
Contributor

johlju commented Jul 24, 2017

When building integration tests which depends on other resources in other modules, those fail because they don't exist on the build worker. I could download them prior to running the tests, but thinking if we could re-use the same logic that was introduced for examples in in PR #163.

For this integration test I want the test code to automatically install the dependent modules xStorage and PSDscResources.
xSQLServer Integration test: https://github.com/johlju/xSQLServer/blob/integration-test-xSQLServerSetup/Tests/Integration/MSFT_xSQLServerSetup.config.ps1

@PlagueHO
Copy link
Collaborator

We could move the code that optionally installs or warns the user to a new function so that it can be resused. Shouldn't be too difficult.

@johlju
Copy link
Contributor Author

johlju commented Jul 25, 2017

I will see if I can get this done

johlju added a commit to johlju/DscResource.Tests that referenced this issue Jul 25, 2017
Moved code from the example tests into a new helper function Install-DependentModule (issue PowerShell#168).
@johlju
Copy link
Contributor Author

johlju commented Jul 25, 2017

I have moved the code to a separate helper function (also found a bug with 'Version' that I fixed, see line 1213).

Looking how the Pester tests are run, my thought is to do the following.

  • Before calling Invoke-Pester. Loop thru all the *.config.ps1 files (Get-ChildItem -Path '*.config.ps1' -Recurse) and call Get-ResourceModulesInConfiguration and Install-DependentModule for each config file.

My thought is to add this before the evaluation of model type ('Default' or 'Harness'), before line 204. Let me know if there is any issues with that.

johlju added a commit to johlju/DscResource.Tests that referenced this issue Jul 25, 2017
Moved code from the example tests into a new helper function Install-DependentModule (issue PowerShell#168). Fixed bug with Version, where Install-Module would not use the correct variable for splatting.
johlju added a commit to johlju/DscResource.Tests that referenced this issue Jul 25, 2017
Code was moved from the example tests into a new helper function Install-DependentModule (issue PowerShell#168). Fixed bug with Version, where Install-Module would not use the correct variable for splatting.
johlju added a commit to johlju/DscResource.Tests that referenced this issue Jul 25, 2017
Enable so that missing required modules for integration tests is installed if running in AppVeyor or show warning if run by user (issue PowerShell#168).
johlju added a commit to johlju/DscResource.Tests that referenced this issue Jul 25, 2017
Enable so that missing required modules for integration tests is installed if running in AppVeyor or show warning if run by user (issue PowerShell#168).
johlju added a commit to johlju/DscResource.Tests that referenced this issue Jul 25, 2017
Enable so that missing required modules for integration tests is installed if running in AppVeyor or show warning if run by user (issue PowerShell#168).
johlju added a commit to johlju/DscResource.Tests that referenced this issue Jul 25, 2017
Enable so that missing required modules for integration tests is installed if running in AppVeyor or show warning if run by user (issue PowerShell#168).
@johlju
Copy link
Contributor Author

johlju commented Jul 25, 2017

Proposed a change in PR #172.

johlju added a commit to johlju/DscResource.Tests that referenced this issue Aug 8, 2017
Code was moved from the example tests into a new helper function Install-DependentModule (issue PowerShell#168). Fixed bug with Version, where Install-Module would not use the correct variable for splatting.
johlju added a commit to johlju/DscResource.Tests that referenced this issue Aug 8, 2017
Enable so that missing required modules for integration tests is installed if running in AppVeyor or show warning if run by user (issue PowerShell#168).
johlju added a commit to johlju/DscResource.Tests that referenced this issue Aug 8, 2017
Code was moved from the example tests into a new helper function Install-DependentModule (issue PowerShell#168). Fixed bug with Version, where Install-Module would not use the correct variable for splatting.
johlju added a commit to johlju/DscResource.Tests that referenced this issue Aug 8, 2017
Enable so that missing required modules for integration tests is installed if running in AppVeyor or show warning if run by user (issue PowerShell#168).
kwirkykat pushed a commit that referenced this issue Aug 10, 2017
* Changes to common tests
Code was moved from the example tests into a new helper function Install-DependentModule (issue #168). Fixed bug with Version, where Install-Module would not use the correct variable for splatting.

* Changes to integration tests
Enable so that missing required modules for integration tests is installed if running in AppVeyor or show warning if run by user (issue #168).

* Fix review comments at r1 for PR #172
@johlju
Copy link
Contributor Author

johlju commented Apr 23, 2018

This was solved in PR #172

@johlju johlju closed this as completed Apr 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants