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

Coveralls integration stopped working around 2018-09-20 #175

Closed
maxbennedich opened this issue Sep 26, 2018 · 10 comments · Fixed by #179
Closed

Coveralls integration stopped working around 2018-09-20 #175

maxbennedich opened this issue Sep 26, 2018 · 10 comments · Fixed by #179

Comments

@maxbennedich
Copy link

This seems to be a global issue, I've checked several packages, and they all started failing around Sept 20. This is what happens during submission of coverage:

Submitting data to Coveralls...
┌ Warning: Error in @async writebody task
│   exception =
│    MethodError: no method matching write(::HTTP.Streams.Stream{HTTP.Messages.Response,HTTP.ConnectionPool.Transaction{MbedTLS.SSLContext}}, ::Pair{String,HTTP.Multipart{Base.GenericIOBuffer{Array{UInt8,1}}}})
...
 [21] #submit#1(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Array{FileCoverage,1}) at /home/travis/.julia/packages/Coverage/25tif/src/coveralls.jl:91
 [22] submit(::Array{FileCoverage,1}) at /home/travis/.julia/packages/Coverage/25tif/src/coveralls.jl:60

See example of full stack trace in this build.

Codecov still works.

@vchuravy
Copy link
Member

vchuravy commented Oct 1, 2018

x-ref: JuliaWeb/HTTP.jl#245 (comment)

@samoconnor
Copy link

Passing a HTTP.Form as the body and setting the Content-Type should do the trick:

using HTTP
using JSON

makebody(data::Dict) =
    HTTP.Form(
    Dict("json_file" => HTTP.Multipart("json_file", IOBuffer(JSON.json(data)),
                                       "application/json")))

url = "https://coveralls.io/api/v1/jobs"

data = Dict("service_job_id"    => "APPVEYOR_JOB_ID",
            "service_name"      => "appveyor",
            "source_files"      => "xyz",
            "repo_token"        => "REPO_TOKEN")

body = makebody(data)
headers = ["Content-Type" => "multipart/form-data; boundary=$(body.boundary)"]

req = HTTP.post(url, headers, body, verbose=3)
DEBUG: 2018-10-02T08:04:05.335 6516 ➡️  "POST /api/v1/jobs HTTP/1.1\r\n" (write)
DEBUG: 2018-10-02T08:04:05.361 6516 ➡️  "Content-Type: multipart/form-data; boundary=7ca059ffd29b644fb400a866be6b2ed8\r\n" (write)
DEBUG: 2018-10-02T08:04:05.361 6516 ➡️  "Host: coveralls.io\r\n" (write)
DEBUG: 2018-10-02T08:04:05.362 6516 ➡️  "Content-Length: 291\r\n" (write)
DEBUG: 2018-10-02T08:04:05.362 6516 ➡️  "\r\n" (write)
DEBUG: 2018-10-02T08:04:05.666 ecee ➡️  "--7ca059ffd29b644fb400a866be6b2ed8\r\n" (unsafe_write)
DEBUG:                                 "Content-Disposition: form-data; name=\"json_file\"; filename=\"json_file\"\r\n"
DEBUG:                                 "Content-Type: application/json\r\n"
DEBUG:                                 "\r\n"
DEBUG:                                 "{\"repo_token\":\"REPO_TOKEN\",\"service_name\":\"appveyor\",\"service_job_id\":\"APPVEYOR_JOB_ID\",\"source_files\":\"xyz\"}\r\n"
DEBUG:                                 "--7ca059ffd29b644fb400a866be6b2ed8--\r\n"

@samoconnor
Copy link

Note: this works because HTTP.Form is a readable IO. So the generic HTTP.request support for sending a body from an IO is used.

@samoconnor
Copy link

I think the best thing to do is add something like this to HTTP.jl:

content_type(f::Form) = "Content-Type" =>
                        "multipart/form-data; boundary=$(f.boundary)"

post(url, f::Form; kw...) = post(url, Header[], f; kw...)

function post(url, headers, f::Form; kw...)
    setheader(headers, content_type(f))
    request("POST", url, headers, f; kw...)
end

Then client code will be able to do:

req = HTTP.post(url, HTTP.Form(data))

@samoconnor
Copy link

See JuliaWeb/HTTP.jl@01a2cff

@ronisbr
Copy link

ronisbr commented Oct 16, 2018

Hi guys! Is there any workaround for this bug ?

fingolfin added a commit to fingolfin/Coverage.jl that referenced this issue Oct 22, 2018
fingolfin added a commit to fingolfin/Coverage.jl that referenced this issue Oct 23, 2018
fingolfin added a commit to fingolfin/Coverage.jl that referenced this issue Oct 23, 2018
fingolfin added a commit to fingolfin/Coverage.jl that referenced this issue Oct 23, 2018
fingolfin added a commit to fingolfin/Coverage.jl that referenced this issue Oct 23, 2018
fingolfin added a commit to fingolfin/Coverage.jl that referenced this issue Oct 23, 2018
fingolfin added a commit to fingolfin/Coverage.jl that referenced this issue Oct 23, 2018
@fingolfin
Copy link
Member

This is fixed by PR #179

@cdsousa
Copy link

cdsousa commented Oct 25, 2018

This seems not be corrected yet, at least for DataFrames.jl, see https://travis-ci.org/JuliaData/DataFrames.jl/jobs/443235134 line 1000.

@fingolfin
Copy link
Member

It should be corrected in 0.6.1, but the Travis job you linked still is using 0.6.0. I don't know what has to be done to fix that; see also issue #181. I hope @ararslan can help.

@ararslan
Copy link
Member

Once the next version of Coverage is merged into METADATA we should be good.

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

Successfully merging a pull request may close this issue.

7 participants