QualiSystems / FluentTc

:ocean: :two_men_holding_hands: :office: Integrate with TeamCity fluently
https://www.nuget.org/packages/fluenttc
Apache License 2.0
44 stars 35 forks source link

Cancelled and NotCancelled are spelt incorrect in BuildHavingBuilder #89

Closed phermens-coolblue closed 7 years ago

phermens-coolblue commented 7 years ago

Bug

The results produced by the BuildHavingBuilder when asking for a Cancelled or NotCancelled build return an error from TeamCity:

Unhandled Exception: EasyHttp.Infrastructure.HttpException: BadRequest Error: Bad Request
HTTP: BadRequest
URL: https://REDACTED/httpAuth/app/rest/builds?locator=cancelled:False,count:1,&fields=count,build(buildTypeId,href,id,number,state,status,webUrl)
Error has occurred during request processing (Bad Request).
Error: jetbrains.buildServer.server.rest.errors.LocatorProcessException: Locator dimension [cancelled] is unknown. Supported dimensions are: [id, taskId, project, affectedProject, buildType, branch, agent, user, personal, state, tag, property, compatibleAgent, number, status, canceled, pinned, sinceBuild, sinceDate, untilBuild, untilDate, failedToStart, snapshotDependency, defaultFilter, lookupLimit, single value, start, count]
Invalid request. Check locator is specified correctly.
   at FluentTc.Engine.TeamCityCaller.ThrowIfHttpError(HttpResponse response, String url)
   at FluentTc.Engine.TeamCityCaller.GetResponseByFullUrl(String url)
   at FluentTc.Engine.TeamCityCaller.Get[T](String urlPart)
   at FluentTc.Engine.BuildsRetriever.GetBuilds(Action`1 having, Action`1 count, Action`1 include)
   at FluentTc.ConnectedTc.GetLastBuild(Action`1 having, Action`1 include)

The core of it is this:

Error: jetbrains.buildServer.server.rest.errors.LocatorProcessException: Locator dimension [cancelled] is unknown. Supported dimensions are: [id, taskId, project, affectedProject, buildType, branch, agent, user, personal, state, tag, property, compatibleAgent, number, status, canceled, pinned, sinceBuild, sinceDate, untilBuild, untilDate, failedToStart, snapshotDependency, defaultFilter, lookupLimit, single value, start, count]

Test to reproduce

        [Test]
        public void Cancelled()
        {
            // Arrange
            var fixture = Auto.Fixture();
            var buildHavingBuilder = fixture.Create<BuildHavingBuilder>();

            // Act
            buildHavingBuilder.Cancelled();

            // Assert
            buildHavingBuilder.GetLocator().Should().Be("canceled:True");
        }

Affected versions

Product Version
FluentTc latest (0.0.0.213)
TeamCity Enterprise 9.1.6 (build 37459)
Autofac 3.5.0
EasyHttp 1.6.85
SharpZipLib 0.86.0
System.IO.Abstractions 2.0.0.124
TeamCity.ServiceMessages 3.0.5.1
phermens-coolblue commented 7 years ago

The easiest reproduction of this can be narrowed down to two (fluent) lines:

var teamCity = new RemoteTc().Connect(tc => tc.ToHost(YOUR_HOST).UseSsl().AsUser(YOUR_USER, YOUR_PASS));
var result = teamCity.GetLastBuild(build => build.NotCancelled());