Skip to content

test+ci: E2E improvements — dispatch triggers and security test coverage#87

Open
beonde wants to merge 3 commits into
mainfrom
e2e-improvements
Open

test+ci: E2E improvements — dispatch triggers and security test coverage#87
beonde wants to merge 3 commits into
mainfrom
e2e-improvements

Conversation

@beonde
Copy link
Copy Markdown
Member

@beonde beonde commented May 22, 2026

Consolidated E2E improvement changes (replaces #85 and #86):

  1. CI: trigger E2E tests on merge to main — adds trigger-e2e job using repository_dispatch to capiscio-e2e-tests
  2. Test: un-skip security verification tests — implements 3 previously-skipped security integration tests (expired badge, revoked badge, self-signed badge) with local signing + mockRegistry pattern

Supersedes: #85, #86

beonde added 2 commits May 22, 2026 10:46
After CI passes on a push to main, dispatch a repository_dispatch
event to capiscio/capiscio-e2e-tests so cross-product E2E tests run
within minutes instead of waiting for the daily 6am cron.
- Implement TestBadgeVerificationExpired: locally-signed badge with past
  expiry correctly rejected with BADGE_EXPIRED
- Implement TestBadgeVerificationRevoked: badge with JTI in mock revocation
  list correctly rejected with BADGE_REVOKED
- Implement TestBadgeVerificationSelfSigned: did:key self-signed badge
  rejected without AcceptSelfSigned (BADGE_ISSUER_UNTRUSTED), accepted with it
- Refactor TestMain to not block all tests when server unavailable; add
  requireServer(t) helper so server-dependent tests skip gracefully
- Add requireServer(t) to all DV, PoP, and data-plane tests that hit the API

These security tests run without a live server or Clerk auth, making them
suitable for CI and local development.
Copilot AI review requested due to automatic review settings May 22, 2026 14:47
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the project’s CI and integration testing by (1) dispatching downstream E2E runs after merges to main, and (2) making integration tests more robust by skipping server-dependent tests when the live server isn’t reachable while enabling previously-skipped security verification tests via local signing + a mock registry.

Changes:

  • Add a trigger-e2e CI job that dispatches repository_dispatch to capiscio/capiscio-e2e-tests on pushes to main.
  • Introduce requireServer(t) + serverAvailable gating so server-dependent integration tests skip cleanly when the server is down.
  • Implement three security-focused badge verification integration tests (expired, revoked, self-signed) that run without a live server.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
.github/workflows/ci.yml Adds a post-test dispatch job to trigger downstream E2E runs on main pushes.
tests/integration/setup_test.go Refactors TestMain to detect server availability and introduces requireServer(t) skip helper.
tests/integration/data_plane_test.go Gates live-server data-plane tests behind requireServer(t).
tests/integration/dv_order_test.go Gates live-server DV tests behind requireServer(t).
tests/integration/pop_challenge_test.go Gates live-server PoP tests behind requireServer(t).
tests/integration/badge_verification_test.go Adds a mock registry and implements three local-signing security verification tests.

Comment on lines +37 to +40
// Check if server is available (don't block on it)
if err := waitForServer(apiBaseURL, 30*time.Second); err != nil {
fmt.Fprintf(os.Stderr, "Server not ready: %v\n", err)
exitCode = 1
fmt.Fprintf(os.Stderr, "Server not ready: %v (server-dependent tests will be skipped)\n", err)
serverAvailable = false
Comment thread .github/workflows/ci.yml Outdated

trigger-e2e:
name: Trigger E2E Tests
needs: [test]
Comment thread .github/workflows/ci.yml Outdated
Comment on lines +126 to +136
needs: [test]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Dispatch E2E workflow
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
repository: capiscio/capiscio-e2e-tests
event-type: upstream-merge
client-payload: '{"repo": "capiscio-core", "sha": "${{ github.sha }}"}'
Comment on lines +25 to +30
func (m *mockRegistry) GetPublicKey(ctx context.Context, issuer string) (crypto.PublicKey, error) {
if key, ok := m.keys[issuer]; ok {
return key, nil
}
return nil, assert.AnError
}
…errors

- trigger-e2e now depends on [test, lint, protobuf, security] not just [test]
- Add github.repository guard so forks without REPO_ACCESS_TOKEN don't fail
- Replace assert.AnError with descriptive fmt.Errorf in mock registry
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