Files
tasks/tests/flag.go
Alex ShtinandGitHub 3748b3eb75 Workflow Update: replace runtime.WaitGoRoutineWithFn with PollWorkflowExecution API (#6258)
## What changed?
<!-- Describe what has changed in this PR -->
Replace `runtime.WaitGoRoutineWithFn` with `PollWorkflowExecution` API
in Workflow Update functional tests.

## Why?
<!-- Tell your future self why have you made these changes -->
It turned out that `runtime.WaitGoRoutineWithFn` is not reliable. After
few iteration with improvements, I decided to take a different approach.
Update is sent in separate go routine and then `PollWorkflowExecution`
API call guarantees that update reached server and admitted.

As as side effect, go routine creation was moved from test code to
`sendUpdate*` helper funcs which makes test code cleaner.

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->
Run few times.
2024-07-10 16:47:31 +00:00

62 lines
2.7 KiB
Go

// The MIT License
//
// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.
//
// Copyright (c) 2020 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
package tests
import (
"flag"
"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"
)
// TestFlags contains the feature flags for functional tests
var TestFlags struct {
FrontendAddr string
FrontendHTTPAddr string
PersistenceType string
PersistenceDriver string
TestClusterConfigFile string
FaultInjectionConfigFile string
}
func init() {
flag.StringVar(&TestFlags.FrontendAddr, "frontendAddress", "", "host:port for temporal frontend service")
flag.StringVar(&TestFlags.FrontendHTTPAddr, "frontendHttpAddress", "", "host:port for temporal frontend HTTP service (only applies when frontendAddress set)")
flag.StringVar(&TestFlags.PersistenceType, "persistenceType", "sql", "type of persistence - [nosql or sql]")
flag.StringVar(&TestFlags.PersistenceDriver, "persistenceDriver", "sqlite", "driver of nosql/sql - [cassandra, mysql8, postgres12, sqlite]")
flag.StringVar(&TestFlags.TestClusterConfigFile, "TestClusterConfigFile", "", "test cluster config file location")
flag.StringVar(&TestFlags.FaultInjectionConfigFile, "FaultInjectionConfigFile", "", "fault injection config file location")
}
func UsingSQLAdvancedVisibility() bool {
switch TestFlags.PersistenceDriver {
case mysql.PluginName, postgresql.PluginName, postgresql.PluginNamePGX, sqlite.PluginName:
return true
default:
return false
}
}