Skip to content

test(signer): unit tests for signserver signer package#2914

Merged
matiasinsaurralde merged 3 commits into
chainloop-dev:mainfrom
matiasinsaurralde:test/signserver-signer-unit-tests
Mar 22, 2026
Merged

test(signer): unit tests for signserver signer package#2914
matiasinsaurralde merged 3 commits into
chainloop-dev:mainfrom
matiasinsaurralde:test/signserver-signer-unit-tests

Conversation

@matiasinsaurralde

Copy link
Copy Markdown
Contributor

Summary

Adds unit tests for pkg/attestation/signer/signserver, bringing coverage from 0% to 75.2%.

All pure functions (ParseKeyReference, certFromPem, privateKeyFromPem) and option constructors are fully covered. SignMessage is tested via httptest.NewTLSServer for the success path, non-200 responses, network errors, and missing CA file.

The mTLS client-cert path in SignMessage is intentionally excluded — it requires a full mutual TLS handshake and is a better fit for an integration test.

One behavioral note documented in tests: ParseKeyReference does not validate the scheme prefix; that responsibility belongs to the caller (GetSigner).

Signed-off-by: Matías Insaurralde <matias@chainloop.dev>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="pkg/attestation/signer/signserver/signserver_test.go">

<violation number="1" location="pkg/attestation/signer/signserver/signserver_test.go:207">
P2: Do not ignore `io.ReadAll` errors in the success-path test; assert the read succeeds to avoid false positives.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread pkg/attestation/signer/signserver/signserver_test.go Outdated
Signed-off-by: Matías Insaurralde <matias@chainloop.dev>
Signed-off-by: Matías Insaurralde <matias@chainloop.dev>
@matiasinsaurralde matiasinsaurralde requested a review from a team March 22, 2026 04:35
@matiasinsaurralde matiasinsaurralde merged commit 18d5096 into chainloop-dev:main Mar 22, 2026
15 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.

2 participants