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

Presence of a TEAMCITY_PROJECT_NAME environment variable makes builds fail if TeamCity service unavailable #1570

Open
stinos opened this issue Dec 28, 2024 · 2 comments
Labels
Investigate We are looking into the issue

Comments

@stinos
Copy link

stinos commented Dec 28, 2024

With release 3.19.0 in, this commit leads to TeamCity CI builds failing for us with Option --teamcity specified but the extension is not installed. even though we do not specify this option and we do not use any of TeamCity's nunit-related features: we just happen to use nunit3-console to run tests.

  • The full command line being used: nunit3-console --noheader --noresult /path/to/tests.dll
  • Method of installation (e.g. NuGet, zip, msi): NuGet, but not relevant
  • Version of the NUnit Engine/Console: 3.19.0

Can be reproduced easily by setting a non-empty TEAMCITY_PROJECT_NAME environment variable.

So:

  • the error message says --teamcity is specified even though that is not the case, which is a bit confusing
  • the Options code treats the presence of a TEAMCITY_PROJECT_NAME environment variable as running under TeamCity. While correct, it also treats that as 'must use TeamCity extension', but that is for us not the case

I'd suggest that either the behavior is reverted, or modified to show a warning instead of an error (perhaps with a modified message stating 'TeamCity detected' or similar), or else made such that the user needs to explicitly request the TeamCity functionality (so by passing --teamcity or by another environment variable).

@CharliePoole
Copy link
Member

To explain why it works this way, I'll have to go back in time, to 2015. :-)

That's when @NikolayPianikov, a contributor for JetBrains, added the notion of a DefaultOptionsProvider class, implementing IDefaultOptionsProvider. This class does what it says. It specifies default option values for the console runner, over-riding any internal defaults.

The class was used, in this case, to make the TeamCity option appear to be true, just as if you had entered the --teamcity option. JetBrains wanted this so that users would not need to specify the option on the command-line.

We'd like to keep this working for JetBrains users, so that limits what can be done for this issue without a bit of coordination. Before we go further, can you explain your use case? Why do you want to run under TeamCity, but not use the TeamCity extension. I have limited contact with the JetBrains folks, but my understanding from back then was that their display of results would be broken if the teamcity extension were not intalled.

Depending on how this discussion turns out, I'll either make a simple change to the wording of the message or I'll queue up a task to revise how we handle options in general. Currently, the runner simply gets settings, without knowing whether they came from the command-line or elsewhere.

@CharliePoole CharliePoole added the Investigate We are looking into the issue label Dec 28, 2024
@stinos
Copy link
Author

stinos commented Dec 29, 2024

We'd like to keep this working for JetBrains users, so that limits what can be done for this issue without a bit of coordination.

Sure, I kind of expected that.

Before we go further, can you explain your use case? Why do you want to run under TeamCity, but not use the TeamCity extension

We have a project which is a mix of C++/C#/Matlab/Python/Installshield/.. and want our build/test/deploy to be a one-click kind of thing which can easily run anywhere. As such there's a single msbuild target which does everything, and that happens to include running nunit3-console just like it runs the other non-.Net tests via commandline commands. So CI builds are no different and also run that single msbuild command and we don't use any test integrations. Makes things easier to setup and maintain and avoids some of the 'does(n't) work on CI but does(n't) work locally' type of issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Investigate We are looking into the issue
Projects
None yet
Development

No branches or pull requests

2 participants