func TestWriteHTTPGzippedData(t *testing.T) {
	listener := newTestHTTPListener()

	acc := &testutil.Accumulator{}
	require.NoError(t, listener.Start(acc))
	defer listener.Stop()

	data, err := ioutil.ReadFile("./testdata/testmsgs.gz")
	require.NoError(t, err)

	req, err := http.NewRequest("POST", createURL(listener, "http", "/write", ""), bytes.NewBuffer(data))
	require.NoError(t, err)
	req.Header.Set("Content-Encoding", "gzip")

	client := &http.Client{}
	resp, err := client.Do(req)
	require.NoError(t, err)
	require.EqualValues(t, 204, resp.StatusCode)

	hostTags := []string{"server02", "server03",
		"server04", "server05", "server06"}
	acc.Wait(len(hostTags))
	for _, hostTag := range hostTags {
		acc.AssertContainsTaggedFields(t, "cpu_load_short",
			map[string]interface{}{"value": float64(12)},
			map[string]string{"host": hostTag},
		)
	}
}
// test that writing gzipped data works
test that writing gzipped data works
// test that writing gzipped data works
func TestWriteHTTPGzippedData(t *testing.T) {
	listener := newTestHTTPListener()
	acc := &testutil.Accumulator{}
	require.NoError(t, listener.Start(acc))
	defer listener.Stop()
	data, err := ioutil.ReadFile("./testdata/testmsgs.gz")
	require.NoError(t, err)
	req, err := http.NewRequest("POST", createURL(listener, "http", "/write", ""), bytes.NewBuffer(data))
	require.NoError(t, err)
	req.Header.Set("Content-Encoding", "gzip")
	client := &http.Client{}
	resp, err := client.Do(req)
	require.NoError(t, err)
	require.EqualValues(t, 204, resp.StatusCode)
	hostTags := []string{"server02", "server03",
		"server04", "server05", "server06"}
	acc.Wait(len(hostTags))
	for _, hostTag := range hostTags {
		acc.AssertContainsTaggedFields(t, "cpu_load_short",
			map[string]interface{}{"value": float64(12)},
			map[string]string{"host": hostTag},
		)
	}
}
func TestWriteHTTPGzippedData ( t * testing . T ) { listener := newTestHTTPListener ( ) acc := & testutil . Accumulator { } require . NoError ( t , listener . Start ( acc ) ) defer listener . Stop ( ) data , err := ioutil . ReadFile ( " " ) require . NoError ( t , err ) req , err := http . NewRequest ( " " , createURL ( listener , " " , " " , " " ) , bytes . NewBuffer ( data ) ) require . NoError ( t , err ) req . Header . Set ( " " , " " ) client := & http . Client { } resp , err := client . Do ( req ) require . NoError ( t , err ) require . EqualValues ( t , 204 , resp . StatusCode ) hostTags := [ ] string { " " , " " , " " , " " , " " } acc . Wait ( len ( hostTags ) ) for _ , hostTag := range hostTags { acc . AssertContainsTaggedFields ( t , " " , map [ string ] interface { } { " " : float64 ( 12 ) } , map [ string ] string { " " : hostTag } , ) } }
test that writing gzipped data works
test that writing gzipped data works