Skip to content

Conversation

@daxian-dbw
Copy link
Member

@daxian-dbw daxian-dbw commented Aug 1, 2018

PR Summary

  • Add the file test/tools/TestMetadata.json for declaring tests for experimental features.
    • Key is the experimental feature name;
    • Value is an array of paths for the folder or files that Pester should run when the feature is turned on. If the value is an empty array, then all tests will be executed for the feature.
  • Add -ExperimentalFeatureName to Start-PSPester to support running tests with the specified feature turned on.
  • Update AppVeyor.psm1 and travis.ps1 to read TestMetadata.json and run tests for each declared features.

PR Checklist

@daxian-dbw
Copy link
Member Author

@TravisEz13 @adityapatwardhan @anmenaga Can you please review this update to our CI scripts?

if ($Environment.IsWindows) {
$content = @"
{
"Microsoft.PowerShell:ExecutionPolicy":"RemoteSigned",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to have a comment here about why there is 'RemoteSigned' difference between Windows/Non-Windows code paths.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add a comment.

if ($Unelevate)
{
Start-UnelevatedProcess -process $powershell -arguments @('-noprofile', '-c', $Command)
Start-UnelevatedProcess -process $powershell -arguments ($PSFlags + "-c $Command")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking about a scenario where I manually run Start-PSPester on my machine...
(in default configuration) Start-PSPester will automatically pick up all Pester tests under $Path, including those for Experimental features, which will fail because I didn't specify $ExperimentalFeatureName parameter?

Or the assumption is that ExperimentalFeature tests will do a runtime check and skip themselves if their corresponding ExperimentalFeature is not enabled?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or the assumption is that ExperimentalFeature tests will do a runtime check and skip themselves if their corresponding ExperimentalFeature is not enabled?

Yes, tests for an experimental feature should have runtime checks to determine whether the tests should be skipped. See here as an example: https://github.com/PowerShell/PowerShell/blob/master/test/powershell/engine/ExperimentalFeature/ExperimentalFeature.Basic.Tests.ps1

@anmenaga
Copy link

anmenaga commented Aug 2, 2018

To ensure that this change to test infra works as expected it would be good to actually have an experimental feature with corresponding tests checked in as part of this. Having a dummy experimental feature in the product for the sake of testing is probably not worth it. Do we have a candidate for an actually useful experimental feature?

@daxian-dbw
Copy link
Member Author

@anmenaga There are tests for a dummy experimental feature -- they are part of my initial check-in for the experimental feature work. They are in this folder https://github.com/PowerShell/PowerShell/tree/master/test/powershell/engine/ExperimentalFeature
Also, please see TestMetadata.json in this change, I declared the dummy experimental feature and the testes to run for it. This CI update will enable to run those tests in CI.

if ($Unelevate)
{
Start-UnelevatedProcess -process $powershell -arguments @('-noprofile', '-c', $Command)
Start-UnelevatedProcess -process $powershell -arguments ($PSFlags + "-c $Command")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Earlier it was '-c', $command now it is -c $command. Intentional change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's an intentional change. If you look at Start-UnelevatedProcess, you will see the arguments parameter is used like this: "$process $arguments". $argument is a string array, so the elements will be joined together with a space character as the delimiter.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closed.

@daxian-dbw
Copy link
Member Author

@anmenaga and @adityapatwardhan Your comments have been addressed. Please take another look when you can. Thanks!

@daxian-dbw daxian-dbw merged commit 25c127c into PowerShell:master Aug 3, 2018
@daxian-dbw daxian-dbw deleted the ci branch August 3, 2018 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants