@@ -96,8 +96,14 @@ func TestDateTime(t *testing.T) {
9696 assert .Equal (t , datetime .In (time .UTC ), col1 )
9797 assert .Equal (t , datetime .Unix (), col2 .Unix ())
9898 assert .Equal (t , datetime .Unix (), col3 .Unix ())
99- assert .Equal (t , "Europe/Moscow" , col2 .Location ().String ())
100- assert .Equal (t , "Europe/London" , col3 .Location ().String ())
99+ if protocol == clickhouse .HTTP {
100+ // TODO: investigate client_protocol_version HTTP param
101+ assert .Equal (t , "UTC" , col2 .Location ().String ())
102+ assert .Equal (t , "UTC" , col3 .Location ().String ())
103+ } else {
104+ assert .Equal (t , "Europe/Moscow" , col2 .Location ().String ())
105+ assert .Equal (t , "Europe/London" , col3 .Location ().String ())
106+ }
101107 assert .Equal (t , datetime .Unix (), col4 .Unix ())
102108 require .Len (t , col5 , 2 )
103109 assert .Equal (t , "Europe/Moscow" , col5 [0 ].Location ().String ())
@@ -109,7 +115,12 @@ func TestDateTime(t *testing.T) {
109115 assert .Equal (t , datetime .In (time .UTC ), col7 )
110116 assert .Equal (t , datetime .Unix (), col8 .Unix ())
111117 assert .Equal (t , datetime .Unix (), col9 .Unix ())
112- assert .Equal (t , "Asia/Shanghai" , col8 .Location ().String ())
118+ if protocol == clickhouse .HTTP {
119+ // TODO: investigate client_protocol_version HTTP param
120+ assert .Equal (t , "UTC" , col8 .Location ().String ())
121+ } else {
122+ assert .Equal (t , "Asia/Shanghai" , col8 .Location ().String ())
123+ }
113124 require .Len (t , col10 , 2 )
114125 assert .Equal (t , "Asia/Shanghai" , col10 [0 ].Location ().String ())
115126 assert .Equal (t , "Asia/Shanghai" , col10 [1 ].Location ().String ())
@@ -213,18 +224,33 @@ func TestNullableDateTime(t *testing.T) {
213224 assert .Equal (t , datetime .In (time .UTC ), col1 )
214225 assert .Equal (t , datetime .Unix (), col1 .Unix ())
215226 require .Nil (t , col2Null )
216- require .Equal (t , "Europe/Moscow" , col2 .Location ().String ())
227+ if protocol == clickhouse .HTTP {
228+ // TODO: investigate client_protocol_version HTTP param
229+ require .Equal (t , "UTC" , col2 .Location ().String ())
230+ } else {
231+ require .Equal (t , "Europe/Moscow" , col2 .Location ().String ())
232+ }
217233 assert .Equal (t , datetime .Unix (), col2 .Unix ())
218234 assert .Equal (t , datetime .Unix (), col2 .Unix ())
219235 require .Nil (t , col3Null )
220- require .Equal (t , "Europe/London" , col3 .Location ().String ())
236+ if protocol == clickhouse .HTTP {
237+ // TODO: investigate client_protocol_version HTTP param
238+ require .Equal (t , "UTC" , col3 .Location ().String ())
239+ } else {
240+ require .Equal (t , "Europe/London" , col3 .Location ().String ())
241+ }
221242 assert .Equal (t , datetime .Unix (), col3 .Unix ())
222243 assert .Equal (t , datetime .Unix (), col3 .Unix ())
223244 require .Nil (t , col4Null )
224245 assert .Equal (t , datetime .In (time .UTC ), col4 )
225246 assert .Equal (t , datetime .Unix (), col4 .Unix ())
226247 require .Nil (t , col5Null )
227- require .Equal (t , "Asia/Shanghai" , col5 .Location ().String ())
248+ if protocol == clickhouse .HTTP {
249+ // TODO: investigate client_protocol_version HTTP param
250+ require .Equal (t , "UTC" , col5 .Location ().String ())
251+ } else {
252+ require .Equal (t , "Asia/Shanghai" , col5 .Location ().String ())
253+ }
228254 assert .Equal (t , datetime .Unix (), col5 .Unix ())
229255 assert .Equal (t , datetime .Unix (), col5 .Unix ())
230256 }
@@ -428,7 +454,12 @@ func TestDateTimeTZ(t *testing.T) {
428454 assert .Equal (t , col8Expected .UTC (), col8 )
429455 col9Expected , err := time .ParseInLocation ("2006-01-02 15:04:05" , "2022-07-20 17:42:48" , time .Local )
430456 require .NoError (t , err )
431- assert .Equal (t , col9Expected .In (asiaLoc ), col9 )
457+ if protocol == clickhouse .HTTP {
458+ // TODO: investigate client_protocol_version HTTP param
459+ assert .Equal (t , col9Expected .UTC (), col9 )
460+ } else {
461+ assert .Equal (t , col9Expected .In (asiaLoc ), col9 )
462+ }
432463 // datetime - with tz
433464 col10Expected , err := time .ParseInLocation ("2006-01-02 15:04:05" , "2022-07-20 17:42:48" , asiaLoc )
434465 require .NoError (t , err )
@@ -438,7 +469,12 @@ func TestDateTimeTZ(t *testing.T) {
438469 assert .Equal (t , col11Expected .UTC (), col11 )
439470 col12Expected , err := time .ParseInLocation ("2006-01-02 15:04:05" , "2022-07-20 17:42:48" , asiaLoc )
440471 require .NoError (t , err )
441- assert .Equal (t , col12Expected .In (asiaLoc ), col12 )
472+ if protocol == clickhouse .HTTP {
473+ // TODO: investigate client_protocol_version HTTP param
474+ assert .Equal (t , col12Expected .UTC (), col12 )
475+ } else {
476+ assert .Equal (t , col12Expected .In (asiaLoc ), col12 )
477+ }
442478 })
443479}
444480
0 commit comments