mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Added a test
This commit is contained in:
parent
239b198a12
commit
fa95fa1517
@ -24,6 +24,8 @@ RUN apt-get update -y \
|
||||
python3-pip \
|
||||
qemu-user-static \
|
||||
sudo \
|
||||
# golang version 1.13 on Ubuntu 20 is enough for tests
|
||||
golang \
|
||||
telnet \
|
||||
tree \
|
||||
unixodbc \
|
||||
|
61
tests/queries/0_stateless/02013_zlib_read_after_eof.go
Normal file
61
tests/queries/0_stateless/02013_zlib_read_after_eof.go
Normal file
@ -0,0 +1,61 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"compress/gzip"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
)
|
||||
|
||||
func compress(data io.Reader) io.Reader {
|
||||
pr, pw := io.Pipe()
|
||||
gw := gzip.NewWriter(pw)
|
||||
|
||||
go func() {
|
||||
_, _ = io.Copy(gw, data)
|
||||
gw.Close()
|
||||
pw.Close()
|
||||
}()
|
||||
|
||||
return pr
|
||||
}
|
||||
|
||||
func main() {
|
||||
p, err := url.Parse("http://localhost:8123/")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
q := p.Query()
|
||||
|
||||
q.Set("query", "INSERT INTO graphite FORMAT RowBinary")
|
||||
p.RawQuery = q.Encode()
|
||||
queryUrl := p.String()
|
||||
|
||||
var req *http.Request
|
||||
|
||||
|
||||
req, err = http.NewRequest("POST", queryUrl, compress(os.Stdin))
|
||||
req.Header.Add("Content-Encoding", "gzip")
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
client := &http.Client{
|
||||
Transport: &http.Transport{DisableKeepAlives: true},
|
||||
}
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, _ := ioutil.ReadAll(resp.Body)
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
panic(fmt.Errorf("clickhouse response status %d: %s", resp.StatusCode, string(body)))
|
||||
}
|
||||
}
|
14
tests/queries/0_stateless/02013_zlib_read_after_eof.sh
Executable file
14
tests/queries/0_stateless/02013_zlib_read_after_eof.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CUR_DIR"/../shell_config.sh
|
||||
|
||||
$CLICKHOUSE_CLIENT -q "CREATE TABLE graphite(\`Path\` String, \`Value\` Float64, \`Time\` UInt32, \`Date\` Date, \`Timestamp\` UInt32) \
|
||||
ENGINE = MergeTree PARTITION BY toYYYYMM(Date) ORDER BY (Path, Time) SETTINGS index_granularity = 8192;"
|
||||
|
||||
cat 02013_zlib_read_after_eof_data | go run 02013_zlib_read_after_eof.go
|
||||
|
||||
|
||||
$CLICKHOUSE_CLIENT -q "drop table graphite"
|
BIN
tests/queries/0_stateless/02013_zlib_read_after_eof_data
Normal file
BIN
tests/queries/0_stateless/02013_zlib_read_after_eof_data
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user