@@ -44,7 +44,7 @@ void Test::run() {
4444 testOldAPI ();
4545 testBatch ();
4646 testLineProtocol ();
47- testEcaping ();
47+ testEscaping ();
4848 testUrlEncode ();
4949 testIsValidID ();
5050 testFluxTypes ();
@@ -56,7 +56,7 @@ void Test::run() {
5656 testFluxParserNilValue ();
5757 testFluxParserMultiTables (false );
5858 testFluxParserMultiTables (true );
59- testFluxParserErrorDiffentColumnsNum ();
59+ testFluxParserErrorDifferentColumnsNum ();
6060 testFluxParserFluxError ();
6161 testFluxParserInvalidDatatype ();
6262 testFluxParserMissingDatatype ();
@@ -140,18 +140,17 @@ void Test::testOptions() {
140140 TEST_ASSERT (c._writeOptions ._retryInterval == 5 );
141141 TEST_ASSERT (c._writeOptions ._maxRetryAttempts == 3 );
142142 TEST_ASSERT (c._writeOptions ._maxRetryInterval == 300 );
143+ TEST_ASSERT (c._writeOptions ._defaultTags == " " );
144+ TEST_ASSERT (!c._writeOptions ._useServerTimestamp );
143145 ConnectionInfo connInfo = {
144146 serverUrl: " http://localhost:8086" ,
145147 bucket: " " ,
146148 org: " " ,
147149 authToken: " my-token"
148150 };
149151 HTTPService s (&connInfo);
150- TEST_ASSERT (!s._httpOptions ._connectionReuse );
151- TEST_ASSERT (s._httpOptions ._httpReadTimeout == 5000 );
152- // Client has no params
153- TEST_ASSERT (!c.setWriteOptions (defWO));
154- TEST_ASSERT (c.getLastErrorMessage () == " Invalid parameters" );
152+ TEST_ASSERT (!s.getHTTPOptions ()._connectionReuse );
153+ TEST_ASSERT (s.getHTTPOptions ()._httpReadTimeout == 5000 );
155154 c.setConnectionParams (" http://localhost:8086" ," my-org" ," my-bucket" , " my-token" );
156155
157156 TEST_ASSERT (c.setWriteOptions (defWO));
@@ -162,19 +161,21 @@ void Test::testOptions() {
162161 TEST_ASSERT (c._writeOptions ._retryInterval == 1 );
163162 TEST_ASSERT (c._writeOptions ._maxRetryAttempts == 5 );
164163 TEST_ASSERT (c._writeOptions ._maxRetryInterval == 20 );
165-
164+ TEST_ASSERT (c._writeOptions ._defaultTags == " tag1=val1,tag2=val2" );
165+ TEST_ASSERT (c._writeOptions ._useServerTimestamp );
166166
167167 TEST_ASSERT (c.setHTTPOptions (defHO));
168- TEST_ASSERT (c._service ->_httpOptions ._connectionReuse );
169- TEST_ASSERT (c._service ->_httpOptions ._httpReadTimeout == 20000 );
168+ TEST_ASSERT (c._service == nullptr );
169+ TEST_ASSERT (c._connInfo .httpOptions ._connectionReuse );
170+ TEST_ASSERT (c._connInfo .httpOptions ._httpReadTimeout == 20000 );
170171
171172 c.setWriteOptions (WritePrecision::MS, 15 , 14 , 70 , false );
172173 TEST_ASSERT (c._writeOptions ._writePrecision == WritePrecision::MS);
173174 TEST_ASSERT (c._writeOptions ._batchSize == 15 );
174175 TEST_ASSERTM (c._writeOptions ._bufferSize == 30 , String (c._writeOptions ._bufferSize ));
175176 TEST_ASSERT (c._writeOptions ._flushInterval == 70 );
176- TEST_ASSERT (!c._service -> _httpOptions ._connectionReuse );
177- TEST_ASSERT (c._service -> _httpOptions ._httpReadTimeout == 20000 );
177+ TEST_ASSERT (!c._connInfo . httpOptions ._connectionReuse );
178+ TEST_ASSERT (c._connInfo . httpOptions ._httpReadTimeout == 20000 );
178179
179180 defWO = WriteOptions ().batchSize (100 ).bufferSize (7000 );
180181 c.setWriteOptions (defWO);
@@ -188,8 +189,8 @@ void Test::testOptions() {
188189}
189190
190191
191- void Test::testEcaping () {
192- TEST_INIT (" testEcaping " );
192+ void Test::testEscaping () {
193+ TEST_INIT (" testEscaping " );
193194
194195 Point p (" t\r e=s\n t\t _t e\" s,t" );
195196 p.addTag (" ta=g" ," val=ue" );
@@ -623,19 +624,22 @@ bool checkLinesParts(InfluxDBClient &client, size_t lineCount, int partCount) {
623624void Test::testUseServerTimestamp () {
624625 TEST_INIT (" testUseServerTimestamp" );
625626
626- InfluxDBClient client (Test::apiUrl, Test::orgName, Test::bucketName, Test::token) ;
627+ InfluxDBClient client;
627628
628629 TEST_ASSERT (waitServer (Test::managementUrl, true ));
629630
630631 // test no precision, no timestamp
631632 Point *p = createPoint (" test1" );
632- TEST_ASSERT (client.writePoint (*p));
633+
634+ // Test no precision, custom timestamp
635+ auto opts = WriteOptions ().batchSize (1 ).bufferSize (10 );
636+ TEST_ASSERT (client.setWriteOptions (opts));
637+ client.setConnectionParams (Test::apiUrl, Test::orgName, Test::bucketName, Test::token);
633638
639+ TEST_ASSERT (client.writePoint (*p));
634640 TEST_ASSERT (checkLinesParts (client, 1 , 9 ));
635641
636- // Test no precision, custom timestamp
637- auto opts = WriteOptions ().batchSize (2 );
638- client.setWriteOptions (opts);
642+ TEST_ASSERT (client.setWriteOptions (opts.batchSize (2 )));
639643
640644 Point *dir = new Point (" dir" );
641645 dir->addTag (" direction" , " check-precision" );
@@ -649,7 +653,7 @@ void Test::testUseServerTimestamp() {
649653 TEST_ASSERT (checkLinesParts (client, 1 , 10 ));
650654
651655 // Test writerecitions + ts
652- client.setWriteOptions (opts.writePrecision (WritePrecision::S));
656+ TEST_ASSERT ( client.setWriteOptions (opts.writePrecision (WritePrecision::S) ));
653657
654658 dir = new Point (" dir" );
655659 dir->addTag (" direction" , " check-precision" );
@@ -660,7 +664,7 @@ void Test::testUseServerTimestamp() {
660664
661665 TEST_ASSERT (checkLinesParts (client, 1 , 10 ));
662666 // test sending only precision
663- client.setWriteOptions (opts.useServerTimestamp (true ));
667+ TEST_ASSERT ( client.setWriteOptions (opts.useServerTimestamp (true ) ));
664668
665669 TEST_ASSERT (client.writePoint (*dir));
666670 TEST_ASSERT (client.writePoint (*p));
@@ -2123,8 +2127,8 @@ void Test::testFluxParserMultiTables(bool chunked) {
21232127 TEST_END ();
21242128}
21252129
2126- void Test::testFluxParserErrorDiffentColumnsNum () {
2127- TEST_INIT (" testFluxParserErrorDiffentColumnsNum " );
2130+ void Test::testFluxParserErrorDifferentColumnsNum () {
2131+ TEST_INIT (" testFluxParserErrorDifferentColumnsNum " );
21282132 InfluxDBClient client (Test::apiUrl, Test::orgName, Test::bucketName, Test::token);
21292133 TEST_ASSERT (waitServer (Test::managementUrl, true ));
21302134 FluxQueryResult flux = client.query (" testquery-diffNum-data" );
0 commit comments