Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion common/lib/dependabot/clients/azure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,9 @@ def truncate_pr_description(pr_description)
truncate_length = MAX_PR_DESCRIPTION_LENGTH - truncated_msg.length
pr_description = (pr_description[0..truncate_length] + truncated_msg)
end
pr_description.force_encoding(Encoding::UTF_8)
# Using pr_description.force_encoding(Encoding::UTF_8) doesn't always work.
# https://stackoverflow.com/a/10466273
pr_description.encode("utf-8", "binary", invalid: :replace, undef: :replace)
end

def tags_creation_forbidden?(response)
Expand Down
19 changes: 18 additions & 1 deletion common/spec/dependabot/pull_request_creator/azure_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
end
end

context "with e very long pr description" do
context "with a very long pr description" do
let(:pr_description) { ("a" * 3997) + "💣 kaboom" }
it "truncates the description respecting azures encoding" do
creator.create
Expand All @@ -185,6 +185,23 @@
end
end

context "with another very long pr description" do
let(:pr_description) { JSON.parse(fixture("azure", "long_pr_description.json"))["message"] }
it "truncates the description respecting azures encoding" do
creator.create

expect(WebMock).
to(
have_requested(:post, "#{repo_api_url}/pullrequests?api-version=5.0").
with do |req|
description = JSON.parse(req.body).fetch("description")
expect(description.length).to eq 4000
expect(description).to end_with("\n\n_Description has been truncated_")
end
)
end
end

