Skip to content

Fix integration test failures - support runtime expressions and fix validation#267

Merged
ricardozanini merged 5 commits into
serverlessworkflow:mainfrom
ricardozanini:fix-it-tests
Jun 27, 2026
Merged

Fix integration test failures - support runtime expressions and fix validation#267
ricardozanini merged 5 commits into
serverlessworkflow:mainfrom
ricardozanini:fix-it-tests

Conversation

@ricardozanini

Copy link
Copy Markdown
Member

Summary

Fixes all 11 failing integration test workflows by addressing three distinct issues in the SDK.

Issues Fixed

1. PullPolicy Validation Error (9 workflows) ✅

Problem: The pullPolicy field validation was missing omitempty, causing validation failures when the field was omitted (empty string).

Fix: Added omitempty to validation tag in model/task_run.go:

PullPolicy string `validate:"omitempty,oneof=ifNotPresent always never"`

Affected workflows:

  • run-container.yaml
  • run-container-stdin-and-arguments.yaml
  • run-return-none.yaml
  • run-return-code.yaml
  • run-container-with-name.yaml
  • run-return-all.yaml
  • run-container-cleanup-eventually.yaml
  • run-container-cleanup-always.yaml
  • run-return-stderr.yaml

2. SetTask Runtime Expression Support (1 workflow) ✅

Problem: The Set field was typed as map[string]interface{}, preventing runtime expressions like ${ $workflow.input[0] } from being parsed.

Fix: Changed Set field type to *ObjectOrRuntimeExpr in model/task_set.go:

Set *ObjectOrRuntimeExpr `validate:"required,object_or_runtime_expr"`

Affected workflow: set-expression.yaml

3. HTTPArguments Headers/Query Runtime Expression Support (1 workflow) ✅

Problem: The headers and query fields were typed as maps, preventing runtime expressions like ${.headers} from being used.

Fix: Changed field types to *ObjectOrRuntimeExpr in model/task_call.go:

Headers *ObjectOrRuntimeExpr `validate:"omitempty,object_or_runtime_expr"`
Query   *ObjectOrRuntimeExpr `validate:"omitempty,object_or_runtime_expr"`

Affected workflow: call-http-query-headers-expressions.yaml

Technical Changes

Core Model Updates

  • model/task_run.go - Fixed PullPolicy validation
  • model/task_set.go - Changed Set to ObjectOrRuntimeExpr
  • model/task_call.go - Changed Headers and Query to ObjectOrRuntimeExpr
  • model/validator.go - Enhanced validateObjectOrRuntimeExpr to handle both pointer and value types

Implementation Updates

  • impl/task_runner_set.go - Simplified to work with ObjectOrRuntimeExpr, removed unused utils import

Test Updates

  • Updated all test files to use NewObjectOrRuntimeExpr() wrapper
  • Fixed test assertions to match new types

Test Results

Before:

❌ Validation failed for 11 out of 66 workflows.

After:

✅ All 66 workflows validated successfully.

Verification

Run integration tests:

./hack/integration-test.sh

All 66 workflows from the serverlessworkflow specification now validate successfully.

🤖 Generated with Claude Code

…alidation

This commit fixes 11 failing integration test workflows by addressing three
distinct issues in the SDK:

## 1. PullPolicy Validation (9 workflows)
**Problem:** The `pullPolicy` field in Container had validation `oneof=ifNotPresent always never`
without `omitempty`, causing validation to fail when the field was omitted (empty string "").

**Fix:** Added `omitempty` to the validation tag:
```go
PullPolicy string `validate:"omitempty,oneof=ifNotPresent always never"`
```

**Affected workflows:**
- run-container.yaml
- run-container-stdin-and-arguments.yaml
- run-return-none.yaml
- run-return-code.yaml
- run-container-with-name.yaml
- run-return-all.yaml
- run-container-cleanup-eventually.yaml
- run-container-cleanup-always.yaml
- run-return-stderr.yaml

## 2. SetTask Runtime Expression Support (1 workflow)
**Problem:** The `Set` field was typed as `map[string]interface{}`, but the spec
allows runtime expressions like `${ $workflow.input[0] }`.

**Fix:** Changed Set field type to `*ObjectOrRuntimeExpr`:
```go
Set *ObjectOrRuntimeExpr `validate:"required,object_or_runtime_expr"`
```

Updated validator to handle both pointer and value types of ObjectOrRuntimeExpr.

**Affected workflow:** set-expression.yaml

## 3. HTTPArguments Headers/Query Runtime Expression Support (1 workflow)
**Problem:** The `headers` and `query` fields were typed as maps, but the spec
allows runtime expressions like `${.headers}`.

**Fix:** Changed field types to `*ObjectOrRuntimeExpr`:
```go
Headers *ObjectOrRuntimeExpr `validate:"omitempty,object_or_runtime_expr"`
Query   *ObjectOrRuntimeExpr `validate:"omitempty,object_or_runtime_expr"`
```

**Affected workflow:** call-http-query-headers-expressions.yaml

## Results
✅ All 66 integration test workflows now validate successfully (was 55/66)

## Technical Details
- Updated `validateObjectOrRuntimeExpr` to handle both `*ObjectOrRuntimeExpr`
  and `ObjectOrRuntimeExpr` value types
- Fixed all test files to use `NewObjectOrRuntimeExpr()` wrapper
- Removed unused import of `utils` package in task_runner_set.go

Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
Changes:
- Removed 'continue-on-error: true' from integration tests step
  so that test failures will properly fail the CI build
- Updated paths-ignore to allow integration-test.sh changes to trigger CI
  while still ignoring other hack/ directory changes

This ensures integration tests are enforced in PRs and changes to the
integration test script itself are validated.

Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
- Remove string case from validateObjectOrRuntimeExpr to fix Input validation tests
- Change int32 to int in SUM_Numbers test (gojq doesn't support int32)

Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
@ricardozanini ricardozanini merged commit 764ae90 into serverlessworkflow:main Jun 27, 2026
3 checks passed
@ricardozanini ricardozanini deleted the fix-it-tests branch June 27, 2026 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant