Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public static GrpcChannel ForUnixSocket(string fileName)
throw;
}
}
}
},
MaxReceiveMessageSize = null,
});
}

Expand All @@ -56,7 +57,8 @@ public static GrpcChannel ForTcpSocket(string address)
HttpHandler = new SocketsHttpHandler
{
EnableMultipleHttp2Connections = true,
}
},
MaxReceiveMessageSize = null,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,28 @@ public void TestRandomResults([Values] LibType libType)
var request = Fixture.SpannerMock.Requests.OfType<ExecuteSqlRequest>().First();
Assert.That(request.Transaction?.SingleUse?.ReadOnly?.HasStrong ?? false);
}

[Test]
public void TestLargeStringValue([Values] LibType libType)
{
const string sql = "select large_value from my_table";
var value = TestUtils.GenerateRandomString(10_000_000);
Fixture.SpannerMock.AddOrUpdateStatementResult(sql, StatementResult.CreateSingleColumnResultSet(
new Spanner.V1.Type{Code = TypeCode.String}, "large_value", value));

using var pool = Pool.Create(SpannerLibDictionary[libType], ConnectionString);
using var connection = pool.CreateConnection();
using var rows = connection.Execute(new ExecuteSqlRequest { Sql = sql });
var numRows = 0;
while (rows.Next() is { } row)
{
numRows++;
Assert.That(row.Values.Count, Is.EqualTo(1));
Assert.That(row.Values[0].HasStringValue);
Assert.That(row.Values[0].StringValue, Is.EqualTo(value));
}
Assert.That(numRows, Is.EqualTo(1));
}

[Test]
public void TestStopHalfway([Values] LibType libType)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Google.Cloud.SpannerLib.Tests;

public static class TestUtils
{
private const string Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

public static string GenerateRandomString(int length)
{
return new string(Enumerable.Repeat(Chars, length)
.Select(s => s[Random.Shared.Next(s.Length)]).ToArray());
}
}
Loading