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

AppVeyor.UploadTestResults failing silently #1097

Closed
gjstockham opened this issue Jul 22, 2016 · 6 comments
Closed

AppVeyor.UploadTestResults failing silently #1097

gjstockham opened this issue Jul 22, 2016 · 6 comments
Labels
Milestone

Comments

@gjstockham
Copy link

gjstockham commented Jul 22, 2016

What You Are Seeing?

When uploading test results using the AppVeyor.UploadTestResults method, no test results appear in the appveyor build, but there is no error produced.

After some debugging, it appears the appveyor api is returning 415 Unsupported Media Type

What is Expected?

The tests should upload correctly, or some sort of error should be produced

What version of Cake are you using?

0.14.0.0

Are you running on a 32 or 64 bit system?

x64

What environment are you running on? Windows? Linux? Mac?

Windows

Are you running on a CI Server? If so, which one?

AppVeyor

How Did You Get This To Happen? (Steps to Reproduce)

Cake build with NUnit tests, then upload to AppVeyor

Task("Run-Tests")
    .IsDependentOn("Build")
    .Does(() =>
{  
    NUnit(testAssemblies);

    if(AppVeyor.IsRunningOnAppVeyor)
    {
        AppVeyor.UploadTestResults(testOutput, AppVeyorTestResultsType.NUnit);
    }
});

Output Log

There is no output produced on failure

Possible Resolution

The appveyor example for this uses powershell: https://www.appveyor.com/docs/running-tests#uploading-xml-test-results

I have tried adding content-type, changing to multipart content upload and a few other changes, but nothing worked.

However, the powershell example uses System.Net.WebClient rather than System.Net.Http.HttpClient. Changing to this worked for me. I can submit a pull request with this change, but wondered if there were any other factors that I hadn't considered?

@ChrisMaddock
Copy link
Contributor

In addition to the fix, would it be possible to report the error here?

I've hit a 'silent failure' here also - at the time I had bigger problems so didn't investigate further. Would be great if the failure could be logged though!

@gep13 gep13 modified the milestone: v0.15.0 Jul 24, 2016
@gep13 gep13 added the Bug label Jul 24, 2016
@gep13
Copy link
Member

gep13 commented Jul 25, 2016

@ChrisMaddock said...
In addition to the fix, would it be possible to report the error here?
I've hit a 'silent failure' here also - at the time I had bigger problems so didn't investigate further. Would be great if the failure could be logged though!

I think we need to tackle this as a separate issue.

@gep13
Copy link
Member

gep13 commented Jul 25, 2016

@ChrisMaddock new issue created here: #1112

@ChrisMaddock
Copy link
Contributor

Thanks @gep13 :-)

Appveyor.exe doesn't appear to be used for uploading test results however - these just go through a web request, which I thought might be easier to handle. Is this still covered by #1112?

Thanks for spotting it when closing the issue, regardless!

@gep13
Copy link
Member

gep13 commented Jul 25, 2016

Hmmm, yes and no, I think your particular requirement is already going to be met. This was added:

https://github.com/cake-build/cake/pull/1099/files#diff-5ea055597d8263244198033de799294dR82

Which as documented here:

https://msdn.microsoft.com/en-us/library/system.net.http.httpresponsemessage.ensuresuccessstatuscode(v=vs.118).aspx

Will throw an exception, if not a successful operation. The other AppVeyor methods will get similar treatment as a result of #1112

@ChrisMaddock
Copy link
Contributor

Aha - great! Don't think that was in the first version of the PR I looked at. Thanks @gep13, and @Philo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants