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).
58 lines
1.4 KiB
Go
58 lines
1.4 KiB
Go
package clitest
|
|
|
|
import (
|
|
"net"
|
|
"strconv"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
"github.com/stretchr/testify/suite"
|
|
"github.com/hanzoai/tasks/common/config"
|
|
"github.com/hanzoai/tasks/temporal/environment"
|
|
"github.com/hanzoai/tasks/tools/sql"
|
|
)
|
|
|
|
type (
|
|
// HandlerTestSuite defines a test suite
|
|
HandlerTestSuite struct {
|
|
*require.Assertions // override suite.Suite.Assertions with require.Assertions; this means that s.NotNil(nil) will stop the test, not merely log an error
|
|
suite.Suite
|
|
host string
|
|
port string
|
|
pluginName string
|
|
}
|
|
)
|
|
|
|
// NewHandlerTestSuite returns a test suite
|
|
func NewHandlerTestSuite(
|
|
host string,
|
|
port string,
|
|
pluginName string,
|
|
) *HandlerTestSuite {
|
|
return &HandlerTestSuite{
|
|
host: host,
|
|
port: port,
|
|
pluginName: pluginName,
|
|
}
|
|
}
|
|
|
|
// SetupTest setups test
|
|
func (s *HandlerTestSuite) SetupTest() {
|
|
s.Assertions = require.New(s.T()) // Have to define our overridden assertions in the test setup. If we did it earlier, s.T() will return nil
|
|
}
|
|
|
|
// TestValidateConnectConfig test
|
|
func (s *HandlerTestSuite) TestValidateConnectConfig() {
|
|
cfg := new(config.SQL)
|
|
|
|
s.NotNil(sql.ValidateConnectConfig(cfg))
|
|
|
|
cfg.ConnectAddr = net.JoinHostPort(
|
|
environment.GetMySQLAddress(),
|
|
strconv.Itoa(environment.GetMySQLPort()),
|
|
)
|
|
s.NotNil(sql.ValidateConnectConfig(cfg))
|
|
|
|
cfg.DatabaseName = "foobar"
|
|
s.Nil(sql.ValidateConnectConfig(cfg))
|
|
}
|