<commit_before>package e2e

import (
	"bytes"
	"fmt"
	"net"
	"net/http"
	"net/http/httptest"
	"os"
	"strings"
	"testing"
	"time"

	"github.com/jinzhu/gorm"
	"github.com/sclevine/agouti"
	"go.uber.org/zap/zapcore"

	"github.com/oinume/lekcije/backend/config"
	"github.com/oinume/lekcije/backend/ga_measurement"
	interfaces "github.com/oinume/lekcije/backend/interface"
	interfaces_http "github.com/oinume/lekcije/backend/interface/http"
	"github.com/oinume/lekcije/backend/logger"
	"github.com/oinume/lekcije/backend/model"
)

var (
	server *httptest.Server
	client = http.DefaultClient
	helper = model.NewTestHelper()
	db     *gorm.DB
)

func TestMain(m *testing.M) {
	config.MustProcessDefault()
	if err := os.Setenv("MYSQL_DATABASE", "lekcije_test"); err != nil {
		panic(err)
	}

	var accessLogBuffer, appLogBuffer bytes.Buffer
	appLogLevel := zapcore.InfoLevel
	if level := os.Getenv("LOG_LEVEL"); level != "" {
		appLogLevel = logger.NewLevel(level)
	}
	args := &interfaces.ServerArgs{
		AccessLogger:        logger.NewAccessLogger(&accessLogBuffer),
		AppLogger:           logger.NewAppLogger(&appLogBuffer, appLogLevel),
		GormDB:              helper.DB(nil),
		GAMeasurementClient: ga_measurement.NewFakeClient(),
	}
	s := interfaces_http.NewServer(args)
	routes := s.Setup()
	port := config.DefaultVars.HTTPPort + 1
	server = newTestServer(routes, port)
	fmt.Printf("Test HTTP server created: port=%d, url=%s\n", port, server.URL)<commit_msg>Fix compilation error in e2e<commit_after>package e2e

import (
	"bytes"
	"fmt"
	"net"
	"net/http"
	"net/http/httptest"
	"os"
	"strings"
	"testing"
	"time"

	"github.com/jinzhu/gorm"
	"github.com/sclevine/agouti"
	"go.uber.org/zap/zapcore"
	"goji.io/v3"

	"github.com/oinume/lekcije/backend/config"
	"github.com/oinume/lekcije/backend/infrastructure/ga_measurement"
	interfaces "github.com/oinume/lekcije/backend/interface"
	interfaces_http "github.com/oinume/lekcije/backend/interface/http"
	"github.com/oinume/lekcije/backend/logger"
	"github.com/oinume/lekcije/backend/model"
)

var (
	server *httptest.Server
	client = http.DefaultClient
	helper = model.NewTestHelper()
	db     *gorm.DB
)

func TestMain(m *testing.M) {
	config.MustProcessDefault()
	if err := os.Setenv("MYSQL_DATABASE", "lekcije_test"); err != nil {
		panic(err)
	}

	var accessLogBuffer, appLogBuffer bytes.Buffer
	appLogLevel := zapcore.InfoLevel
	if level := os.Getenv("LOG_LEVEL"); level != "" {
		appLogLevel = logger.NewLevel(level)
	}
	args := &interfaces.ServerArgs{
		AccessLogger:        logger.NewAccessLogger(&accessLogBuffer),
		AppLogger:           logger.NewAppLogger(&appLogBuffer, appLogLevel),
		GormDB:              helper.DB(nil),
		GAMeasurementClient: ga_measurement.NewFakeClient(),
	}
	s := interfaces_http.NewServer(args)
	mux := goji.NewMux()
	s.Setup(mux)
	port := config.DefaultVars.HTTPPort + 1
	server = newTestServer(mux, port)
	fmt.Printf("Test HTTP server created: port=%d, url=%s\n", port, server.URL)
{'fraction_non_alphanumeric': 0.14334009465855307, 'fraction_numerical': 0.002028397565922921, 'mean_word_length': 4.489795918367347, 'pattern_counts': {'":': 0, '<': 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': '6090940', 'n_tokens_mistral': 1162, 'n_tokens_neox': 1138, 'n_words': 173}