Nexus chasm invocation task unit tests#9880
Conversation
7fbdb9f to
5be312b
Compare
344dd29 to
7e84525
Compare
978ec33 to
12007cf
Compare
7e84525 to
55fefd3
Compare
12007cf to
6ae06cc
Compare
f67e908 to
e5a6e08
Compare
2138a0e to
3206e99
Compare
e5a6e08 to
9a70a1e
Compare
9a70a1e to
a606551
Compare
| expectedMetricOutcome: "invalid-operation-token", | ||
| checkOutcome: func(t *testing.T, op *Operation, err error) { | ||
| require.NoError(t, err) | ||
| require.Equal(t, nexusoperationpb.OPERATION_STATUS_FAILED, op.Status) |
There was a problem hiding this comment.
Should we assert that the error is non-retryable?
| schedToStartTimeout time.Duration | ||
| destinationDown bool | ||
| endpointNotFound bool | ||
| noUpdateComponent bool // Set to true when the handler returns early without calling UpdateComponent. |
There was a problem hiding this comment.
seems like this is never true?
| require.NotNil(t, failure.Cause) | ||
| require.Equal(t, "cause", failure.Cause.Message) | ||
| require.NotNil(t, failure.Cause.GetApplicationFailureInfo()) | ||
| require.Equal(t, "NexusFailure", failure.Cause.GetApplicationFailureInfo().GetType()) |
There was a problem hiding this comment.
non-blocking: would a single equal check on the full failure be easier to read (and write)? it's nice because it's exhaustive. It doesn't always work but it seems here it would.
| { | ||
| name: "async start", | ||
| requestTimeout: time.Hour, | ||
| checkStartOperationOptions: func(t *testing.T, options nexus.StartOperationOptions) { |
There was a problem hiding this comment.
non-blocking: since this is the only use of this, could we fold these checks into onStartOperation and drop this field? I recognize that onStartOperation doesn't have testing.T, that could probably be added and still satisfy the nexustest AFAICT.
| schedToCloseTimeout time.Duration | ||
| startToCloseTimeout time.Duration | ||
| schedToStartTimeout time.Duration | ||
| destinationDown bool |
There was a problem hiding this comment.
I see it being set to true but not used?
| onStartOperation func(ctx context.Context, service, operation string, input *nexus.LazyValue, options nexus.StartOperationOptions) (nexus.HandlerStartOperationResult[any], error) | ||
| expectedMetricOutcome string | ||
| checkOutcome func(t *testing.T, op *Operation, err error) | ||
| requestTimeout time.Duration |
There was a problem hiding this comment.
why always set this one but not the other timeouts? Could use cmp.Or(tc.requestTimeout, time.Hour)
|
|
||
| var metricsHandler metrics.Handler | ||
| if tc.expectedMetricOutcome != "" { | ||
| mockMetrics := metrics.NewMockHandler(ctrl) |
There was a problem hiding this comment.
Could this be metricstest.NewCaptureHandler() instead? Might be slightly simpler/shorter.
d459b8a
into
temporalio:nexus/hsm-to-chasm-migration
## What changed? Port the invocation executor tests from `components/nexusoperations/executor_tests.go` to CHASM. ## Why? Test coverage was missing previously.
Port the invocation executor tests from `components/nexusoperations/executor_tests.go` to CHASM. Test coverage was missing previously.
What changed?
Port the invocation executor tests from
components/nexusoperations/executor_tests.goto CHASM.Why?
Test coverage was missing previously.