func (gen *PolicyGenerator) MakePolicyAndExternalData() (*lang.Policy, *external.Data) {
	gen.makeUserLabels()
	maxChainLen := gen.makeBundles()
	gen.makeServices()
	gen.makeRules()
	gen.makeClaims()
	gen.makeCluster()
	gen.externalData = external.NewData(
		newUserLoaderImpl(gen.users, gen.generatedUserLabels),
		newSecretLoaderImpl(),
	)
	fmt.Printf("Generated policy. Bundles = %d (max chain %d), Contexts = %d, Claims = %d, Users = %d\n",
		len(gen.policy.GetObjectsByKind(lang.TypeBundle.Kind)),
		maxChainLen,
		len(gen.policy.GetObjectsByKind(lang.TypeService.Kind))*gen.contextsPerService,
		len(gen.policy.GetObjectsByKind(lang.TypeClaim.Kind)),
		len(gen.externalData.UserLoader.LoadUsersAll().Users),
	)
	err := gen.policy.Validate()
	if err != nil {
		panic(err)
	}
	return gen.policy, gen.externalData
}
MakePolicyAndExternalData returns newly generated test policy and external data
package enginetest
import (
	"fmt"
	"math/rand"
	"strconv"
	"github.com/Aptomi/aptomi/pkg/external"
	"github.com/Aptomi/aptomi/pkg/lang"
	"github.com/Aptomi/aptomi/pkg/util"
)
type PolicyGenerator struct {
	random               *rand.Rand
	labels               int
	bundles              int
	bundleCodeComponents int
	codeParams           int
	bundleClaimMaxChain  int
	contextsPerService   int
	rules                int
	users                int
	claims               int
	generatedUserLabels map[string]string
	generatedLabelKeys  []string
	generatedBundles []*lang.Bundle
	policy           *lang.Policy
	externalData     *external.Data
}
func NewPolicyGenerator(randSeed int64, labels, bundles, bundleCodeComponents, codeParams, bundleClaimMaxChain, contextsPerService, rules, users, claims int) *PolicyGenerator {
	result := &PolicyGenerator{
		random:               rand.New(rand.NewSource(randSeed)),
		labels:               labels,
		bundles:              bundles,
		bundleCodeComponents: bundleCodeComponents,
		codeParams:           codeParams,
		bundleClaimMaxChain:  bundleClaimMaxChain,
		contextsPerService:   contextsPerService,
		rules:                rules,
		users:                users,
		claims:               claims,
		policy:               lang.NewPolicy(),
	}
	return result
}