You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: logs_generate_test.go
    path of file: ./repos/clickvisual/api/internal/pkg/agent/search/benchmark
    
    the code of the file until where you have to start completion: package benchmark

import (
	"fmt"
	"math/rand"
	"os"
	"testing"
	"time"
)

type Category struct {
	content         string
	count           int64
	filter          string
	conditionSearch bool
}

type CasesFile struct {
	path  
    
func TestGenerateTestFile(t *testing.T) {
	for k := 0; k < len(casesFiles); k++ {
		file := casesFiles[k]
		if file.skip {
			continue
		}
		writer, err := os.OpenFile(file.path, os.O_RDWR|os.O_CREATE, 0666)
		if err != nil {
			panic(err)
		}

		record := file.st
		mp := make(map[int64]int64)
		logslen := len(file.logCategories)

		var n int64 = int64(logslen)
		for i := 0; i < logslen; i++ {
			mp[int64(i)] = file.logCategories[i].count
		}
		q := make([]int, n)

		for i := 0; i < logslen; i++ {
			q[i] = i
		}

		for i := 0; i < int(file.count); i++ {
			record += rand.Int63n(file.interval / file.count)
			idx := rand.Int63n(int64(100)) % n
			pos := int64(q[idx])
			mp[pos]--
			if mp[pos] <= 0 {
				delete(mp, pos)
				q = append(q[:idx], q[idx+1:]...)
				n--
			}
			log := file.logCategories[pos]
			if log.conditionSearch {
				_, _ = writer.WriteString(log.content + "\n")
			} else {
				_, _ = writer.WriteString(fmt.Sprintf(file.logCategories[pos].content+"\n", record, time.Unix(record, 0).Format("2006-01-02 15:04:05")))
			}
		}
	}
}