Skip to content

Conversation

@kallal79
Copy link

@kallal79 kallal79 commented Sep 22, 2025

Summary

This PR implements Issue #23 - Mock Mode for Early End-to-End Testing, enabling RATSD to serve pre-defined evidence without requiring real attesters or hardware.

Features Implemented

CLI Mock Mode Interface

./ratsd mock --evidence examples/mock/simple-mock-tsm.json

Mock Evidence File Format

{
  "attesters": {
    "attester-name": {
      "content_type": "application/vnd.veraison.content-type",
      "evidence": "base64-encoded-evidence-data"
    }
  }
}

Files Added/Modified

New Files

  • api/server_mock_test.go - Comprehensive test suite
  • examples/mock/simple-mock-tsm.json - Single TSM attester example
  • examples/mock/multi-attester-evidence.json - Multiple attesters example
  • examples/mock/arm-cca-evidence.json - ARM CCA example
  • examples/mock/simple-evidence.json - Basic evidence example

Modified Files

  • cmd/main.go - Added mock mode CLI parsing and server initialization
  • api/server.go - Implemented NewMockServer() and mock evidence handlers
  • README.md - Complete documentation with examples and usage
  • go.mod/go.sum - Updated dependencies

Testing

  • All existing tests pass
  • New mock mode tests implemented and passing
  • Integration testing verified with curl requests
  • Multiple attester scenarios working

kallal79 and others added 3 commits September 22, 2025 12:28
- Add comprehensive protoc installation documentation for multiple platforms
- Add dependency checks in Makefile with clear error messages
- Add automated protoc installation support (install-protoc target)
- Add complete dev environment setup (setup-dev target)
- Add help target with comprehensive build instructions
- Fix protoc-gen-go-grpc package path in Makefile and tools.go
- Update mock imports to use go.uber.org/mock/gomock
- Regenerate mocks with correct dependencies
- Improve error handling for missing dependencies
- Fix default Makefile target

This resolves the build failure when protoc is not installed by:
1. Providing clear installation instructions
2. Adding dependency verification
3. Offering automated installation options
4. Giving helpful error messages when dependencies are missing

Fixes veraison#32

Signed-off-by: GitHub Copilot <[email protected]>
- Add CLI mock subcommand with --evidence flag
- Implement NewMockServer() and mock evidence handlers in API
- Support both single and multi-attester mock evidence files
- Add comprehensive test suite for mock functionality
- Create example mock evidence files for development/testing
- Update README with complete mock mode documentation
- Enable end-to-end testing without real hardware attesters

Resolves: veraison#23
Related: veraison#24

Signed-off-by: GitHub Copilot <[email protected]>
This commit implements a comprehensive mock mode feature for RATSD that allows
early end-to-end testing without requiring real attesters.

Key features implemented:
- CLI interface: 'ratsd mock --evidence <file.json>'
- Mock evidence file format supporting multiple attesters
- Server-side mock evidence handler that serves pre-loaded CMW collections
- Example evidence files for testing
- Comprehensive test coverage for mock functionality
- Updated documentation with usage examples

The mock mode enables developers to:
1. Test RATSD integration without hardware attesters
2. Use custom evidence files for specific test scenarios
3. Validate end-to-end workflows during development
4. Create reproducible test environments

Files modified:
- cmd/main.go: Added CLI parsing for mock subcommand
- api/server.go: Added NewMockServer and mock evidence handlers
- api/server_mock_test.go: Comprehensive test suite for mock mode
- examples/mock/: Added sample evidence files
- README.md: Updated with mock mode documentation
- Makefile: Added mock mode build targets

Closes veraison#23

Signed-off-by: GitHub Copilot <[email protected]>
@kallal79
Copy link
Author

Hi sir ( @yogeshbdeshpande , @thomas-fossati @cowbon @deeglaze @iolivergithub @jraman567 ): PR #54 implements Issue #23 (Mock Mode) adding a CLI ./ratsd mock --evidence , API-compatible endpoints /ratsd/chares and /ratsd/subattesters, tests and docs — all checks passed; please review and approve to unblock merging.

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.

1 participant