<commit_before>package main

import (
	"bytes"
	"encoding/base64"
	"io/ioutil"
	"net"
	"net/http"
	"net/http/httptest"
	"testing"
	"time"

	"github.com/gin-gonic/gin"
)

var fullTests = []struct {
	cnt      int
	Req      string
	Expected []string
}{
	{
		cnt: 2,
		Req: `255 <158>1 2015-04-02T11:52:34.520012+00:00 host heroku router - at=info method=POST path="/users" host=myapp.com request_id=c1806361-2081-42e7-a8aa-92b6808eac8e fwd="172.16.58.3" dyno=web.1 connect=1ms service=37ms status=201 bytes=828`,
		Expected: []string{
			"heroku.router.request.connect:1.000000|h|#dyno:web.1,method:POST,status:201,path:/users,host:myapp.com,at:info",
			"heroku.router.request.service:37.000000|h|#dyno:web.1,method:POST,status:201,path:/users,host:myapp.com,at:info",
		},
	},
	{
		cnt: 1,
		Req: `229 <45>1 2015-04-02T11:48:16.839257+00:00 host heroku web.1 - source=web.1 dyno=heroku.35930502.b9de5fce-44b7-4287-99a7-504519070cba sample#load_avg_1m=0.01`,
		Expected: []string{
			"heroku.dyno.load.avg.1m:0.010000|h|#source:web.1",
		},
	},
	{
		cnt: 2,
		Req: `222 <134>1 2015-04-07T16:01:43.517062+00:00 host heroku api - Scale to mailer=1, web=3 by <EMAIL>`,
		Expected: []string{
			"heroku.dyno.mailer:1.000000|g",
			"heroku.dyno.web:3.000000|g",
		},
	},
}

func TestStatusRequest(t *testing.T) {

	r := gin.New()
	r.GET("/status", func(c *gin.Context) {
		c.String(200, "OK")
	})

	req, _ := http.NewRequest("GET", "/status", nil)
	resp := httptest.NewRecorder()
	r.ServeHTTP(resp, req)

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		t.Error(err)<commit_msg>Add failing test<commit_after>package main

import (
	"bytes"
	"encoding/base64"
	"io/ioutil"
	"net"
	"net/http"
	"net/http/httptest"
	"testing"
	"time"

	"github.com/gin-gonic/gin"
)

var fullTests = []struct {
	cnt      int
	Req      string
	Expected []string
}{
	{
		cnt: 2,
		Req: `255 <158>1 2015-04-02T11:52:34.520012+00:00 host heroku router - at=info method=POST path="/users" host=myapp.com request_id=c1806361-2081-42e7-a8aa-92b6808eac8e fwd="172.16.58.3" dyno=web.1 connect=1ms service=37ms status=201 bytes=828`,
		Expected: []string{
			"heroku.router.request.connect:1.000000|h|#dyno:web.1,method:POST,status:201,path:/users,host:myapp.com,at:info",
			"heroku.router.request.service:37.000000|h|#dyno:web.1,method:POST,status:201,path:/users,host:myapp.com,at:info",
		},
	},
	{
		cnt: 1,
		Req: `229 <45>1 2015-04-02T11:48:16.839257+00:00 host heroku web.1 - source=web.1 dyno=heroku.35930502.b9de5fce-44b7-4287-99a7-504519070cba sample#load_avg_1m=0.01`,
		Expected: []string{
			"heroku.dyno.load.avg.1m:0.010000|h|#source:web.1",
		},
	},
	{
		cnt: 2,
		Req: `222 <134>1 2015-04-07T16:01:43.517062+00:00 host heroku api - Scale to mailer=1, web=3 by <EMAIL>`,
		Expected: []string{
			"heroku.dyno.mailer:1.000000|g",
			"heroku.dyno.web:3.000000|g",
		},
	},
	{
		cnt: 3,
		Req: `222 <134>1 2015-04-07T16:01:43.517062+00:00 host app web.1 - info: responseLogger: metric#route=/parser metric#request_id=11747467-f4ce-4b06-8c99-92be968a02e3 metric#request_length=541 metric#response_length=5163 metric#parser_time=5ms`,
		Expected: []string{
			"app.metric.request_length:541|h|#route=/parser,request_id=11747467-f4ce-4b06-8c99-92be968a02e3",
			"app.metric.response_length:5163|h|#route=/parser,request_id=11747467-f4ce-4b06-8c99-92be968a02e3",
			"app.metric.parser_time:5.000000|h|#route=/parser,request_id=11747467-f4ce-4b06-8c99-92be968a02e3",
		},
	},
}

func TestStatusRequest(t *testing.T) {

	r := gin.New()
	r.GET("/status", func(c *gin.Context) {
		c.String(200, "OK")
	})

	req, _ := http.NewRequest("GET", "/status", nil)
	resp := httptest.NewRecorder()
	r.ServeHTTP(resp, req)

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		t.Error(err)
{'fraction_non_alphanumeric': 0.18633705475810738, 'fraction_numerical': 0.15762892078681554, 'mean_word_length': 4.608047690014903, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '1723173', 'n_tokens_mistral': 2102, 'n_tokens_neox': 1707, 'n_words': 230}