Skip to content

Add middleware update e2e test#30

Merged
creydr merged 9 commits intofunctions-dev:mainfrom
creydr:add-middleware-update-e2e-test
Apr 2, 2026
Merged

Add middleware update e2e test#30
creydr merged 9 commits intofunctions-dev:mainfrom
creydr:add-middleware-update-e2e-test

Conversation

@creydr
Copy link
Copy Markdown
Collaborator

@creydr creydr commented Apr 1, 2026

Add an e2e test to test the middleware update

creydr added 4 commits April 1, 2026 13:02
- Create RunFunc() and RunFuncWithVersion() wrapper functions
- RunFuncWithVersion() downloads and caches specific func CLI versions
- Refactor existing tests to use RunFunc() instead of exec.Command
- Cached binaries stored in bin/func-cli/<version>/
- Test deploys function with old func CLI (v1.20.0)
- Operator should detect old middleware and update to latest
- Verifies function becomes Ready after middleware update
- Can't reliably check middleware version via func describe with insecure registry
- func describe requires inspecting OCI image labels which doesn't work with kind-registry:5000
- Instead verify middleware update by checking MiddlewareUpToDate condition transitions to True
- Test now passes successfully
- Use skopeo to inspect OCI image labels and verify middleware-version
- Initial image (v1.20.0 deploy) has no middleware-version label
- Updated image (operator redeploy) has middleware-version set
- Handle image references with both tag and digest (remove tag for skopeo)
- Test now fully verifies the core operator feature end-to-end

Why skopeo instead of func describe:
- func describe uses go-containerregistry to read middleware-version from image
- kind-registry is a Docker container name, not a real hostname
- Docker CLI can resolve it (func deploy works), but go-containerregistry cannot
- func describe silently fails to populate middleware.version field
- skopeo with localhost:5001 successfully inspects the image labels
@creydr creydr enabled auto-merge (squash) April 1, 2026 15:38
creydr added 2 commits April 1, 2026 17:48
- Add logFailedTestDetails() helper in e2e_test.go
- Replace duplicated AfterEach blocks in func_deploy_test.go and func_middleware_update_test.go
- Eliminates dupl linter warnings
@creydr creydr force-pushed the add-middleware-update-e2e-test branch from 2b902ee to 7440c16 Compare April 2, 2026 07:25
The middleware update test was failing because:
- InitializeRepoWithFunction() used current func CLI to init the repo
- Current func CLI creates new instance-based template structure
- Old func CLI (v1.20.0) couldn't understand the new template format
- This caused buildpack lifecycle failures (status code 51)

Solution:
- Add InitializeRepoWithFunctionVersion() to allow specifying func CLI version
- Use v1.20.1 for both 'func init' and 'func deploy' to ensure compatibility
- v1.20.1 still doesn't have middleware-version label (added in v1.21.0),
  so it's suitable for testing the middleware update functionality
@creydr creydr force-pushed the add-middleware-update-e2e-test branch from 7440c16 to 769c4d1 Compare April 2, 2026 07:58
creydr added 2 commits April 2, 2026 11:08
The test-e2e target had -ginkgo.timeout=1h but was missing the -timeout flag
for go test itself, which defaults to 10 minutes. This caused tests to timeout
during namespace cleanup even though the tests themselves passed successfully.

Aligns with test-e2e-bundle target which already has -timeout 1h.
@creydr creydr merged commit 9313ba2 into functions-dev:main Apr 2, 2026
4 of 5 checks passed
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