Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
Signed-off-by: FogDong <[email protected]>
  • Loading branch information
FogDong committed Apr 27, 2024
1 parent f3b4133 commit 3b2ccc8
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
3 changes: 3 additions & 0 deletions e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/config"

"github.com/kubevela/pkg/util/singleton"
"github.com/kubevela/pkg/util/test/definition"

"github.com/kubevela/workflow/api/v1alpha1"
Expand Down Expand Up @@ -58,9 +59,11 @@ var k8sClient client.Client
var _ = BeforeSuite(func() {
conf, err := config.GetConfig()
Expect(err).Should(BeNil())
singleton.KubeConfig.Set(conf)

k8sClient, err = client.New(conf, client.Options{Scheme: scheme})
Expect(err).Should(BeNil())
singleton.KubeClient.Set(k8sClient)

prepareWorkflowDefinitions()
})
Expand Down
7 changes: 1 addition & 6 deletions pkg/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/kubevela/pkg/cue/cuex"
"github.com/kubevela/pkg/cue/util"
"github.com/kubevela/pkg/util/rand"
"github.com/kubevela/pkg/util/singleton"
Expand Down Expand Up @@ -198,11 +197,7 @@ func (wf *WorkflowContext) LoadFromConfigMap(ctx context.Context, cm corev1.Conf
}
data := cm.Data

var err error
wf.vars, err = cuex.DefaultCompiler.Get().CompileString(ctx, data[ConfigMapKeyVars])
if err != nil {
return errors.WithMessage(err, "decode vars")
}
wf.vars = cuecontext.New().CompileString(data[ConfigMapKeyVars])
return nil
}

Expand Down
1 change: 0 additions & 1 deletion pkg/providers/legacy/email/email.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ func Send(ctx context.Context, params *MailParams) (res *any, err error) {
emailRoutine.Store(id, "sending")
if err = dial.DialAndSend(m); err != nil {
emailRoutine.Store(id, err.Error())
fmt.Println("=========", err.Error())
return
}
emailRoutine.Store(id, "success")
Expand Down
3 changes: 2 additions & 1 deletion pkg/tasks/custom/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"github.com/kubevela/workflow/pkg/cue/model/value"
"github.com/kubevela/workflow/pkg/cue/process"
"github.com/kubevela/workflow/pkg/hooks"
"github.com/kubevela/workflow/pkg/providers"
providertypes "github.com/kubevela/workflow/pkg/providers/types"
"github.com/kubevela/workflow/pkg/types"
)
Expand Down Expand Up @@ -298,7 +299,7 @@ func buildValueForStatus(ctx wfContext.Context, step v1alpha1.WorkflowStep, step
// MakeBasicValue makes basic value
func MakeBasicValue(ctx monitorContext.Context, properties *runtime.RawExtension, pCtx process.Context) (cue.Value, error) {
// use default compiler to compile the basic value without providers
v, err := cuex.DefaultCompiler.Get().CompileStringWithOptions(ctx, getContextTemplate(pCtx), cuex.WithExtraData(
v, err := providers.Compiler.Get().CompileStringWithOptions(ctx, getContextTemplate(pCtx), cuex.WithExtraData(
model.ParameterFieldName, properties,
), cuex.DisableResolveProviderFunctions{})
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion pkg/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ type TaskGeneratorOptions struct {

// StepGeneratorOptions is the options for generate step.
type StepGeneratorOptions struct {
Compiler cuex.Compiler
ProcessCtx process.Context
TemplateLoader template.Loader
StepConvertor map[string]func(step v1alpha1.WorkflowStep) (v1alpha1.WorkflowStep, error)
Expand Down

0 comments on commit 3b2ccc8

Please sign in to comment.