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

RunTestInOrder non-working all of the sudden #191

Closed
johlju opened this issue Sep 1, 2017 · 0 comments
Closed

RunTestInOrder non-working all of the sudden #191

johlju opened this issue Sep 1, 2017 · 0 comments

Comments

@johlju
Copy link
Contributor

johlju commented Sep 1, 2017

For some reason the class Microsoft.DscResourceKit.IntegrationTest cannot be loaded when dot-sourcing the configuration files. This did work when the PR was tested. But those tests that worked before, does no longer work either. This is really strange 🤔
Maybe it was just luck that it worked before, or if I did a mistake in the testing. I don't know. Either way it is broken. :)

The error:
https://ci.appveyor.com/project/johlju/xsqlserver/build/6.0.927.0#L5627

Something strange has happened, because it can no longer see the sealed class. It seems that making this a public class it starts to find it. But then it reports it does not have a constructor with zero arguments. But we are passing in one argument.

PS > . .\MSFT_xSQLServerSetup.config.ps1
Cannot find an overload for ".ctor" and the argument count: "0".
At V:\Source\xSqlServer\Tests\Integration\MSFT_xSQLServerSetup.config.ps1:2 char:1
+ [Microsoft.DscResourceKit.IntegrationTest(OrderNumber = 1)]
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

Adding a constructor with zero arguments gives this error

PS > . .\MSFT_xSQLServerSetup.config.ps1
'OrderNumber' is a ReadOnly property.
At V:\Source\xSqlServer\Tests\Integration\MSFT_xSQLServerSetup.config.ps1:2 char:1
+ [Microsoft.DscResourceKit.IntegrationTest(OrderNumber = 1)]
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyIsReadOnly

Finally adding a new named property, instead of using a positional seems to work.

namespace Microsoft.DscResourceKit
{
    // See the attribute guidelines at http://go.microsoft.com/fwlink/?LinkId=85236
    [System.AttributeUsage(System.AttributeTargets.All, Inherited = false, AllowMultiple = true)]
    public sealed class IntegrationTest : System.Attribute
    {
        public IntegrationTest() {}

        public int OrderNumber { get; set; }
    }
}

I really need for this to work, so I will refactor the class to this, if it passes the tests, I will send in a PR to change to this.

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

1 participant