mirror of
https://github.com/hanzoai/tasks.git
synced 2026-11-03 03:56:04 +00:00
Full module path rebrand from Temporal to Hanzo Tasks: - go.mod module: github.com/hanzoai/tasks - All internal Go imports updated (1906 files) - cmd/server renamed to cmd/tasksd - Binary name: tasksd (was temporal-server) - Docker images: hanzoai/tasks (was temporalio/server) - README rewritten with Hanzo Tasks branding - LLM.md created with integration notes - Makefile, goreleaser, CI workflows updated - go.temporal.io/sdk and go.temporal.io/api imports preserved (separate repos) Fork of Temporal.io (MIT license).
43 lines
1.2 KiB
Go
43 lines
1.2 KiB
Go
package scheduler_test
|
|
|
|
import (
|
|
"compress/gzip"
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
"go.temporal.io/sdk/client"
|
|
"go.temporal.io/sdk/worker"
|
|
"go.temporal.io/sdk/workflow"
|
|
"github.com/hanzoai/tasks/common/log"
|
|
"github.com/hanzoai/tasks/service/worker/scheduler"
|
|
)
|
|
|
|
// TestReplays tests workflow logic backwards compatibility from previous versions.
|
|
// Whenever there's a change in logic, consider capturing a new history with the
|
|
// testdata/generate_history.sh script and checking it in.
|
|
func TestReplays(t *testing.T) {
|
|
replayer := worker.NewWorkflowReplayer()
|
|
replayer.RegisterWorkflowWithOptions(scheduler.SchedulerWorkflow, workflow.RegisterOptions{Name: scheduler.WorkflowType})
|
|
|
|
files, err := filepath.Glob("testdata/replay_*.json.gz")
|
|
require.NoError(t, err)
|
|
|
|
logger := log.NewSdkLogger(log.NewTestLogger())
|
|
|
|
for _, filename := range files {
|
|
logger.Info("Replaying", "file", filename)
|
|
f, err := os.Open(filename)
|
|
require.NoError(t, err)
|
|
r, err := gzip.NewReader(f)
|
|
require.NoError(t, err)
|
|
history, err := client.HistoryFromJSON(r, client.HistoryJSONOptions{})
|
|
require.NoError(t, err)
|
|
err = replayer.ReplayWorkflowHistory(logger, history)
|
|
require.NoError(t, err)
|
|
_ = r.Close()
|
|
_ = f.Close()
|
|
}
|
|
}
|