<commit_before>package main

import (
	"testing"
)

var payload = []byte(`{
    "id": "cb01.labs.widget.co",
    "name": "couchbase",
    "tags": [
        "cache",
        "cloudstack",
        "rancid",
        "cloudythings"
    ],
    "address": "cb01.labs.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb01.labs.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
},
{
    "id": "cb02.labs.widget.co",
    "name": "couchbase",
    "tags": [
        "cache",
        "cloudstack",
        "rancid",
        "cloudythings"
    ],
    "address": "cb02.labs.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb02.labs.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
},
{
    "id": "cb01-dev.davidson.tn.widget.co",
    "name": "couchbase",
    "tags": [
        "throb",
        "radius",
        "satchel",
        "reportingResults",
        "catawampus"
    ],
    "address": "cb01-dev.davidson.tn.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb01-dev.davidson.tn.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
},
{
    "id": "cb02-dev.davidson.tn.widget.co",
    "name": "couchbase",
    "tags": [
        "throb",
        "radius",
        "satchel",
        "reportingResults",
        "catawampus"
    ],
    "address": "cb02-dev.davidson.tn.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb02-dev.davidson.tn.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
},
{
    "id": "cb03-dev.davidson.tn.widget.co",
    "name": "couchbase",
    "tags": [
        "throb",
        "radius",
        "satchel",
        "reportingResults",
        "catawampus"
    ],
    "address": "cb03-dev.davidson.tn.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb03-dev.davidson.tn.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
}`)

var payload2 = []byte(`{
    "id": "cb01.labs.widget.co",
    "name": "couchbase",
    "tags": [
        "cache",
        "cloudstack",
        "rancid",
        "cloudythings"
    ],
    "address": "cb01.labs.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb01.labs.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
}
{
    "id": "cb02.labs.widget.co",
    "name": "couchbase",
    "tags": [
        "cache",
        "cloudstack",
        "rancid",
        "cloudythings"
    ],
    "address": "cb02.labs.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb02.labs.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
}
{
    "id": "cb01-dev.davidson.tn.widget.co",
    "name": "couchbase",
    "tags": [
        "throb",
        "radius",
        "satchel",
        "reportingResults",
        "catawampus"
    ],
    "address": "cb01-dev.davidson.tn.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb01-dev.davidson.tn.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
}
{
    "id": "cb02-dev.davidson.tn.widget.co",
    "name": "couchbase",
    "tags": [
        "throb",
        "radius",
        "satchel",
        "reportingResults",
        "catawampus"
    ],
    "address": "cb02-dev.davidson.tn.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb02-dev.davidson.tn.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
}
{
    "id": "cb03-dev.davidson.tn.widget.co",
    "name": "couchbase",
    "tags": [
        "throb",
        "radius",
        "satchel",
        "reportingResults",
        "catawampus"
    ],
    "address": "cb03-dev.davidson.tn.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb03-dev.davidson.tn.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
}
`)

func TestProcessor(t *testing.T) {
	for i, p := range [][]byte{
		payload,
		[]byte("[" + string(payload) + "]"),
		[]byte("{\"services\": [" + string(payload) + "]}"),
		payload2,
	} {
		regs, err := parseServiceRegs(p)
		if err != nil {
			t.Errorf("parseServiceRegs failed in pass %d: %s\n", i err)
			t.FailNow()
		}
		if len(regs) != 5 {<commit_msg>woops<commit_after>package main

import (
	"testing"
)

var payload = []byte(`{
    "id": "cb01.labs.widget.co",
    "name": "couchbase",
    "tags": [
        "cache",
        "cloudstack",
        "rancid",
        "cloudythings"
    ],
    "address": "cb01.labs.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb01.labs.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
},
{
    "id": "cb02.labs.widget.co",
    "name": "couchbase",
    "tags": [
        "cache",
        "cloudstack",
        "rancid",
        "cloudythings"
    ],
    "address": "cb02.labs.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb02.labs.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
},
{
    "id": "cb01-dev.davidson.tn.widget.co",
    "name": "couchbase",
    "tags": [
        "throb",
        "radius",
        "satchel",
        "reportingResults",
        "catawampus"
    ],
    "address": "cb01-dev.davidson.tn.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb01-dev.davidson.tn.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
},
{
    "id": "cb02-dev.davidson.tn.widget.co",
    "name": "couchbase",
    "tags": [
        "throb",
        "radius",
        "satchel",
        "reportingResults",
        "catawampus"
    ],
    "address": "cb02-dev.davidson.tn.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb02-dev.davidson.tn.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
},
{
    "id": "cb03-dev.davidson.tn.widget.co",
    "name": "couchbase",
    "tags": [
        "throb",
        "radius",
        "satchel",
        "reportingResults",
        "catawampus"
    ],
    "address": "cb03-dev.davidson.tn.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb03-dev.davidson.tn.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
}`)

var payload2 = []byte(`{
    "id": "cb01.labs.widget.co",
    "name": "couchbase",
    "tags": [
        "cache",
        "cloudstack",
        "rancid",
        "cloudythings"
    ],
    "address": "cb01.labs.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb01.labs.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
}
{
    "id": "cb02.labs.widget.co",
    "name": "couchbase",
    "tags": [
        "cache",
        "cloudstack",
        "rancid",
        "cloudythings"
    ],
    "address": "cb02.labs.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb02.labs.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
}
{
    "id": "cb01-dev.davidson.tn.widget.co",
    "name": "couchbase",
    "tags": [
        "throb",
        "radius",
        "satchel",
        "reportingResults",
        "catawampus"
    ],
    "address": "cb01-dev.davidson.tn.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb01-dev.davidson.tn.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
}
{
    "id": "cb02-dev.davidson.tn.widget.co",
    "name": "couchbase",
    "tags": [
        "throb",
        "radius",
        "satchel",
        "reportingResults",
        "catawampus"
    ],
    "address": "cb02-dev.davidson.tn.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb02-dev.davidson.tn.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
}
{
    "id": "cb03-dev.davidson.tn.widget.co",
    "name": "couchbase",
    "tags": [
        "throb",
        "radius",
        "satchel",
        "reportingResults",
        "catawampus"
    ],
    "address": "cb03-dev.davidson.tn.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb03-dev.davidson.tn.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
}
`)

func TestProcessor(t *testing.T) {
	for i, p := range [][]byte{
		payload,
		[]byte("[" + string(payload) + "]"),
		[]byte("{\"services\": [" + string(payload) + "]}"),
		payload2,
	} {
		regs, err := parseServiceRegs(p)
		if err != nil {
			t.Errorf("parseServiceRegs failed in pass %d: %s\n", i, err)
			t.FailNow()
		}
		if len(regs) != 5 {
{'fraction_non_alphanumeric': 0.20823216556827379, 'fraction_numerical': 0.03769221875361314, 'mean_word_length': 1.6755335601608414, 'pattern_counts': {'":': 162, '<': 3, '<?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': '4348654', 'n_tokens_mistral': 3603, 'n_tokens_neox': 3356, 'n_words': 456}