<commit_before>package netx_test

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"testing"
	"time"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

func TestHTTP(t *testing.T) {
	addr, tearDown := setUpTestHTTPServer(t)
	defer tearDown()

	client := setUpTestHTTPClient(t)

	response, err := client.Get(fmt.Sprintf("http://%s/test", addr))
	require.NoError(t, err)
	defer response.Body.Close()
	require.Equal(t, http.StatusOK, response.StatusCode)

	body, err := ioutil.ReadAll(response.Body)
	require.NoError(t, err)
	assert.Equal(t, "test", string(body))
}

func BenchmarkHTTPSimpleGet(b *testing.B) {
	addr, tearDown := setUpTestHTTPServer(b)
	defer tearDown()
	time.Sleep(100 * time.Millisecond)

	client := setUpTestHTTPClient(b)
	b.ResetTimer()
	for index := 0; index < b.N; index++ {
		response, err := client.Get(fmt.Sprintf("http://%s/test", addr))
		require.NoError(b, err)
		require.Equal(b, http.StatusOK, response.StatusCode)

		body, err := ioutil.ReadAll(response.Body)
		require.NoError(b, err)
		require.Equal(b, "test", string(body))
		require.NoError(b, response.Body.Close())
	}
}<commit_msg>removed obsolete delay in test<commit_after>package netx_test

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"testing"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

func TestHTTP(t *testing.T) {
	addr, tearDown := setUpTestHTTPServer(t)
	defer tearDown()

	client := setUpTestHTTPClient(t)

	response, err := client.Get(fmt.Sprintf("http://%s/test", addr))
	require.NoError(t, err)
	defer response.Body.Close()
	require.Equal(t, http.StatusOK, response.StatusCode)

	body, err := ioutil.ReadAll(response.Body)
	require.NoError(t, err)
	assert.Equal(t, "test", string(body))
}

func BenchmarkHTTPSimpleGet(b *testing.B) {
	addr, tearDown := setUpTestHTTPServer(b)
	defer tearDown()

	client := setUpTestHTTPClient(b)
	b.ResetTimer()
	for index := 0; index < b.N; index++ {
		response, err := client.Get(fmt.Sprintf("http://%s/test", addr))
		require.NoError(b, err)
		require.Equal(b, http.StatusOK, response.StatusCode)

		body, err := ioutil.ReadAll(response.Body)
		require.NoError(b, err)
		require.Equal(b, "test", string(body))
		require.NoError(b, response.Body.Close())
	}
}
{'fraction_non_alphanumeric': 0.16481563749444691, 'fraction_numerical': 0.002221235006663705, 'mean_word_length': 5.005333333333334, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1589257', 'n_tokens_mistral': 881, 'n_tokens_neox': 860, 'n_words': 155}