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: validate_test.go
    path of file: ./repos/flagr/pkg/handler
    
    the code of the file until where you have to start completion: package handler

import (
	"fmt"
	"testing"

	"github.com/openflagr/flagr/pkg/entity"
	"github.com/openflagr/flagr/pkg/util"
	"github.com/openflagr/flagr/swagger_gen/models
    
func TestValidateDeleteVariant(t *testing.T) {
	db := entity.NewTestDB()
	c := &crud{}

	tmpDB, dbErr := db.DB()
	if dbErr != nil {
		t.Errorf("Failed to get database")
	}

	defer tmpDB.Close()
	defer gostub.StubFunc(&getDB, db).Reset()

	c.CreateFlag(flag.CreateFlagParams{
		Body: &models.CreateFlagRequest{
			Description: util.StringPtr("funny flag"),
		},
	})
	c.CreateSegment(segment.CreateSegmentParams{
		FlagID: int64(1),
		Body: &models.CreateSegmentRequest{
			Description:    util.StringPtr("segment1"),
			RolloutPercent: util.Int64Ptr(int64(100)),
		},
	})
	c.CreateVariant(variant.CreateVariantParams{
		FlagID: int64(1),
		Body: &models.CreateVariantRequest{
			Key: util.StringPtr("control"),
		},
	})
	c.CreateVariant(variant.CreateVariantParams{
		FlagID: int64(1),
		Body: &models.CreateVariantRequest{
			Key: util.StringPtr("treatment"),
		},
	})
	c.PutDistributions(distribution.PutDistributionsParams{
		FlagID:    int64(1),
		SegmentID: int64(1),
		Body: &models.PutDistributionsRequest{
			Distributions: []*models.Distribution{
				{
					Percent:    util.Int64Ptr(int64(100)),
					VariantID:  util.Int64Ptr(int64(1)),
					VariantKey: util.StringPtr("control"),
				},
				{
					Percent:    util.Int64Ptr(int64(0)),
					VariantID:  util.Int64Ptr(int64(2)),
					VariantKey: util.StringPtr("treatment"),
				},
			},
		},
	})

	t.Run("happy code path - try to delete a variant with 0 percent distribution", func(t *testing.T) {
		param := variant.DeleteVariantParams{
			FlagID:    int64(1),
			VariantID: int64(2),
		}
		err := validateDeleteVariant(param)
		assert.Nil(t, err)
	})

	t.Run("try to delete a variant that's used in a distribution", func(t *testing.T) {
		param := variant.DeleteVariantParams{
			FlagID:    int64(1),
			VariantID: int64(1),
		}
		err := validateDeleteVariant(param)
		assert.NotZero(t, err)
	})
}