Skip to content

Enable classic mode in IIS tests#1462

Merged
kevingosse merged 4 commits into
masterfrom
kevin/classic_iis_1_26_2
May 21, 2021
Merged

Enable classic mode in IIS tests#1462
kevingosse merged 4 commits into
masterfrom
kevin/classic_iis_1_26_2

Conversation

@kevingosse

@kevingosse kevingosse commented May 12, 2021

Copy link
Copy Markdown
Contributor

Extend the test matrix to run the IIS test in classic and integrated modes. We can't configure that from the IIS Express command line, so I switched to a templated applicationHost.config file.

I tested first on 1.26.2 to confirm the tests were crashing: https://dev.azure.com/datadoghq/dd-trace-dotnet/_build/results?buildId=64259&view=results

@kevingosse kevingosse added the status:work-in-progress Actively worked on. If this is a PR, no review needed yet. WIP. label May 12, 2021
@kevingosse
kevingosse force-pushed the kevin/classic_iis_1_26_2 branch 2 times, most recently from 9e709fa to d449e4e Compare May 12, 2021 15:35
@kevingosse
kevingosse force-pushed the kevin/classic_iis_1_26_2 branch from 49bd1a6 to 7f37aea Compare May 12, 2021 16:44
@kevingosse kevingosse mentioned this pull request May 17, 2021
@kevingosse
kevingosse marked this pull request as ready for review May 18, 2021 12:15
@kevingosse
kevingosse requested a review from a team as a code owner May 18, 2021 12:15
lock (this)
{
if (_iisExpress == null)
if (_iisExpress.Process == null)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this allow the two sets of tests to run at the same time? I'd expect only one invocation of this to happen so only either an app pool in Integrated Mode is started or an app pool in Classic Mode is started

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The configuration file is copied to a temporary name, so it shouldn't cause any issue with multiple concurrent executions (at least, no more issues than it did before)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm just surprised that we can execute this multiple times. It looks like if I call TryStartIis(helper, false) followed by TryStartIis(helper, true) then we'd only start IIS Express once in Integrated Mode so we wouldn't be testing Classic Mode

@kevingosse kevingosse May 21, 2021

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah but we don't 😛 You have for example public class AspNetWebApi2WithFeatureFlagCallTargetIntegrated and public class AspNetWebApi2WithFeatureFlagCallTargetClassic. They're separate classes, so they don't share the instance of IisFixture

@andrewlock andrewlock May 21, 2021

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

EDIT: Kevin was too quick for me ☝️

The aspnet tests use an IClassFixture<>. That means the IISFixture is only reused for within-class tests (i.e. theories). As we change mode in different classes, this should work as far as I can tell.

That said, if possible (I'm not sure it is), it might be nice to add a check in the web application itself to assert it's running in the correct mode?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah thanks, my understanding of the class fixtures wasn't accurate. Thanks for clarifying!

@kevingosse kevingosse added area:tests unit tests, integration tests and removed status:work-in-progress Actively worked on. If this is a PR, no review needed yet. WIP. labels May 20, 2021

_iisFixture = iisFixture;
_iisFixture.TryStartIis(this);
_iisFixture.TryStartIis(this, classicMode: false);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We don't want to run this test in classic mode as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This test uses OWIN, so it crashes in classic mode :(

@kevingosse
kevingosse merged commit 0efe88c into master May 21, 2021
@kevingosse
kevingosse deleted the kevin/classic_iis_1_26_2 branch May 21, 2021 15:29
@andrewlock andrewlock added this to the 1.27.0 milestone Jun 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:tests unit tests, integration tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants