mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
## What changed? - Consolidate task ids into `writeTaskRequest` instead of separate slice. - Factor out some common code in `newPhysicalTaskQueueManager`. - Factor out `taskResponse.err()`. - Move code out of select in `getTasksPump`. - Add a `UseCassandraPersistence` test helper. - Remove some obsolete structs and functions. - Rename some test functions. - Update some comments. ## Why? These are a bunch of small changes from the fairness feature branch that can apply to main immediately, which will make reviewing/merging that branch easier. ## How did you test it? - [x] built - [x] run locally and tested manually - [x] covered by existing tests
38 lines
1.2 KiB
Go
38 lines
1.2 KiB
Go
package testcore
|
|
|
|
import (
|
|
"flag"
|
|
|
|
"go.temporal.io/server/common/config"
|
|
"go.temporal.io/server/common/persistence/sql/sqlplugin/mysql"
|
|
"go.temporal.io/server/common/persistence/sql/sqlplugin/postgresql"
|
|
"go.temporal.io/server/common/persistence/sql/sqlplugin/sqlite"
|
|
)
|
|
|
|
// cliFlags contains the feature flags for functional tests
|
|
var cliFlags struct {
|
|
persistenceType string
|
|
persistenceDriver string
|
|
enableFaultInjection string
|
|
}
|
|
|
|
func init() {
|
|
flag.StringVar(&cliFlags.persistenceType, "persistenceType", "sql", "type of persistence - [nosql or sql]")
|
|
flag.StringVar(&cliFlags.persistenceDriver, "persistenceDriver", "sqlite", "driver of nosql/sql - [cassandra, mysql8, postgres12, sqlite]")
|
|
flag.StringVar(&cliFlags.enableFaultInjection, "enableFaultInjection", "", "enable global fault injection")
|
|
}
|
|
|
|
func UseSQLVisibility() bool {
|
|
switch cliFlags.persistenceDriver {
|
|
case mysql.PluginName, postgresql.PluginName, postgresql.PluginNamePGX, sqlite.PluginName:
|
|
return true
|
|
// If the main storage is Cassandra, Elasticsearch is used for visibility.
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
func UseCassandraPersistence() bool {
|
|
return cliFlags.persistenceType == config.StoreTypeNoSQL && cliFlags.persistenceDriver == "cassandra"
|
|
}
|