You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by kl...@apache.org on 2024/04/26 08:07:07 UTC
(incubator-devlake) 01/01: fix: e2e test
This is an automated email from the ASF dual-hosted git repository.
klesh pushed a commit to branch kw-jira-issue-and-changlog-incr-mode
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
commit a38ba63421983859713f78f35bd9a0a45a6432be
Author: Klesh Wong <zh...@merico.dev>
AuthorDate: Fri Apr 26 15:59:41 2024 +0800
fix: e2e test
---
backend/helpers/e2ehelper/data_flow_tester.go | 5 ++++-
backend/impls/context/default_subtask_context.go | 6 ++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/backend/helpers/e2ehelper/data_flow_tester.go b/backend/helpers/e2ehelper/data_flow_tester.go
index 3df847f52..fd6c80a0a 100644
--- a/backend/helpers/e2ehelper/data_flow_tester.go
+++ b/backend/helpers/e2ehelper/data_flow_tester.go
@@ -37,6 +37,7 @@ import (
"github.com/apache/incubator-devlake/core/dal"
"github.com/apache/incubator-devlake/core/errors"
"github.com/apache/incubator-devlake/core/log"
+ "github.com/apache/incubator-devlake/core/models"
"github.com/apache/incubator-devlake/core/plugin"
"github.com/apache/incubator-devlake/core/runner"
"github.com/apache/incubator-devlake/core/utils"
@@ -116,6 +117,7 @@ func NewDataFlowTester(t *testing.T, pluginName string, pluginMeta plugin.Plugin
// grant all on lake_test.* to 'merico'@'%';
panic(err)
}
+ errors.Must(db.AutoMigrate(&models.SubtaskState{}))
df := &DataFlowTester{
Cfg: cfg,
Db: db,
@@ -215,6 +217,7 @@ func (t *DataFlowTester) FlushTabler(dst schema.Tabler) {
// Subtask executes specified subtasks
func (t *DataFlowTester) Subtask(subtaskMeta plugin.SubTaskMeta, taskData interface{}) {
+ t.FlushTabler(&models.SubtaskState{})
subtaskCtx := t.SubtaskContext(taskData)
err := subtaskMeta.EntryPoint(subtaskCtx)
if err != nil {
@@ -224,7 +227,7 @@ func (t *DataFlowTester) Subtask(subtaskMeta plugin.SubTaskMeta, taskData interf
// SubtaskContext creates a subtask context
func (t *DataFlowTester) SubtaskContext(taskData interface{}) plugin.SubTaskContext {
- return contextimpl.NewStandaloneSubTaskContext(context.Background(), runner.CreateBasicRes(t.Cfg, t.Log, t.Db), t.Name, taskData)
+ return contextimpl.NewStandaloneSubTaskContext(context.Background(), runner.CreateBasicRes(t.Cfg, t.Log, t.Db), t.Name, taskData, t.Name)
}
func filterColumn(column dal.ColumnMeta, opts TableOptions) bool {
diff --git a/backend/impls/context/default_subtask_context.go b/backend/impls/context/default_subtask_context.go
index 2ce5ad68f..972001352 100644
--- a/backend/impls/context/default_subtask_context.go
+++ b/backend/impls/context/default_subtask_context.go
@@ -19,9 +19,10 @@ package context
import (
gocontext "context"
+ "time"
+
"github.com/apache/incubator-devlake/core/context"
"github.com/apache/incubator-devlake/core/plugin"
- "time"
)
// DefaultSubTaskContext is default implementation
@@ -67,10 +68,11 @@ func NewStandaloneSubTaskContext(
basicRes context.BasicRes,
name string,
data interface{},
+ pluginName string,
) plugin.SubTaskContext {
return &DefaultSubTaskContext{
newDefaultExecContext(ctx, basicRes, name, data, nil),
- nil,
+ &DefaultTaskContext{defaultExecContext: newDefaultExecContext(ctx, basicRes, pluginName, data, nil)},
time.Time{},
}
}