Phase 2 Tests: SSL profile bean tests and Properties binding tests #133
Labels
No Label
architect:complete
blocked-by:#139
blocks:#140
bug
CI/CD
complexity:low
complexity:medium
complexity:medium
config
depends-on:#124
docker
docs
effort:l
effort:s
effort:xs
epic/development
lead:complete
needs-decision
performance
priority:critical
priority:high
priority:low
priority:medium
security
spike
story-points:1
story-points:3
story-points:5
story-points:8
tech-debt
test
user-story
architect:complete
complexity:high
complexity:low
complexity:medium
cross-repo
cross-repo-dev
dev:in-progress
effort:l
effort:m
effort:s
effort:xl
effort:xs
epic
analytics
epic
development
epic
devops
epic
infra
epic
observability
epic
platform
epic
product
lead:complete
needs-decision
pipeline-complete
pipeline-error
pipeline-running
priority
later
priority
next
priority
now
start-pipeline
status
acceptance
status
blocked
status
done
status
in progress
status
in review
status
in testing
status
ready
status
refine
status
triage
subtask
type
analysis
type
bug
type
hygiene
type
mantainence
type
story
user-story
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Hithomelabs/CFTunnels#133
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
When working on the portainer-automation module, I want comprehensive SSL profile bean tests and Properties binding tests, so I can ensure the SSL configuration and property bindings work correctly under various conditions.
Acceptance Criteria
Technical Notes
Dependencies
Effort: S (2-5 days)
Architecture Review — #133
Context Reviewed
I reviewed the full repository structure and the
testbranch where Phase 1 code lives. Here's my analysis:1. Phase 1 Dependency (Important!)
The classes under test (
PortainerClientConfig,PortainerAutomationProperties) currently exist only on thetestbranch — they are not onmain. Before Phase 2 tests can be implemented, Phase 1 code must be merged tomain(or you branch fromtest). This is a hard dependency.2. SSL Profile Bean Tests (
PortainerClientConfig)What needs testing:
@Profile("local")portainerRestTemplateLocal@Profile("!local")portainerRestTemplateportainerApiClientPortainerApiClientTechnical approach:
@SpringBootTest+@ActiveProfiles("local")/@ActiveProfiles("!local")in separate test classes"local", verify theRestTemplateuses a trust-allSSLContext— best checked viaReflectionTestUtilson theHttpComponentsClientHttpRequestFactory"!local", verify it uses the defaultHttpComponentsClientHttpRequestFactory(no custom SSL)portainerApiClientbean wiring — verify it's constructed with the correctRestTemplateand propertiesPotential concern: The
@Profile("local")bean manually constructs a trust-allSSLContextusing rawTrustManagerandSSLConnectionSocketFactoryfrom Apache HttpClient5. In a test, you may want to factor out the SSL creation into a package-private method for easier unit testing (or use@TestConfigurationoverrides).3. Properties Binding Tests (
PortainerAutomationProperties)Binding hierarchy to test:
Test scenarios needed:
@TestPropertySource(properties = {"portainer.base-url=...", ...})api-keywith defaultPORTAINER_API_KEY:endpoint-id(non-numeric)BindingResult/ failure analysisServiceclass bindingportainer.service.api-keybinds correctlyPortainerApiClientstrips itRecommendation: Use
@SpringBootTest(classes = {PortainerAutomationProperties.class})with@EnableConfigurationProperties(PortainerAutomationProperties.class)and@TestPropertySourcefor fine-grained control. Avoid loading the full context.4. Test Dependencies
Ensure
portainer-automation/build.gradleincludes (already present ontestbranch):No additional test deps needed beyond what's already declared.
5. Architecture Notes
PortainerClientConfigmixes@Profileand@Beanmethod injection (portainerApiClientdepends on bothRestTemplatebeans via the same bean name). This works because Spring resolves by parameter type, not name, but it's worth noting in tests.@ConditionalOnMissingBeanguards if this config might be excluded in tests.6. Missing Test File Locations
Based on the existing
testbranch structure:Summary: Good scope for ~3 story points. The main dependency is Phase 1 being merged. Consider extracting the SSL context construction for better testability.