public async Task TestPostPointsAsync_Batch()
{
try
{
var client = new InfluxDBClient(influxUrl, dbUName, dbpwd);
var points = new List <IInfluxDatapoint>();
var today = DateTime.Now.ToShortDateString();
var now = DateTime.Now.ToShortTimeString();
var start = DateTime.Now.AddDays(-5);
var end = DateTime.Now;
for (int i = 0; i < 5000; i++)
{
var valMixed = new InfluxDatapoint <InfluxValueField>();
valMixed.UtcTimestamp = DataGen.RandomDate(start, end);
valMixed.Tags.Add("TestDate", today);
valMixed.Tags.Add("TestTime", now);
valMixed.UtcTimestamp = DateTime.UtcNow;
valMixed.Fields.Add("Doublefield", new InfluxValueField(DataGen.RandomDouble()));
valMixed.Fields.Add("Stringfield", new InfluxValueField(DataGen.RandomString()));
valMixed.Fields.Add("Boolfield", new InfluxValueField(DateTime.Now.Ticks % 2 == 0));
valMixed.Fields.Add("Int Field", new InfluxValueField(DataGen.RandomInt()));
valMixed.MeasurementName = measurementName;
valMixed.Precision = (TimePrecision)(DataGen.RandomInt() % 6) + 1;
points.Add(valMixed);
}
var r = await client.PostPointsAsync(dbName, points);
Assert.IsTrue(points.TrueForAll(p => p.Saved == true), "PostPointsAsync did not save all points");
}
catch (Exception e)
{
Assert.Fail($"Unexpected exception of type {e.GetType()} caught: {e.Message}");
return;
}
}