Files
tasks/tools/sql/clitest/update_task_tests.go
zeekay 5a601d081b rebrand: go.temporal.io/server -> github.com/hanzoai/tasks
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).
2026-03-19 10:36:40 -07:00

93 lines
2.7 KiB
Go

package clitest
import (
"path/filepath"
"github.com/hanzoai/tasks/common/log/tag"
"github.com/hanzoai/tasks/tools/common/schema/test"
"github.com/hanzoai/tasks/tools/sql"
)
// UpdateSchemaTestSuite defines a test suite
type UpdateSchemaTestSuite struct {
test.UpdateSchemaTestBase
host string
port string
pluginName string
sqlQuery string
executionSchemaVersionDir string
executionVersion string
visibilitySchemaVersionDir string
visibilityVersion string
}
// NewUpdateSchemaTestSuite returns a test suite
func NewUpdateSchemaTestSuite(
host string,
port string,
pluginName string,
sqlQuery string,
executionSchemaVersionDir string,
executionVersion string,
visibilitySchemaVersionDir string,
visibilityVersion string,
) *UpdateSchemaTestSuite {
return &UpdateSchemaTestSuite{
host: host,
port: port,
pluginName: pluginName,
sqlQuery: sqlQuery,
executionSchemaVersionDir: executionSchemaVersionDir,
executionVersion: executionVersion,
visibilitySchemaVersionDir: visibilitySchemaVersionDir,
visibilityVersion: visibilityVersion,
}
}
// SetupSuite setups test suite
func (s *UpdateSchemaTestSuite) SetupSuite() {
conn, err := newTestConn("", s.host, s.port, s.pluginName)
if err != nil {
s.Logger.Fatal("Error creating CQLClient", tag.Error(err))
}
s.SetupSuiteBase(conn, s.pluginName, test.ConnectParams{
Host: s.host,
Port: s.port,
User: testUser,
Password: testPassword,
})
}
// TearDownSuite tear down test suite
func (s *UpdateSchemaTestSuite) TearDownSuite() {
s.TearDownSuiteBase()
}
// TestUpdateSchema test
func (s *UpdateSchemaTestSuite) TestUpdateSchema() {
conn, err := newTestConn(s.DBName, s.host, s.port, s.pluginName)
s.Nil(err)
defer conn.Close()
s.RunUpdateSchemaTest(sql.BuildCLIOptions(), conn, "--db", s.sqlQuery, []string{"executions", "current_executions"})
}
// TestDryrun test
func (s *UpdateSchemaTestSuite) TestDryrun() {
conn, err := newTestConn(s.DBName, s.host, s.port, s.pluginName)
s.NoError(err)
defer conn.Close()
dir, err := filepath.Abs(s.executionSchemaVersionDir)
s.NoError(err)
s.RunDryrunTest(sql.BuildCLIOptions(), conn, "--db", dir, s.executionVersion)
}
// TestVisibilityDryrun test
func (s *UpdateSchemaTestSuite) TestVisibilityDryrun() {
conn, err := newTestConn(s.DBName, s.host, s.port, s.pluginName)
s.NoError(err)
defer conn.Close()
dir, err := filepath.Abs(s.visibilitySchemaVersionDir)
s.NoError(err)
s.RunDryrunTest(sql.BuildCLIOptions(), conn, "--db", dir, s.visibilityVersion)
}