mirror of
https://github.com/temporalio/temporal.git
synced 2026-08-30 18:41:49 -07:00
Propagate ComputeStatus to deployment workflow (#11273)
## What changed? Added a missing `d.syncSummary()` call in `syncVersionDataToComputeStatus`, so it now notifies the parent Deployment workflow after pulling a compute status from WCI. ## Why? Without this, the pull only updates the Version workflow's own state. The Deployment workflow (which `ListWorkerDeployments`/`DescribeWorkerDeployment` actually read from) is not updated, so `computeStatus` can stay permanently missing from the API even when the data is available. ## How did you test it? - [x] built - [x] run locally and tested manually - [ ] covered by existing tests - [ ] added new unit test(s) - [ ] added new functional test(s)
This commit is contained in:
@@ -40,6 +40,20 @@
|
||||
#matching.wv.VersionDrainageStatusRefreshInterval:
|
||||
# - value: 5s
|
||||
#
|
||||
### Compute config (Worker Controller Instance) coverage for the replay tester.
|
||||
### Required for the compute-config section of replaytester/worker/worker.go; without
|
||||
### `workercontroller.enabled` the CreateWorkerDeploymentVersion call with a compute
|
||||
### config is rejected and the version workflow never gets a non-nil ComputeConfig.
|
||||
#
|
||||
#workercontroller.enabled:
|
||||
# - value: true
|
||||
#workercontroller.compute_providers.enabled:
|
||||
# - value: ["test-invoke", "subprocess"] # leave unset to allow every registered provider
|
||||
#
|
||||
### Leave workercontroller.periodic_validation_interval_s at its 6h default. The driver populates
|
||||
### ComputeStatus by asking the WCI to re-validate its stored spec on demand, so it does not need
|
||||
### the periodic timer.
|
||||
#
|
||||
### END of Worker Versioning Replay Test configs
|
||||
|
||||
limit.maxIDLength:
|
||||
|
||||
2
go.mod
2
go.mod
@@ -67,7 +67,7 @@ require (
|
||||
go.opentelemetry.io/otel/sdk/metric v1.43.0
|
||||
go.opentelemetry.io/otel/trace v1.44.0
|
||||
go.temporal.io/api v1.63.5-0.20260803183639-0e1e8c485f37
|
||||
go.temporal.io/auto-scaled-workers v0.0.0-20260706201056-4320b34799ee
|
||||
go.temporal.io/auto-scaled-workers v0.0.0-20260728174133-979694be4176
|
||||
go.temporal.io/sdk v1.44.0
|
||||
go.uber.org/fx v1.24.0
|
||||
go.uber.org/goleak v1.3.0
|
||||
|
||||
4
go.sum
4
go.sum
@@ -481,8 +481,8 @@ go.opentelemetry.io/proto/slim/otlp/profiles/v1development v0.3.0 h1:CQvJSldHRUN
|
||||
go.opentelemetry.io/proto/slim/otlp/profiles/v1development v0.3.0/go.mod h1:xSQ+mEfJe/GjK1LXEyVOoSI1N9JV9ZI923X5kup43W4=
|
||||
go.temporal.io/api v1.63.5-0.20260803183639-0e1e8c485f37 h1:ZDICI5Hxc97YsjpE6/WREWkUqQ7qq+ntTH+IbOuTxNw=
|
||||
go.temporal.io/api v1.63.5-0.20260803183639-0e1e8c485f37/go.mod h1:SrlW2JMwVlDP4nRWSNznUFqnSHd+YeMDS1BkYo63HCQ=
|
||||
go.temporal.io/auto-scaled-workers v0.0.0-20260706201056-4320b34799ee h1:y6A65Iml06cR3CpxW2Zn8FQLjniPDTnN4jtr69UZxXI=
|
||||
go.temporal.io/auto-scaled-workers v0.0.0-20260706201056-4320b34799ee/go.mod h1:hhHijO9XRPIkAflLJJHix61M9FzbRPqk8fSydkcLkqw=
|
||||
go.temporal.io/auto-scaled-workers v0.0.0-20260728174133-979694be4176 h1:6AUglT8D3HsbOmV2zwwPpQOmxFXZN4NrMe6Z69n3fSc=
|
||||
go.temporal.io/auto-scaled-workers v0.0.0-20260728174133-979694be4176/go.mod h1:hhHijO9XRPIkAflLJJHix61M9FzbRPqk8fSydkcLkqw=
|
||||
go.temporal.io/sdk v1.44.0 h1:suitPDukX74rW3/N1FqvEbZTZVJJsxMKhv0KMa/j7pU=
|
||||
go.temporal.io/sdk v1.44.0/go.mod h1:vkApR12F9/Y8OR+hkxe7WyXQFuCX6clhzqnAk6rzDAM=
|
||||
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
# matching.PollerHistoryTTL=1s
|
||||
# matching.wv.VersionDrainageStatusVisibilityGracePeriod=5s
|
||||
# matching.wv.VersionDrainageStatusRefreshInterval=5s
|
||||
# workercontroller.enabled=true
|
||||
#
|
||||
# workercontroller.enabled is required by the compute-config section of worker/worker.go
|
||||
# (exerciseComputeConfig)
|
||||
#
|
||||
# Make sure you set deploymentWorkflowVersion correctly. It should be an integer instead of {WORKFLOW_VERSION} above.
|
||||
# If deploymentWorkflowVersion is set to i, run this script with v{i} as the argument. The argument instructs the script
|
||||
@@ -25,6 +29,8 @@
|
||||
|
||||
deploymentName="foo"
|
||||
version="1.0"
|
||||
# The compute-config-only version (created by exerciseComputeConfig in worker/worker.go)
|
||||
computeConfigVersion="2.0"
|
||||
|
||||
# Expected workflow counts - users can override these if their changes are expected to generate more workflows which will be true when a breaking change to
|
||||
# these workflows is introduced.
|
||||
@@ -66,7 +72,7 @@ download_workflow_chain() {
|
||||
# Use the working query method with TemporalNamespaceDivision
|
||||
echo " Getting the chain of CAN runs for this workflow using the TemporalNamespaceDivision query..."
|
||||
run_ids=$(temporal workflow list \
|
||||
--query "TemporalNamespaceDivision = \"TemporalWorkerDeployment\" AND WorkflowType = \"$workflow_type\"" \
|
||||
--query "TemporalNamespaceDivision = \"TemporalWorkerDeployment\" AND WorkflowType = \"$workflow_type\" AND WorkflowId = \"$workflow_id\"" \
|
||||
--output json | \
|
||||
jq -r '.[] | .execution.runId')
|
||||
|
||||
@@ -89,11 +95,19 @@ download_workflow_chain() {
|
||||
if [ -n "$run_id" ]; then
|
||||
echo " Downloading run $((run_index + 1))/$run_count: $run_id"
|
||||
|
||||
temporal workflow show \
|
||||
-w "$workflow_id" \
|
||||
-r "$run_id" \
|
||||
--output json | \
|
||||
gzip -9c > "$run_dir/replay_${workflow_name}_run_${run_id}.json.gz"
|
||||
# Write to a plain file first so the exit status is `workflow show`'s rather than
|
||||
# gzip's, then check it is non-empty.
|
||||
json_file="$run_dir/replay_${workflow_name}_run_${run_id}.json"
|
||||
if ! temporal workflow show -w "$workflow_id" -r "$run_id" --output json > "$json_file"; then
|
||||
echo " Failed to download history for $workflow_id run $run_id" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -s "$json_file" ]; then
|
||||
echo " Empty history downloaded for $workflow_id run $run_id" >&2
|
||||
exit 1
|
||||
fi
|
||||
gzip -9c < "$json_file" > "$json_file.gz"
|
||||
rm -f "$json_file"
|
||||
|
||||
((run_index++))
|
||||
fi
|
||||
@@ -115,6 +129,7 @@ echo "📁 Creating run directory: $run_dir"
|
||||
# Download all executions for both workflow types
|
||||
download_workflow_chain "temporal-sys-worker-deployment:$deploymentName" "worker_deployment_wf" "temporal-sys-worker-deployment-workflow" "$run_dir"
|
||||
download_workflow_chain "temporal-sys-worker-deployment-version:$deploymentName:$version" "worker_deployment_version_wf" "temporal-sys-worker-deployment-version-workflow" "$run_dir"
|
||||
download_workflow_chain "temporal-sys-worker-deployment-version:$deploymentName:$computeConfigVersion" "worker_deployment_version_wf" "temporal-sys-worker-deployment-version-workflow" "$run_dir"
|
||||
|
||||
echo ""
|
||||
echo "🎉 Complete! All workflow execution histories downloaded to $run_dir"
|
||||
@@ -140,3 +155,17 @@ ACTUAL_VERSION_WORKFLOWS=$version_files
|
||||
EOF
|
||||
|
||||
echo " 📝 Expected counts saved to: $run_dir/expected_counts.txt"
|
||||
|
||||
# A run whose actual counts don't match the expected ones would be checked in with an
|
||||
# expected_counts.txt that fails TestReplays immediately, so fail here instead.
|
||||
if [ "$deployment_files" -ne "$EXPECTED_DEPLOYMENT_WORKFLOWS" ] || [ "$version_files" -ne "$EXPECTED_VERSION_WORKFLOWS" ]; then
|
||||
echo "" >&2
|
||||
echo "❌ Workflow counts do not match the expected values." >&2
|
||||
echo " Expected: Deployment=$EXPECTED_DEPLOYMENT_WORKFLOWS, Version=$EXPECTED_VERSION_WORKFLOWS" >&2
|
||||
echo " Actual: Deployment=$deployment_files, Version=$version_files" >&2
|
||||
echo "" >&2
|
||||
echo " If the new counts are correct for your change, re-run with:" >&2
|
||||
echo " EXPECTED_DEPLOYMENT_WORKFLOWS=$deployment_files EXPECTED_VERSION_WORKFLOWS=$version_files $0 $1" >&2
|
||||
echo " Otherwise your change created extra workflow executions; investigate before checking in." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
6
service/worker/workerdeployment/replaytester/testdata/v2/run_1785380013/expected_counts.txt
vendored
Normal file
6
service/worker/workerdeployment/replaytester/testdata/v2/run_1785380013/expected_counts.txt
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
# Expected workflow counts for replay testing
|
||||
# Generated by generate_history.sh on Wed Jul 29 19:53:35 PDT 2026
|
||||
EXPECTED_DEPLOYMENT_WORKFLOWS=23
|
||||
EXPECTED_VERSION_WORKFLOWS=14
|
||||
ACTUAL_DEPLOYMENT_WORKFLOWS=23
|
||||
ACTUAL_VERSION_WORKFLOWS=14
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6
service/worker/workerdeployment/replaytester/testdata/v2/run_1785380306/expected_counts.txt
vendored
Normal file
6
service/worker/workerdeployment/replaytester/testdata/v2/run_1785380306/expected_counts.txt
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
# Expected workflow counts for replay testing
|
||||
# Generated by generate_history.sh on Wed Jul 29 19:58:28 PDT 2026
|
||||
EXPECTED_DEPLOYMENT_WORKFLOWS=24
|
||||
EXPECTED_VERSION_WORKFLOWS=14
|
||||
ACTUAL_DEPLOYMENT_WORKFLOWS=24
|
||||
ACTUAL_VERSION_WORKFLOWS=14
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,13 +5,39 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
commonpb "go.temporal.io/api/common/v1"
|
||||
computepb "go.temporal.io/api/compute/v1"
|
||||
deploymentpb "go.temporal.io/api/deployment/v1"
|
||||
enumspb "go.temporal.io/api/enums/v1"
|
||||
"go.temporal.io/api/workflowservice/v1"
|
||||
"go.temporal.io/sdk/client"
|
||||
"go.temporal.io/sdk/converter"
|
||||
"go.temporal.io/sdk/worker"
|
||||
"go.temporal.io/sdk/workflow"
|
||||
"go.temporal.io/server/service/worker/workerdeployment/replaytester"
|
||||
)
|
||||
|
||||
// computeProviderType is the WCI compute provider used for the compute-config part of this
|
||||
// driver.
|
||||
const computeProviderType = "test-invoke"
|
||||
|
||||
// computeScalerType specifies the scaler type for the compute configuration
|
||||
const computeScalerType = "no-sync"
|
||||
|
||||
// newScalingGroup builds a scaling group backed by the local test provider.
|
||||
func newScalingGroup(note string, taskTypes ...enumspb.TaskQueueType) *computepb.ComputeConfigScalingGroup {
|
||||
return &computepb.ComputeConfigScalingGroup{
|
||||
TaskQueueTypes: taskTypes,
|
||||
Provider: &computepb.ComputeProvider{
|
||||
Type: computeProviderType,
|
||||
Details: encodeProviderDetails(map[string]any{"note": note}),
|
||||
},
|
||||
Scaler: &computepb.ComputeScaler{
|
||||
Type: computeScalerType,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
// The client and worker are heavyweight objects that should be created once per process.
|
||||
c, err := client.Dial(client.Options{})
|
||||
@@ -23,6 +49,8 @@ func main() {
|
||||
identity := "test-identity"
|
||||
deploymentName := "foo"
|
||||
build1 := "1.0"
|
||||
// build2 is never polled by a worker; it exists only to contain a compute config.
|
||||
build2 := "2.0"
|
||||
v1 := worker.WorkerDeploymentVersion{
|
||||
DeploymentName: deploymentName,
|
||||
BuildID: build1,
|
||||
@@ -183,6 +211,10 @@ func main() {
|
||||
// Make sure 1.0 is drained.
|
||||
verifyDeployment(dHandle, "", "", 0, client.WorkerDeploymentVersionDrainageStatusDrained)
|
||||
|
||||
// Exercise the compute config (Worker Controller Instance) paths. Requires
|
||||
// `workercontroller.enabled: true` in config/dynamicconfig/development-sql.yaml.
|
||||
exerciseComputeConfig(c, deploymentName, build2, identity)
|
||||
|
||||
// Stopping both workers
|
||||
w1.Stop()
|
||||
w2.Stop()
|
||||
@@ -200,6 +232,17 @@ func main() {
|
||||
log.Fatalf("Unable to delete version: %v", err)
|
||||
}
|
||||
|
||||
// Delete the compute-config version. This also tears down its Worker Controller
|
||||
// Instance from inside the version workflow.
|
||||
_, err = dHandle.DeleteVersion(context.Background(), client.WorkerDeploymentDeleteVersionOptions{
|
||||
BuildID: build2,
|
||||
SkipDrainage: true,
|
||||
Identity: identity,
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to delete version %s: %v", build2, err)
|
||||
}
|
||||
|
||||
// Delete the deployment
|
||||
_, err = deploymentClient.Delete(context.Background(), client.WorkerDeploymentDeleteOptions{
|
||||
Name: deploymentName,
|
||||
@@ -211,6 +254,151 @@ func main() {
|
||||
|
||||
}
|
||||
|
||||
// exerciseComputeConfig drives the compute config paths of the version and deployment
|
||||
// workflows so the captured histories cover them.
|
||||
//
|
||||
// In the version workflow this covers:
|
||||
// - starting with a non-nil VersionLocalState.ComputeConfig, which satisfies the
|
||||
// `ComputeConfig != nil` guard.
|
||||
// - the SignalSyncValidationStatus handler, which sets ComputeStatus and then signals the
|
||||
// deployment workflow via syncSummary.
|
||||
// - handleUpdateVersionComputeConfig, which also calls syncSummary.
|
||||
// - ValidateComputeConfig, both as a dry-run of proposed changes and as a re-validation of
|
||||
// the stored spec.
|
||||
// - the DescribeWorkerControllerInstanceStatus pull inside syncVersionDataToComputeStatus
|
||||
// returning a non-nil ProviderValidation
|
||||
//
|
||||
// In the deployment workflow this covers handleCreateWorkerDeploymentVersion's WCI creation
|
||||
// and the SyncVersionSummary signals arriving from the version workflow.
|
||||
//
|
||||
// After regenerating, confirm the new version-workflow history still contains a
|
||||
// "sync-compute-status-to-deployment" Version marker followed by a sync-version-summary signal;
|
||||
// if it does not, that fixture does not cover the pull path.
|
||||
//
|
||||
//nolint:revive
|
||||
func exerciseComputeConfig(c client.Client, deploymentName, buildID, identity string) {
|
||||
version := &deploymentpb.WorkerDeploymentVersion{
|
||||
DeploymentName: deploymentName,
|
||||
BuildId: buildID,
|
||||
}
|
||||
|
||||
// Create the version with a compute config. This creates the WCI first, then starts the
|
||||
// version workflow with the resulting ComputeConfigSummary in its initial state.
|
||||
_, err := c.WorkflowService().CreateWorkerDeploymentVersion(context.Background(), &workflowservice.CreateWorkerDeploymentVersionRequest{
|
||||
Namespace: client.DefaultNamespace,
|
||||
DeploymentVersion: version,
|
||||
ComputeConfig: &computepb.ComputeConfig{
|
||||
ScalingGroups: map[string]*computepb.ComputeConfigScalingGroup{
|
||||
"group1": newScalingGroup("replaytester-group1", enumspb.TASK_QUEUE_TYPE_WORKFLOW),
|
||||
},
|
||||
},
|
||||
Identity: identity,
|
||||
RequestId: "replaytester-create-version-" + buildID,
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to create version %s with a compute config (is workercontroller.enabled set?): %v", buildID, err)
|
||||
}
|
||||
|
||||
// Dry-run validation of a proposed scaling group: exercises ValidateComputeConfig without
|
||||
// mutating the stored spec. Does not set ValidationStatus.
|
||||
_, err = c.WorkflowService().ValidateWorkerDeploymentVersionComputeConfig(context.Background(), &workflowservice.ValidateWorkerDeploymentVersionComputeConfigRequest{
|
||||
Namespace: client.DefaultNamespace,
|
||||
DeploymentVersion: version,
|
||||
ComputeConfigScalingGroups: map[string]*computepb.ComputeConfigScalingGroupUpdate{
|
||||
"dry-run-group": {
|
||||
ScalingGroup: newScalingGroup("replaytester-dry-run", enumspb.TASK_QUEUE_TYPE_ACTIVITY),
|
||||
},
|
||||
},
|
||||
Identity: identity,
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to dry-run validate compute config for version %s: %v", buildID, err)
|
||||
}
|
||||
|
||||
// Re-validate the stored spec by sending no changes. This is the path that sets
|
||||
// ValidationStatus on the WCI and signals the version workflow, which sets ComputeStatus and
|
||||
// calls syncSummary.
|
||||
_, err = c.WorkflowService().ValidateWorkerDeploymentVersionComputeConfig(context.Background(), &workflowservice.ValidateWorkerDeploymentVersionComputeConfigRequest{
|
||||
Namespace: client.DefaultNamespace,
|
||||
DeploymentVersion: version,
|
||||
Identity: identity,
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to re-validate the stored compute config for version %s "+
|
||||
"(does the pinned temporal-auto-scaled-workers include PR #99?): %v", buildID, err)
|
||||
}
|
||||
|
||||
// Wait for the validation signal to land, so the captured history contains the ComputeStatus
|
||||
// update and the syncSummary it triggers.
|
||||
waitForComputeStatus(c, version)
|
||||
|
||||
// Add a second scaling group, exercising handleUpdateVersionComputeConfig.
|
||||
_, err = c.WorkflowService().UpdateWorkerDeploymentVersionComputeConfig(context.Background(), &workflowservice.UpdateWorkerDeploymentVersionComputeConfigRequest{
|
||||
Namespace: client.DefaultNamespace,
|
||||
DeploymentVersion: version,
|
||||
ComputeConfigScalingGroups: map[string]*computepb.ComputeConfigScalingGroupUpdate{
|
||||
"group2": {
|
||||
ScalingGroup: newScalingGroup("replaytester-group2", enumspb.TASK_QUEUE_TYPE_ACTIVITY),
|
||||
},
|
||||
},
|
||||
Identity: identity,
|
||||
RequestId: "replaytester-update-compute-config-" + buildID,
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to update compute config for version %s: %v", buildID, err)
|
||||
}
|
||||
|
||||
// Remove the group we just added, exercising the removal branch of the same handler.
|
||||
_, err = c.WorkflowService().UpdateWorkerDeploymentVersionComputeConfig(context.Background(), &workflowservice.UpdateWorkerDeploymentVersionComputeConfigRequest{
|
||||
Namespace: client.DefaultNamespace,
|
||||
DeploymentVersion: version,
|
||||
RemoveComputeConfigScalingGroups: []string{"group2"},
|
||||
Identity: identity,
|
||||
RequestId: "replaytester-remove-compute-config-" + buildID,
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to remove compute config scaling group for version %s: %v", buildID, err)
|
||||
}
|
||||
}
|
||||
|
||||
// waitForComputeStatus polls DescribeWorkerDeployment until the version's ComputeStatus shows
|
||||
// up in the deployment workflow's version summary.
|
||||
//
|
||||
//nolint:revive
|
||||
func waitForComputeStatus(c client.Client, version *deploymentpb.WorkerDeploymentVersion) {
|
||||
log.Printf("Waiting for compute status to propagate to the deployment workflow for version %s...", version.GetBuildId())
|
||||
for range 40 {
|
||||
resp, err := c.WorkflowService().DescribeWorkerDeployment(context.Background(), &workflowservice.DescribeWorkerDeploymentRequest{
|
||||
Namespace: client.DefaultNamespace,
|
||||
DeploymentName: version.GetDeploymentName(),
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to describe deployment %s: %v", version.GetDeploymentName(), err)
|
||||
}
|
||||
for _, summary := range resp.GetWorkerDeploymentInfo().GetVersionSummaries() {
|
||||
if summary.GetDeploymentVersion().GetBuildId() != version.GetBuildId() {
|
||||
continue
|
||||
}
|
||||
if summary.GetComputeStatus().GetProviderValidation() != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
}
|
||||
log.Fatalf("Timed out waiting for compute status to propagate to the deployment workflow for version %s", version.GetBuildId())
|
||||
}
|
||||
|
||||
// encodeProviderDetails encodes provider-specific config the way the server decodes it
|
||||
//
|
||||
//nolint:revive
|
||||
func encodeProviderDetails(details map[string]any) *commonpb.Payload {
|
||||
p, err := converter.GetDefaultDataConverter().ToPayload(details)
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to encode compute provider details: %v", err)
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
//nolint:revive
|
||||
func verifyDeployment(dHandle client.WorkerDeploymentHandle,
|
||||
expectedCurrentVersionBuildId string,
|
||||
|
||||
@@ -1268,6 +1268,9 @@ func (d *VersionWorkflowRunner) syncVersionDataToComputeStatus(ctx workflow.Cont
|
||||
logger.Error("failed to sync compute status", "error", err)
|
||||
} else if result.ProviderValidation != nil {
|
||||
state.ComputeStatus = &result
|
||||
if workflow.GetVersion(ctx, "sync-compute-status-to-deployment", workflow.DefaultVersion, 0) >= 0 {
|
||||
d.syncSummary(ctx) // propagate updated ComputeStatus to deployment workflow
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1189,6 +1189,12 @@ func (s *DeploymentVersionSuite) TestUpdateVersionMetadata() {
|
||||
s.Equal(metadataIdentity, resp.GetWorkerDeploymentVersionInfo().GetLastModifierIdentity())
|
||||
}
|
||||
|
||||
// testInvokeScaler returns the scaler that scaling groups backed by the test-invoke compute
|
||||
// provider must declare.
|
||||
func testInvokeScaler() *computepb.ComputeScaler {
|
||||
return &computepb.ComputeScaler{Type: "no-sync"}
|
||||
}
|
||||
|
||||
func (s *DeploymentVersionSuite) createDeploymentAndVersion(
|
||||
env *testcore.TestEnv,
|
||||
tv *testvars.TestVars,
|
||||
@@ -1228,7 +1234,7 @@ func (s *DeploymentVersionSuite) TestUpdateComputeConfig_Success() {
|
||||
|
||||
s.createDeploymentAndVersion(env, env.Tv(), createIdentity, &computepb.ComputeConfig{
|
||||
ScalingGroups: map[string]*computepb.ComputeConfigScalingGroup{
|
||||
"sg1": {Provider: validProvider},
|
||||
"sg1": {Provider: validProvider, Scaler: testInvokeScaler()},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1242,6 +1248,7 @@ func (s *DeploymentVersionSuite) TestUpdateComputeConfig_Success() {
|
||||
ScalingGroup: &computepb.ComputeConfigScalingGroup{
|
||||
TaskQueueTypes: []enumspb.TaskQueueType{enumspb.TASK_QUEUE_TYPE_ACTIVITY},
|
||||
Provider: validProvider,
|
||||
Scaler: testInvokeScaler(),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1259,10 +1266,11 @@ func (s *DeploymentVersionSuite) TestUpdateComputeConfig_Success() {
|
||||
a.Equal(updateIdentity, info.GetLastModifierIdentity())
|
||||
a.True(proto.Equal(&computepb.ComputeConfig{
|
||||
ScalingGroups: map[string]*computepb.ComputeConfigScalingGroup{
|
||||
"sg1": {Provider: validProvider},
|
||||
"sg1": {Provider: validProvider, Scaler: testInvokeScaler()},
|
||||
"sg2": {
|
||||
TaskQueueTypes: []enumspb.TaskQueueType{enumspb.TASK_QUEUE_TYPE_ACTIVITY},
|
||||
Provider: validProvider,
|
||||
Scaler: testInvokeScaler(),
|
||||
},
|
||||
},
|
||||
}, info.GetComputeConfig()))
|
||||
@@ -1335,6 +1343,7 @@ func (s *DeploymentVersionSuite) TestUpdateComputeConfig_UpdateExistingGroup() {
|
||||
"sg1": {
|
||||
TaskQueueTypes: []enumspb.TaskQueueType{enumspb.TASK_QUEUE_TYPE_WORKFLOW},
|
||||
Provider: validProvider,
|
||||
Scaler: testInvokeScaler(),
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -1366,6 +1375,7 @@ func (s *DeploymentVersionSuite) TestUpdateComputeConfig_UpdateExistingGroup() {
|
||||
"sg1": {
|
||||
TaskQueueTypes: []enumspb.TaskQueueType{enumspb.TASK_QUEUE_TYPE_ACTIVITY},
|
||||
Provider: validProvider,
|
||||
Scaler: testInvokeScaler(),
|
||||
},
|
||||
},
|
||||
}, descResp.GetWorkerDeploymentVersionInfo().GetComputeConfig()))
|
||||
@@ -1378,10 +1388,11 @@ func (s *DeploymentVersionSuite) TestUpdateComputeConfig_RemoveScalingGroup() {
|
||||
|
||||
s.createDeploymentAndVersion(env, env.Tv(), env.Tv().Any().String(), &computepb.ComputeConfig{
|
||||
ScalingGroups: map[string]*computepb.ComputeConfigScalingGroup{
|
||||
"sg1": {Provider: validProvider},
|
||||
"sg1": {Provider: validProvider, Scaler: testInvokeScaler()},
|
||||
"sg2": {
|
||||
TaskQueueTypes: []enumspb.TaskQueueType{enumspb.TASK_QUEUE_TYPE_ACTIVITY},
|
||||
Provider: validProvider,
|
||||
Scaler: testInvokeScaler(),
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -1406,6 +1417,7 @@ func (s *DeploymentVersionSuite) TestUpdateComputeConfig_RemoveScalingGroup() {
|
||||
"sg2": {
|
||||
TaskQueueTypes: []enumspb.TaskQueueType{enumspb.TASK_QUEUE_TYPE_ACTIVITY},
|
||||
Provider: validProvider,
|
||||
Scaler: testInvokeScaler(),
|
||||
},
|
||||
},
|
||||
}, descResp.GetWorkerDeploymentVersionInfo().GetComputeConfig()))
|
||||
@@ -1445,7 +1457,7 @@ func (s *DeploymentVersionSuite) TestUpdateComputeConfig_InvalidProvider() {
|
||||
env := s.newTestEnv()
|
||||
s.createDeploymentAndVersion(env, env.Tv(), env.Tv().Any().String(), &computepb.ComputeConfig{
|
||||
ScalingGroups: map[string]*computepb.ComputeConfigScalingGroup{
|
||||
"sg1": {Provider: computeprovider.TestInvokeComputeProviderValidComputeProvider()},
|
||||
"sg1": {Provider: computeprovider.TestInvokeComputeProviderValidComputeProvider(), Scaler: testInvokeScaler()},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1529,6 +1541,7 @@ func (s *DeploymentVersionSuite) TestValidateComputeConfig_Valid() {
|
||||
"sg1": {
|
||||
ScalingGroup: &computepb.ComputeConfigScalingGroup{
|
||||
Provider: computeprovider.TestInvokeComputeProviderValidComputeProvider(),
|
||||
Scaler: testInvokeScaler(),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1583,6 +1596,7 @@ func (s *DeploymentVersionSuite) TestValidateComputeConfig_VersionNotFound() {
|
||||
"sg1": {
|
||||
ScalingGroup: &computepb.ComputeConfigScalingGroup{
|
||||
Provider: computeprovider.TestInvokeComputeProviderValidComputeProvider(),
|
||||
Scaler: testInvokeScaler(),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -3093,6 +3107,7 @@ func (s *DeploymentVersionSuite) TestCreateWorkerDeploymentVersion_Success() {
|
||||
ScalingGroups: map[string]*computepb.ComputeConfigScalingGroup{
|
||||
"sg1": {
|
||||
Provider: computeprovider.TestInvokeComputeProviderValidComputeProvider(),
|
||||
Scaler: testInvokeScaler(),
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -3413,6 +3428,7 @@ func (s *DeploymentVersionSuite) TestCreateWorkerDeploymentVersion_MultipleVersi
|
||||
ScalingGroups: map[string]*computepb.ComputeConfigScalingGroup{
|
||||
"sg1": {
|
||||
Provider: computeprovider.TestInvokeComputeProviderValidComputeProvider(),
|
||||
Scaler: testInvokeScaler(),
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -3420,6 +3436,7 @@ func (s *DeploymentVersionSuite) TestCreateWorkerDeploymentVersion_MultipleVersi
|
||||
ScalingGroups: map[string]*computepb.ComputeConfigScalingGroup{
|
||||
"sg2": {
|
||||
Provider: computeprovider.TestInvokeComputeProviderValidComputeProvider(),
|
||||
Scaler: testInvokeScaler(),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user