context "with author details provided" do
let(:author_details) do
{ email: "support@dependabot.com", name: "dependabot" }
Expand Down
3 changes: 3 additions & 0 deletions common/spec/fixtures/azure/long_pr_description.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"message":"Bumps [Grpc.AspNetCore.Server.Reflection](https://github.com/grpc/grpc-dotnet) from 2.51.0 to 2.52.0.\n\\#Release notes\n\n*Sourced from [Grpc.AspNetCore.Server.Reflection's releases](https://github.com/grpc/grpc-dotnet/releases).*\n\n> ## Release v2.52.0\n> \n> ## What's Changed\n> \n> - Update version to 2.52.0 (on v2.52.x branch) by [`@​jtattermusch`](https://github.com/jtattermusch) in\n> [grpc/grpc-dotnet\\#2072](https://redirect.github.com/grpc/grpc-dotnet/pull/2072)\n> \n> **Full Changelog**: <https://github.com/grpc/grpc-dotnet/compare/v2.52.0-pre1...v2.52.0>\n> \n> ## Release v2.52.0-pre1\n> \n> ## What's Changed\n> \n> - Update dotnet-grpc tool to require .NET 6 by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#1932](https://redirect.github.com/grpc/grpc-dotnet/pull/1932)\n> - Add logging to resolve to indicate resolve is complete by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#1978](https://redirect.github.com/grpc/grpc-dotnet/pull/1978)\n> - Bump decode-uri-component from 0.2.0 to 0.2.2 in /examples/Spar/Server/ClientApp by\n> [`@​dependabot`](https://github.com/dependabot) in\n> [grpc/grpc-dotnet\\#1977](https://redirect.github.com/grpc/grpc-dotnet/pull/1977)\n> - Bump decode-uri-component from 0.2.0 to 0.2.2 in /examples/Browser/Server/wwwroot by\n> [`@​dependabot`](https://github.com/dependabot) in\n> [grpc/grpc-dotnet\\#1976](https://redirect.github.com/grpc/grpc-dotnet/pull/1976)\n> - Make ChannelCredentials.Create work with allowing insecure credentials by\n> [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#1802](https://redirect.github.com/grpc/grpc-dotnet/pull/1802)\n> - Skip active connections when proxy is configured by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#1863](https://redirect.github.com/grpc/grpc-dotnet/pull/1863)\n> - Cancel pending state change watchers on dispose by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#1986](https://redirect.github.com/grpc/grpc-dotnet/pull/1986)\n> - Update MAINTAINERS.md by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#1979](https://redirect.github.com/grpc/grpc-dotnet/pull/1979)\n> - RpcException API improvements by [`@​jtattermusch`](https://github.com/jtattermusch) in\n> [grpc/grpc-dotnet\\#1992](https://redirect.github.com/grpc/grpc-dotnet/pull/1992)\n> - Support writing to response stream with gRPC-Web middleware by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#1993](https://redirect.github.com/grpc/grpc-dotnet/pull/1993)\n> - Additional dependency version cleanup (after moving some nuget packages to from grpc to grpc-dotnet) by\n> [`@​jtattermusch`](https://github.com/jtattermusch) in\n> [grpc/grpc-dotnet\\#1786](https://redirect.github.com/grpc/grpc-dotnet/pull/1786)\n> - Bump json5, webpack and webpack-cli in /examples/Browser/Server/wwwroot by\n> [`@​dependabot`](https://github.com/dependabot) in\n> [grpc/grpc-dotnet\\#2003](https://redirect.github.com/grpc/grpc-dotnet/pull/2003)\n> - Bump json5 from 2.2.0 to 2.2.3 in /testassets/InteropTestsGrpcWebWebsite/Tests by\n> [`@​dependabot`](https://github.com/dependabot) in\n> [grpc/grpc-dotnet\\#2005](https://redirect.github.com/grpc/grpc-dotnet/pull/2005)\n> - Bump json5 from 1.0.1 to 1.0.2 in /examples/Spar/Server/ClientApp by\n> [`@​dependabot`](https://github.com/dependabot) in\n> [grpc/grpc-dotnet\\#2007](https://redirect.github.com/grpc/grpc-dotnet/pull/2007)\n> - Add client factory to client linker test app by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#1972](https://redirect.github.com/grpc/grpc-dotnet/pull/1972)\n> - Fix reconnecting after connection timeout by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#1998](https://redirect.github.com/grpc/grpc-dotnet/pull/1998)\n> - Support running health checks in Check method by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#1987](https://redirect.github.com/grpc/grpc-dotnet/pull/1987)\n> - Add host override to resolvers by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#2002](https://redirect.github.com/grpc/grpc-dotnet/pull/2002)\n> - Set WaitForDataBeforeAllocatingBuffer to false in benchmark app by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#2012](https://redirect.github.com/grpc/grpc-dotnet/pull/2012)\n> - Support zero-byte read in gRPC client by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#1985](https://redirect.github.com/grpc/grpc-dotnet/pull/1985)\n> - Fix wrong namespace by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#2015](https://redirect.github.com/grpc/grpc-dotnet/pull/2015)\n> - Update microsoft-support.md by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#2009](https://redirect.github.com/grpc/grpc-dotnet/pull/2009)\n> - Don't warn about Android native handler with grpc-web by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#2020](https://redirect.github.com/grpc/grpc-dotnet/pull/2020)\n> - Report user canceled cancellation token by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#2018](https://redirect.github.com/grpc/grpc-dotnet/pull/2018)\n> - Trimming issue workaround in .NET 8 by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#2022](https://redirect.github.com/grpc/grpc-dotnet/pull/2022)\n> - Fix reporting RpcException from server streaming error by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#2034](https://redirect.github.com/grpc/grpc-dotnet/pull/2034)\n> - Fix gRPC perf client counter by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#2035](https://redirect.github.com/grpc/grpc-dotnet/pull/2035)\n> - Mention Metadata.BinaryHeaderSuffix in xmldoc comments of Metadata.En… by\n> [`@​voroninp`](https://github.com/voroninp) in\n> [grpc/grpc-dotnet\\#2027](https://redirect.github.com/grpc/grpc-dotnet/pull/2027)\n> - Add test that uses localization by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#2039](https://redirect.github.com/grpc/grpc-dotnet/pull/2039)\n> - Bump `@​sideway/formula` from 3.0.0 to 3.0.1 in /testassets/InteropTestsGrpcWebWebsite/Tests by\n> [`@​dependabot`](https://github.com/dependabot) in\n> [grpc/grpc-dotnet\\#2045](https://redirect.github.com/grpc/grpc-dotnet/pull/2045)\n> - Add additional connection and request logging to client by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#2047](https://redirect.github.com/grpc/grpc-dotnet/pull/2047)\n> - Update Google.Protobuf version by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#2051](https://redirect.github.com/grpc/grpc-dotnet/pull/2051)\n> - Wrap EventSource calls with IsEnabled by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#2052](https://redirect.github.com/grpc/grpc-dotnet/pull/2052)\n> - Add .editorconfig and fix warnings by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#2055](https://redirect.github.com/grpc/grpc-dotnet/pull/2055)\n> - Refactor gRPC content-type constraint to be inline by [`@​JamesNK`](https://github.com/JamesNK) in\n> [grpc/grpc-dotnet\\#2065](https://redirect.github.com/grpc/grpc-dotnet/pull/2065)\n> - Update version to 2.52.0-dev on master by [`@​jtattermusch`](https://github.com/jtattermusch) in\n> [grpc/grpc-dotnet\\#2063](https://redirect.github.com/grpc/grpc-dotnet/pull/2063)\n> - Upgrade version to 2.52.0-pre1 (on v2.52.x branch) by [`@​jtattermusch`](https://github.com/jtattermusch) in\n> [grpc/grpc-dotnet\\#2066](https://redirect.github.com/grpc/grpc-dotnet/pull/2066)\n> \n> ## New Contributors\n> \n> - [`@​voroninp`](https://github.com/voroninp) made their first contribution in\n> [grpc/grpc-dotnet\\#2027](https://redirect.github.com/grpc/grpc-dotnet/pull/2027)\n> \n> </tr></table> \n\n... (truncated)\n\n\\#Commits\n\n - [`4200800`](https://github.com/grpc/grpc-dotnet/commit/42008008599fd671c1175bdaddf165fbac23d357) Update version\n to 2.52.0 (on v2.52.x branch) ([\\#2072](https://redirect.github.com/grpc/grpc-dotnet/issues/2072))\n - [`347dfea`](https://github.com/grpc/grpc-dotnet/commit/347dfead5735d5bc0d54e33409d5426fbdf2042c) Upgrade version\n to 2.52.0-pre1 (on v2.52.x branch) ([\\#2066](https://redirect.github.com/grpc/grpc-dotnet/issues/2066))\n - [`23cd81f`](https://github.com/grpc/grpc-dotnet/commit/23cd81fbdbf6c6f5db538bcfbb46cd7c453132f1) Update version\n to 2.52.0-dev on master ([\\#2063](https://redirect.github.com/grpc/grpc-dotnet/issues/2063))\n - [`cfb839b`](https://github.com/grpc/grpc-dotnet/commit/cfb839bd7c75de6ebde704b0ac8ea7c66661be69) Refactor gRPC\n content-type constraint to be inline ([\\#2065](https://redirect.github.com/grpc/grpc-dotnet/issues/2065))\n - [`c2274eb`](https://github.com/grpc/grpc-dotnet/commit/c2274eb07dcd179d9ebf13fd1215732bf216696d) Add .editorconfig\n and fix warnings ([\\#2055](https://redirect.github.com/grpc/grpc-dotnet/issues/2055))\n - [`a456d47`](https://github.com/grpc/grpc-dotnet/commit/a456d47405c462ccfa9e1480ad7f38759f2c2127) Wrap EventSource\n calls with IsEnabled ([\\#2052](https://redirect.github.com/grpc/grpc-dotnet/issues/2052))\n - [`8471823`](https://github.com/grpc/grpc-dotnet/commit/84718236a958fbfeb7d5a8ae743b3c78390f1310) Update\n Google.Protobuf version ([\\#2051](https://redirect.github.com/grpc/grpc-dotnet/issues/2051))\n - [`0b365bf`](https://github.com/grpc/grpc-dotnet/commit/0b365bf4633c9f05d0af374ed8607c046e8e74dd) Add additional\n connection and request logging to client\n ([\\#2047](https://redirect.github.com/grpc/grpc-dotnet/issues/2047))\n - [`0f9300c`](https://github.com/grpc/grpc-dotnet/commit/0f9300c43901ad82fdb4dfb7cf1d11b34d2cf077) Bump\n `@​sideway/formula` from 3.0.0 to 3.0.1 in /testassets/InteropTestsGrpcWebW...\n - [`ad54bc6`](https://github.com/grpc/grpc-dotnet/commit/ad54bc69ed73b601ecf3c1a53f2a07a035ccea3e) Add test that uses\n localization ([\\#2039](https://redirect.github.com/grpc/grpc-dotnet/issues/2039))\n - Additional commits viewable in [compare view](https://github.com/grpc/grpc-dotnet/compare/v2.51.0...v2.52.0)\n"
}