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

When running integration tests with xunit on netcoreapp ScriptLocation returns an invalid path #340

Closed
DavidBoike opened this issue Feb 28, 2019 · 2 comments

Comments

@DavidBoike
Copy link
Member

commented Feb 28, 2019

Replaces #312

which means scripts dont get executed

file:///C:/Users/simon/.nuget/packages/microsoft.testplatform.testhost/15.0.0/lib/netstandard1.5/testhost.dll

image

seems Assembly.GetEntryAssembly() returns the testhost location. which is invalid. While the AppDomain.CurrentDomain.BaseDirectory is correct but is doesnt get inside the if

workaround: run them manually


    static Task RunSqlScripts(string endpointName, Func<DbConnection> connectionBuilder)
    {
        var baseDir = AppDomain.CurrentDomain.BaseDirectory;
        var scriptDir = Path.Combine(baseDir, "NServiceBus.Persistence.Sql", "MsSqlServer");

        return ScriptRunner.Install(
                sqlDialect: new SqlDialect.MsSqlServer(),
                tablePrefix: endpointName+"_",
                connectionBuilder: connectionBuilder,
                scriptDirectory: scriptDir,
                shouldInstallOutbox: false,
                shouldInstallSagas: true,
                shouldInstallSubscriptions: false,
                shouldInstallTimeouts: false);
    }
@mikesigs

This comment has been minimized.

Copy link

commented Jul 22, 2019

I tried the work-around above, but it doesn't really resolve my issue. It does in fact run through the scripts, but it still fails later in the test.

Our integration test is starting the endpoint, without any test-specific modifications to the EndpointConfiguration. Our endpoint is configured with .EnableInstallers(). So when it hits the RunInstallers step during startup it tries to run the SQL scripts. It fails with a very similar error message to this Issue:

Expected 'C:\Users\mikes\.nuget\packages\microsoft.testplatform.testhost\15.9.0\lib\netstandard1.5\NServiceBus.Persistence.Sql\MsSqlServer\Outbox_Create.sql' to exist. It is possible it was not deployed with the endpoint.

I'll keep digging through this on my own, but was hoping there might be some progress on permanent fix for this issue.

Thanks!

@DavidBoike

This comment has been minimized.

Copy link
Member Author

commented Jul 23, 2019

@mikesigs we're getting ready to release the fix to this. Stay tuned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.