Improve ContainerSpecHelper partial image configuration error message#4807
Conversation
dimas-b
left a comment
There was a problem hiding this comment.
The new message change looks better 🙂 Thanks, @venkateshwaracholan !
| @Test | ||
| void dockerImageNameUsesBothSystemPropertiesWhenProvided() { | ||
| System.setProperty("polaris.testing." + CONTAINER_NAME + ".image", "docker.io/custom/image"); | ||
| System.setProperty("polaris.testing." + CONTAINER_NAME + ".tag", "9.9.9"); |
There was a problem hiding this comment.
IMHO, using System properties during unit tests is not nice and prone to inter-test side effects.
I support the idea of adding test coverage to the image selection logic, though. I'd propose to add a test-only variant for containerSpecHelper() that would take Function<String, String> for both the sys. prop. and env. lookups (overridden by tests). The "prod" code will use trivial redirects on the main call path.
This way we'd be able to validate env. lookup logic too.
There was a problem hiding this comment.
@dimas-b Thanks for the suggestion. I updated the tests to inject property and environment lookups instead of modifying JVM system properties directly. The production path is unchanged, and the new approach also allowed adding coverage for environment variable handling and precedence rules.
Summary
Fixes #4806
Improve the error message shown when only one of the container image name or image tag is configured.
Changes
IllegalArgumentExceptionmessage to improve clarity.Checklist
CHANGELOG.md(if needed)site/content/in-dev/unreleased(if needed)