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: client_test.go
    path of file: ./repos/kala/client
    
    the code of the file until where you have to start completion: package client

import (
	"fmt"
	"net/http/httptest"
	"os"
	"time"

	"github.com/ajvb/kala/api"
	"github.com/ajvb/kala/job"

	"testing"

	"github.com/gorilla/mux"
	"github.com/stretchr/testify/assert"
)

func NewTestServer() *httptest.Server {
	r := mux.NewRouter()
	db := &job.MockDB{}
	cache := job.NewLockFreeJobCache(db)
	api.SetupApiRoutes(r, cache, "")
	return httptest.NewServer(r)
}

func cleanUp() {
	ts := NewTestServer()
	kc := New(ts.URL)
	jobs, err := kc.GetAllJobs()
	if err != nil {
		fmt.Printf("Problem running clea
    
func TestGetJobStats(t *testing.T) {
	ts := NewTestServer()
	defer ts.Close()
	kc := New(ts.URL)
	j := NewJobMap()

	// Create the job
	id, err := kc.CreateJob(j)
	assert.NoError(t, err)
	// Start the job
	ok, err := kc.StartJob(id)
	now := time.Now()
	assert.NoError(t, err)
	assert.True(t, ok)
	// Wait let the job run
	time.Sleep(time.Second * 1)

	stats, err := kc.GetJobStats(id)
	assert.NoError(t, err)
	assert.Equal(t, id, stats[0].JobId)
	assert.Equal(t, uint(0), stats[0].NumberOfRetries)
	assert.True(t, stats[0].Success)
	assert.True(t, stats[0].ExecutionDuration != time.Duration(0))
	assert.WithinDuration(t, now, stats[0].RanAt, time.Second)

	cleanUp()
}