public async Task Recovery() { var bucketName = _bucket.Name; _writeApi = Client.GetWriteApi(); var listener = new WriteApiTest.EventListener(_writeApi); _writeApi.WriteRecord(bucketName, _organization.Id, WritePrecision.Ns, "h2o_feet,location=coyote_creek level\\ water_level=1.0 1x"); _writeApi.Flush(); var error = listener.Get <WriteErrorEvent>(); Assert.IsNotNull(error); Assert.AreEqual( "unable to parse 'h2o_feet,location=coyote_creek level\\ water_level=1.0 1x': bad timestamp", error.Exception.Message); _writeApi.WriteRecord(bucketName, _organization.Id, WritePrecision.Ns, "h2o_feet,location=coyote_creek level\\ water_level=1.0 1"); _writeApi.Flush(); listener.Get <WriteSuccessEvent>(); var query = await _queryApi.QueryAsync( $"from(bucket:\"{bucketName}\") |> range(start: 1970-01-01T00:00:00.000000001Z)", _organization.Id); Assert.AreEqual(1, query.Count); Assert.AreEqual(1, query[0].Records.Count); Assert.AreEqual("coyote_creek", query[0].Records[0].GetValueByKey("location")); Assert.AreEqual("level water_level", query[0].Records[0].GetValueByKey("_field")); Assert.AreEqual(1, query[0].Records[0].GetValue()); }
public async Task EnabledGzip() { Client.EnableGzip(); var bucketName = _bucket.Name; const string record1 = "h2o_feet,location=coyote_creek level\\ water_level=1.0 1"; const string record2 = "h2o_feet,location=coyote_creek level\\ water_level=2.0 2"; _writeApi = Client.GetWriteApi(); _writeApi.WriteRecords(bucketName, _organization.Id, WritePrecision.Ns, new List <string> { record1, record2 }); _writeApi.Flush(); var query = await _queryApi.Query( "from(bucket:\"" + bucketName + "\") |> range(start: 1970-01-01T00:00:00.000000001Z)", _organization.Id); Assert.AreEqual(1, query.Count); var records = query[0].Records; Assert.AreEqual(2, records.Count); Assert.AreEqual("h2o_feet", records[0].GetMeasurement()); Assert.AreEqual(1, records[0].GetValue()); Assert.AreEqual("level water_level", records[0].GetField()); Assert.AreEqual("h2o_feet", records[1].GetMeasurement()); Assert.AreEqual(2, records[1].GetValue()); Assert.AreEqual("level water_level", records[1].GetField()); }
public async Task Flush() { var bucketName = _bucket.Name; var writeOptions = WriteOptions.CreateNew().BatchSize(10).FlushInterval(100_000).Build(); _writeApi = Client.GetWriteApi(writeOptions); var listener = new WriteApiTest.EventListener(_writeApi); var record = "h2o_feet,location=coyote_creek level\\ water_level=1.0 1"; _writeApi.WriteRecord(bucketName, _organization.Id, WritePrecision.Ns, record); _writeApi.Flush(); listener.WaitToSuccess(); var query = await _queryApi.QueryAsync( $"from(bucket:\"{bucketName}\") |> range(start: 1970-01-01T00:00:00.000000001Z)", _organization.Id); Assert.AreEqual(1, query.Count); var records = query[0].Records; Assert.AreEqual(1, records.Count); Assert.AreEqual("h2o_feet", records[0].GetMeasurement()); Assert.AreEqual(1, records[0].GetValue()); Assert.AreEqual("level water_level", records[0].GetField()); var instant = Instant.Add(Instant.FromUnixTimeMilliseconds(0), Duration.FromNanoseconds(1L)); Assert.AreEqual(instant, records[0].GetTime()); }
public async Task WriteMeasurementsWithoutFields() { _writeApi = Client.GetWriteApi(); var listener = new WriteApiTest.EventListener(_writeApi); var bucketName = _bucket.Name; var time = DateTime.UtcNow; var measurement1 = new H20Measurement { Location = "coyote_creek", Level = 2.927, Time = time.Add(-TimeSpan.FromSeconds(30)) }; var measurement2 = new H20Measurement { Location = "coyote_creek", Level = null, Time = time }; _writeApi.WriteMeasurements(bucketName, _organization.Id, WritePrecision.S, measurement1, measurement2); _writeApi.Flush(); listener.WaitToSuccess(); var measurements = await _queryApi.QueryAsync <H20Measurement>( $"from(bucket:\"{bucketName}\") |> range(start: 0) |> rename(columns:{{_value: \"level\"}})", _organization.Id); Assert.AreEqual(1, measurements.Count); Assert.AreEqual(2.927, measurements[0].Level); Assert.AreEqual("coyote_creek", measurements[0].Location); Assert.AreEqual(time.AddTicks(-(time.Ticks % TimeSpan.TicksPerSecond)).Add(-TimeSpan.FromSeconds(30)), measurements[0].Time); }
public async Task WriteRecordsParams() { var bucketName = _bucket.Name; const string record1 = "h2o_feet,location=coyote_creek level\\ water_level=1.0 1"; const string record2 = "h2o_feet,location=coyote_creek level\\ water_level=2.0 2"; _writeApi = Client.GetWriteApi(); var listener = new WriteApiTest.EventListener(_writeApi); _writeApi.WriteRecords(bucketName, _organization.Id, WritePrecision.Ns, record1, record2); _writeApi.Flush(); listener.WaitToSuccess(); var query = await _queryApi.QueryAsync( $"from(bucket:\"{bucketName}\") |> range(start: 1970-01-01T00:00:00.000000001Z)", _organization.Id); Assert.AreEqual(1, query.Count); var records = query[0].Records; Assert.AreEqual(2, records.Count); Assert.AreEqual("h2o_feet", records[0].GetMeasurement()); Assert.AreEqual(1, records[0].GetValue()); Assert.AreEqual("level water_level", records[0].GetField()); Assert.AreEqual("h2o_feet", records[1].GetMeasurement()); Assert.AreEqual(2, records[1].GetValue()); Assert.AreEqual("level water_level", records[1].GetField()); }
public void Dispose() { _writeApi?.Flush(); _writeApi?.Dispose(); _writeApi = null; _client?.Dispose(); _client = null; }
protected override void Finished() { try { _writeApi.Flush(); _client.Dispose(); } catch (Exception e) { throw new SystemException(e.Message); } }
private void WriteData() { Environment.SetEnvironmentVariable("point-datacenter", "LA"); ConfigurationManager.AppSettings["point-sensor.version"] = "1.23a"; var options = new InfluxDBClientOptions.Builder().Url(InfluxDbUrl) .AuthenticateToken(_token) .AddDefaultTag("id", "132-987-655") .AddDefaultTag("customer", "California Miner") .AddDefaultTag("env-var", "${env.point-datacenter}") .AddDefaultTag("sensor-version", "${point-sensor.version}") .Build(); Client = InfluxDBClientFactory.Create(options); var point = PointData.Measurement("h2o_feet").Tag("location", "east").Field("water_level", 1); var point2 = PointData.Measurement("h2o_feet").Tag("location", "west").Field("water_level", 2); var point3 = PointData.Measurement("h2o_feet").Tag("location", "west").Field("water_level", 3); var point4 = PointData.Measurement("h2o_feet").Tag("location", "west").Field("water_level", 4); var point5 = PointData.Measurement("h2o_feet").Tag("location", "west").Field("water_level", 5); var point6 = PointData.Measurement("h2o_feet").Tag("location", "west").Field("water_level", 6); _writeApi = Client.GetWriteApi(); var listener = new WriteApiTest.EventListener(_writeApi); _writeApi.WritePoint(_bucket.Name, _organization.Id, point); _writeApi.Flush(); listener.WaitToSuccess(); _writeApi.WritePoint(_bucket.Name, _organization.Id, point2); _writeApi.Flush(); listener.WaitToSuccess(); _writeApi.WritePoint(_bucket.Name, _organization.Id, point3); _writeApi.Flush(); listener.WaitToSuccess(); _writeApi.WritePoint(_bucket.Name, _organization.Id, point4); _writeApi.Flush(); listener.WaitToSuccess(); _writeApi.WritePoint(_bucket.Name, _organization.Id, point5); _writeApi.Flush(); listener.WaitToSuccess(); _writeApi.WritePoint(_bucket.Name, _organization.Id, point6); _writeApi.Flush(); listener.WaitToSuccess(); }
public async Task WritePoints() { var bucketName = _bucket.Name; var time = DateTime.UtcNow; var point1 = PointData .Measurement("h2o_feet") .Tag("location", "west") .Field("water_level", 1) .Timestamp(time, WritePrecision.S); var point2 = PointData .Measurement("h2o_feet").Tag("location", "west") .Field("water_level", 2) .Timestamp(time.AddSeconds(-10), WritePrecision.S); _writeApi = Client.GetWriteApi(); var listener = new WriteApiTest.EventListener(_writeApi); _writeApi.WritePoints(bucketName, _organization.Id, point1, point2); _writeApi.Flush(); listener.WaitToSuccess(); var query = await _queryApi.QueryAsync( $"from(bucket:\"{bucketName}\") |> range(start: 1970-01-01T00:00:00.000000001Z)", _organization.Id); Assert.AreEqual(1, query.Count); var records = query[0].Records; Assert.AreEqual(2, records.Count); Assert.AreEqual("h2o_feet", records[0].GetMeasurement()); Assert.AreEqual(2, records[0].GetValue()); Assert.AreEqual("water_level", records[0].GetField()); Assert.AreEqual("h2o_feet", records[1].GetMeasurement()); Assert.AreEqual(1, records[1].GetValue()); Assert.AreEqual("water_level", records[1].GetField()); Assert.AreEqual(time.AddTicks(-(time.Ticks % TimeSpan.TicksPerSecond)).Add(-TimeSpan.FromSeconds(10)), records[0].GetTimeInDateTime()); Assert.AreEqual(time.AddTicks(-(time.Ticks % TimeSpan.TicksPerSecond)), records[1].GetTimeInDateTime()); }
public async Task DefaultTagsMeasurement() { Client.Dispose(); Environment.SetEnvironmentVariable("measurement-datacenter", "LA"); ConfigurationManager.AppSettings["measurement-sensor.version"] = "1.23a"; var options = new InfluxDBClientOptions.Builder().Url(InfluxDbUrl) .AuthenticateToken(_token.ToCharArray()) .AddDefaultTag("id", "132-987-655") .AddDefaultTag("customer", "California Miner") .AddDefaultTag("env-var", "${env.measurement-datacenter}") .AddDefaultTag("sensor-version", "${measurement-sensor.version}") .Build(); Client = InfluxDBClientFactory.Create(options); var measurement1 = new H20Measurement { Location = "coyote_creek", Level = 2.927, Time = DateTime.UtcNow }; _writeApi = Client.GetWriteApi(); var listener = new WriteApiTest.EventListener(_writeApi); _writeApi.WriteMeasurement(_bucket.Name, _organization.Id, WritePrecision.Ms, measurement1); _writeApi.Flush(); listener.WaitToSuccess(); _queryApi = Client.GetQueryApi(); var tables = await _queryApi.QueryAsync( "from(bucket:\"" + _bucket.Name + "\") |> range(start: 1970-01-01T00:00:00.000000001Z) |> pivot(rowKey:[\"_time\"], columnKey: [\"_field\"], valueColumn: \"_value\")", _organization.Id); Assert.AreEqual(1, tables.Count); Assert.AreEqual(1, tables[0].Records.Count); Assert.AreEqual("h2o", tables[0].Records[0].GetMeasurement()); Assert.AreEqual(2.927, tables[0].Records[0].GetValueByKey("level")); Assert.AreEqual("coyote_creek", tables[0].Records[0].GetValueByKey("location")); Assert.AreEqual("132-987-655", tables[0].Records[0].GetValueByKey("id")); Assert.AreEqual("California Miner", tables[0].Records[0].GetValueByKey("customer")); Assert.AreEqual("1.23a", tables[0].Records[0].GetValueByKey("sensor-version")); Assert.AreEqual("LA", tables[0].Records[0].GetValueByKey("env-var")); }
public void ListenWriteErrorEvent() { var bucketName = _bucket.Name; _writeApi = Client.GetWriteApi(); var listener = new WriteApiTest.EventListener(_writeApi); _writeApi.WriteRecord(bucketName, _organization.Id, WritePrecision.Ns, "h2o_feet,location=coyote_creek level\\ water_level=1.0 123456.789"); _writeApi.Flush(); var error = listener.Get <WriteErrorEvent>(); Assert.IsNotNull(error); Assert.AreEqual( "unable to parse 'h2o_feet,location=coyote_creek level\\ water_level=1.0 123456.789': bad timestamp", error.Exception.Message); }
public async Task PartialWrite() { var bucketName = _bucket.Name; _writeApi = Client.GetWriteApi(); const string record1 = "h2o_feet,location=coyote_creek level\\ water_level=1.0 1"; const string record2 = "h2o_feet,location=coyote_hill level\\ water_level=2.0 2x"; _writeApi.WriteRecords(bucketName, _organization.Id, WritePrecision.Ns, record1, record2); _writeApi.Flush(); _writeApi.Dispose(); var query = await _queryApi.Query( "from(bucket:\"" + bucketName + "\") |> range(start: 1970-01-01T00:00:00.000000001Z) |> last()", _organization.Id); Assert.AreEqual(0, query.Count); }
public async Task PartialWrite() { var bucketName = _bucket.Name; _writeApi = Client.GetWriteApi(WriteOptions.CreateNew().BatchSize(2).Build()); const string records = "h2o_feet,location=coyote_creek level\\ water_level=1.0 1\n" + "h2o_feet,location=coyote_hill level\\ water_level=2.0 2x"; _writeApi.WriteRecords(bucketName, _organization.Id, WritePrecision.Ns, records); _writeApi.Flush(); _writeApi.Dispose(); var query = await _queryApi.QueryAsync( $"from(bucket:\"{bucketName}\") |> range(start: 1970-01-01T00:00:00.000000001Z) |> last()", _organization.Id); Assert.AreEqual(0, query.Count); }
public void ListenWriteSuccessEvent() { var bucketName = _bucket.Name; _writeApi = Client.GetWriteApi(); var listener = new WriteApiTest.EventListener(_writeApi); _writeApi.WriteRecord(bucketName, _organization.Id, WritePrecision.Ns, "h2o_feet,location=coyote_creek level\\ water_level=1.0 1"); _writeApi.Flush(); var success = listener.Get <WriteSuccessEvent>(); Assert.IsNotNull(success); Assert.AreEqual(success.Organization, _organization.Id); Assert.AreEqual(success.Bucket, bucketName); Assert.AreEqual(success.Precision, WritePrecision.Ns); Assert.AreEqual(success.LineProtocol, "h2o_feet,location=coyote_creek level\\ water_level=1.0 1"); }
public async Task DefaultTagsPoint() { Client.Dispose(); Environment.SetEnvironmentVariable("point-datacenter", "LA"); ConfigurationManager.AppSettings["point-sensor.version"] = "1.23a"; var options = new InfluxDBClientOptions.Builder().Url(InfluxDbUrl) .AuthenticateToken(_token) .AddDefaultTag("id", "132-987-655") .AddDefaultTag("customer", "California Miner") .AddDefaultTag("env-var", "${env.point-datacenter}") .AddDefaultTag("sensor-version", "${point-sensor.version}") .Build(); Client = InfluxDBClientFactory.Create(options); var point = PointData.Measurement("h2o_feet").Tag("location", "west").Field("water_level", 1); _writeApi = Client.GetWriteApi(); var listener = new WriteApiTest.EventListener(_writeApi); _writeApi.WritePoint(_bucket.Name, _organization.Id, point); _writeApi.Flush(); listener.WaitToSuccess(); _queryApi = Client.GetQueryApi(); var tables = await _queryApi.QueryAsync( $"from(bucket:\"{_bucket.Name}\") |> range(start: 1970-01-01T00:00:00.000000001Z) |> pivot(rowKey:[\"_time\"], columnKey: [\"_field\"], valueColumn: \"_value\")", _organization.Id); Assert.AreEqual(1, tables.Count); Assert.AreEqual(1, tables[0].Records.Count); Assert.AreEqual("h2o_feet", tables[0].Records[0].GetMeasurement()); Assert.AreEqual(1, tables[0].Records[0].GetValueByKey("water_level")); Assert.AreEqual("west", tables[0].Records[0].GetValueByKey("location")); Assert.AreEqual("132-987-655", tables[0].Records[0].GetValueByKey("id")); Assert.AreEqual("California Miner", tables[0].Records[0].GetValueByKey("customer")); Assert.AreEqual("1.23a", tables[0].Records[0].GetValueByKey("sensor-version")); Assert.AreEqual("LA", tables[0].Records[0].GetValueByKey("env-var")); }
public void ListenWriteErrorEvent() { var bucketName = _bucket.Name; WriteErrorEvent error = null; _writeApi = Client.GetWriteApi(); _writeApi.EventHandler += (sender, args) => { error = args as WriteErrorEvent; }; _writeApi.WriteRecord(bucketName, _organization.Id, WritePrecision.Ns, "h2o_feet,location=coyote_creek level\\ water_level=1.0 123456.789"); _writeApi.Flush(); Thread.Sleep(100); Assert.IsNotNull(error); Assert.AreEqual( "unable to parse points: unable to parse 'h2o_feet,location=coyote_creek level\\ water_level=1.0 123456.789': bad timestamp", error.Exception.Message); }
public void ListenWriteSuccessEvent() { var bucketName = _bucket.Name; WriteSuccessEvent success = null; _writeApi = Client.GetWriteApi(); _writeApi.EventHandler += (sender, args) => { success = args as WriteSuccessEvent; }; _writeApi.WriteRecord(bucketName, _organization.Id, WritePrecision.Ns, "h2o_feet,location=coyote_creek level\\ water_level=1.0 1"); _writeApi.Flush(); Thread.Sleep(100); Assert.IsNotNull(success); Assert.AreEqual(success.Organization, _organization.Id); Assert.AreEqual(success.Bucket, bucketName); Assert.AreEqual(success.Precision, WritePrecision.Ns); Assert.AreEqual(success.LineProtocol, "h2o_feet,location=coyote_creek level\\ water_level=1.0 1"); }
public async Task DefaultTagsConfiguration() { Client.Dispose(); var options = new InfluxDBClientOptions.Builder() .LoadConfig() .Url(InfluxDbUrl) .AuthenticateToken(_token) .Build(); Client = InfluxDBClientFactory.Create(options); var measurement1 = new H20Measurement { Location = "coyote_creek", Level = 2.927, Time = DateTime.UtcNow }; _writeApi = Client.GetWriteApi(); var listener = new WriteApiTest.EventListener(_writeApi); _writeApi.WriteMeasurement(_bucket.Name, _organization.Id, WritePrecision.Ms, measurement1); _writeApi.Flush(); listener.WaitToSuccess(); _queryApi = Client.GetQueryApi(); var tables = await _queryApi.QueryAsync( $"from(bucket:\"{_bucket.Name}\") |> range(start: 1970-01-01T00:00:00.000000001Z) |> pivot(rowKey:[\"_time\"], columnKey: [\"_field\"], valueColumn: \"_value\")", _organization.Id); Assert.AreEqual(1, tables.Count); Assert.AreEqual(1, tables[0].Records.Count); Assert.AreEqual("h2o", tables[0].Records[0].GetMeasurement()); Assert.AreEqual(2.927, tables[0].Records[0].GetValueByKey("level")); Assert.AreEqual("coyote_creek", tables[0].Records[0].GetValueByKey("location")); Assert.AreEqual("132-987-655", tables[0].Records[0].GetValueByKey("id")); Assert.AreEqual("California Miner", tables[0].Records[0].GetValueByKey("customer")); Assert.AreEqual("v1.00", tables[0].Records[0].GetValueByKey("version")); }
public void RetryNotApplied() { var listener = new EventListener(_writeApi); // // 400 // MockServer.Reset(); MockServer .Given(Request.Create().UsingPost()) .RespondWith(CreateResponse("line protocol poorly formed and no points were written", 400)); _writeApi.WriteRecord("b1", "org1", WritePrecision.Ns, "h2o_feet,location=coyote_creek level\\ description=\"feet 1\",water_level=1.0 1"); _writeApi.Flush(); var error = listener.Get <WriteErrorEvent>(); Assert.IsNotNull(error); Assert.AreEqual(typeof(BadRequestException), error.Exception.GetType()); Assert.AreEqual("line protocol poorly formed and no points were written", error.Exception.Message); Assert.AreEqual(400, ((HttpException)error.Exception).Status); // // 401 // MockServer.Reset(); MockServer .Given(Request.Create().UsingPost()) .RespondWith(CreateResponse( "token does not have sufficient permissions to write to this organization and bucket or the organization and bucket do not exist", 401)); _writeApi.WriteRecord("b1", "org1", WritePrecision.Ns, "h2o_feet,location=coyote_creek level\\ description=\"feet 1\",water_level=1.0 1"); _writeApi.Flush(); error = listener.Get <WriteErrorEvent>(); Assert.IsNotNull(error); Assert.AreEqual(typeof(UnauthorizedException), error.Exception.GetType()); Assert.AreEqual( "token does not have sufficient permissions to write to this organization and bucket or the organization and bucket do not exist", error.Exception.Message); Assert.AreEqual(401, ((UnauthorizedException)error.Exception).Status); // // 403 // MockServer.Reset(); MockServer .Given(Request.Create().UsingPost()) .RespondWith(CreateResponse("no token was sent and they are required", 403)); _writeApi.WriteRecord("b1", "org1", WritePrecision.Ns, "h2o_feet,location=coyote_creek level\\ description=\"feet 1\",water_level=1.0 1"); _writeApi.Flush(); error = listener.Get <WriteErrorEvent>(); Assert.IsNotNull(error); Assert.AreEqual(typeof(ForbiddenException), error.Exception.GetType()); Assert.AreEqual("no token was sent and they are required", error.Exception.Message); Assert.AreEqual(403, ((ForbiddenException)error.Exception).Status); // // 413 // MockServer.Reset(); MockServer .Given(Request.Create().UsingPost()) .RespondWith(CreateResponse( "write has been rejected because the payload is too large. Error message returns max size supported. All data in body was rejected and not written", 413)); _writeApi.WriteRecord("b1", "org1", WritePrecision.Ns, "h2o_feet,location=coyote_creek level\\ description=\"feet 1\",water_level=1.0 1"); _writeApi.Flush(); error = listener.Get <WriteErrorEvent>(); Assert.IsNotNull(error); Assert.AreEqual(typeof(RequestEntityTooLargeException), error.Exception.GetType()); Assert.AreEqual( "write has been rejected because the payload is too large. Error message returns max size supported. All data in body was rejected and not written", error.Exception.Message); Assert.AreEqual(413, ((RequestEntityTooLargeException)error.Exception).Status); }
public async Task Delete() { Client.Dispose(); Environment.SetEnvironmentVariable("point-datacenter", "LA"); ConfigurationManager.AppSettings["point-sensor.version"] = "1.23a"; var options = new InfluxDBClientOptions.Builder().Url(InfluxDbUrl) .AuthenticateToken(_token.ToCharArray()) .AddDefaultTag("id", "132-987-655") .AddDefaultTag("customer", "California Miner") .AddDefaultTag("env-var", "${env.point-datacenter}") .AddDefaultTag("sensor-version", "${point-sensor.version}") .Build(); Client = InfluxDBClientFactory.Create(options); var point = PointData.Measurement("h2o_feet").Tag("location", "west").Field("water_level", 1); var point2 = PointData.Measurement("h2o_feet").Tag("location", "west").Field("water_level", 2); var point3 = PointData.Measurement("h2o_feet").Tag("location", "west").Field("water_level", 3); var point4 = PointData.Measurement("h2o_feet").Tag("location", "west").Field("water_level", 4); var point5 = PointData.Measurement("h2o_feet").Tag("location", "west").Field("water_level", 5); var point6 = PointData.Measurement("h2o_feet").Tag("location", "west").Field("water_level", 6); _writeApi = Client.GetWriteApi(); var listener = new WriteApiTest.EventListener(_writeApi); _writeApi.WritePoint(_bucket.Name, _organization.Id, point); _writeApi.Flush(); listener.WaitToSuccess(); _writeApi.WritePoint(_bucket.Name, _organization.Id, point2); _writeApi.Flush(); listener.WaitToSuccess(); _writeApi.WritePoint(_bucket.Name, _organization.Id, point3); _writeApi.Flush(); listener.WaitToSuccess(); _writeApi.WritePoint(_bucket.Name, _organization.Id, point4); _writeApi.Flush(); listener.WaitToSuccess(); _writeApi.WritePoint(_bucket.Name, _organization.Id, point5); _writeApi.Flush(); listener.WaitToSuccess(); _writeApi.WritePoint(_bucket.Name, _organization.Id, point6); _writeApi.Flush(); listener.WaitToSuccess(); string query = "from(bucket:\"" + _bucket.Name + "\") |> range(start: 1970-01-01T00:00:00.000000001Z) |> pivot(rowKey:[\"_time\"], columnKey: [\"_field\"], valueColumn: \"_value\")"; _queryApi = Client.GetQueryApi(); var tables = await _queryApi.QueryAsync(query, _organization.Id); Assert.AreEqual(1, tables.Count); Assert.AreEqual(6, tables[0].Records.Count); _deleteApi = Client.GetDeleteApi(); await _deleteApi.Delete(DateTime.Now.AddSeconds(-1), DateTime.Now, "", _bucket, _organization); var tablesAfterDelete = await _queryApi.QueryAsync(query, _organization.Id); Assert.AreNotEqual(0, tablesAfterDelete.Count); await _deleteApi.Delete(DateTime.Now.AddHours(-1), DateTime.Now, "", _bucket, _organization); var tablesAfterDelete2 = await _queryApi.QueryAsync(query, _organization.Id); Assert.AreEqual(0, tablesAfterDelete2.Count); }