diff --git a/pkg/plugins/cluster.go b/pkg/plugins/cluster.go index adfe03193..b737a86dd 100644 --- a/pkg/plugins/cluster.go +++ b/pkg/plugins/cluster.go @@ -132,6 +132,7 @@ func HandleTemplate(in *runtime.RawExtension, name, syncDir string) (types.Capab return types.Capability{}, err } cueTemplate = string(b) + tmp.CueTemplate = cueTemplate } else { if tmp.CueTemplate == "" { return types.Capability{}, errors.New("template not exist in definition") diff --git a/pkg/plugins/cluster_test.go b/pkg/plugins/cluster_test.go index bce583575..4cb57036b 100644 --- a/pkg/plugins/cluster_test.go +++ b/pkg/plugins/cluster_test.go @@ -107,6 +107,9 @@ var _ = Describe("DefinitionFiles", func() { Expect(err).Should(BeNil()) logf.Log.Info(fmt.Sprintf("Getting trait definitions %v", traitDefs)) for i := range traitDefs { + // CueTemplate should always be fulfilled, even those whose CueTemplateURI is assigend, + By("check CueTemplate is fulfilled") + Expect(traitDefs[i].CueTemplate).ShouldNot(BeEmpty()) traitDefs[i].CueTemplate = "" traitDefs[i].DefinitionPath = "" } @@ -120,6 +123,9 @@ var _ = Describe("DefinitionFiles", func() { Expect(err).Should(BeNil()) logf.Log.Info(fmt.Sprintf("Getting workload definitions %v", workloadDefs)) for i := range workloadDefs { + // CueTemplate should always be fulfilled, even those whose CueTemplateURI is assigend, + By("check CueTemplate is fulfilled") + Expect(workloadDefs[i].CueTemplate).ShouldNot(BeEmpty()) workloadDefs[i].CueTemplate = "" workloadDefs[i].DefinitionPath = "" }