Add middleware update e2e test#30
Merged
creydr merged 9 commits intofunctions-dev:mainfrom Apr 2, 2026
Merged
Conversation
- 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
- 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
2b902ee to
7440c16
Compare
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
7440c16 to
769c4d1
Compare
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add an e2e test to test the middleware update