Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 22, 2025

This PR implements a complete Jest-based integration testing framework for the Checkpoint monorepo, addressing the need for automated system tests across src/app, src/core, and docker-compose.dev.yaml components.

What's Implemented

Core Integration Test Suite

The main integration test validates the complete user workflow as requested:

// Complete workflow: user → org → repo → commit
const user = await testHelper.createTestUser({
  username: 'integration_test_user',
  email: 'integration@test.com'
});

const org = await testHelper.createTestOrg(user.id, {
  name: 'Integration Test Org'
});

const repo = await testHelper.createTestRepo(org.id, user.id, {
  name: 'integration-test-repo'
});

const commit = await testHelper.createTestChangelist(repo.id, user.id, {
  message: 'Add integration test file'
});

Docker-Based SeaweedFS Testing

A dedicated test environment (docker-compose.test.yaml) provides isolated SeaweedFS services for integration testing:

  • SeaweedFS Master on port 19333
  • SeaweedFS Volume on port 18080
  • SeaweedFS Filer on port 18888
  • Redis on port 16379

The setup automatically handles service lifecycle with cleanup:

npm run test:setup     # Start services
npm run test:integration  # Run tests
npm run test:teardown  # Clean up volumes

Database Isolation & Cleanup

Each test runs with a clean SQLite database that's automatically created and destroyed:

  • Isolated test databases prevent cross-test contamination
  • Automatic Prisma migrations ensure schema consistency
  • Complete cleanup after each test run
  • Fast execution with in-memory operations where possible

Test Coverage

Primary Integration Test (tests/integration/workflow.test.ts)

  • ✅ User creation with validation
  • ✅ Organization creation and admin assignment
  • ✅ Repository creation with main branch and initial changelist
  • ✅ Commit creation with proper numbering and branch head updates
  • ✅ Multiple sequential commits
  • ✅ Database constraint validation

SeaweedFS Integration (tests/integration/seaweedfs.test.ts)

  • ✅ Service connectivity validation
  • ✅ File storage and retrieval operations
  • ✅ Binary file handling for real-world scenarios
  • ✅ Directory operations for repository structure

Core Client Validation (tests/integration/core-client.test.ts)

  • ✅ Repository data access patterns
  • ✅ Permission validation workflows
  • ✅ Commit creation sequences
  • ✅ User authorization checks

Developer Experience

Simple Test Commands

# Full integration test cycle
npm run test:full

# Development workflow
npm run test:watch

# Individual components
npm run test:setup && npm run test:integration

Comprehensive Documentation

  • Detailed setup guide in tests/README.md
  • Troubleshooting section for common issues
  • CI/CD integration instructions
  • Demo script (test-demo.sh) for validation

Production-Ready Configuration

  • TypeScript support throughout the test suite
  • Workspace-aware monorepo configuration
  • CI/CD compatible with environment variable controls
  • Graceful degradation when Docker unavailable

Architecture Benefits

Monorepo Integration

The test setup works seamlessly with the existing workspace structure, adding test capabilities to:

  • src/app (Next.js + TRPC + Prisma)
  • src/core (client/server packages)
  • src/seaweedfs (Docker integration)

Automatic Resource Management

  • Database files automatically cleaned between tests
  • Docker volumes properly removed after test runs
  • Port conflicts avoided with dedicated test ports
  • Resource leaks prevented with proper cleanup hooks

This implementation provides a robust foundation for system-level testing while maintaining the existing development workflow and adding comprehensive validation of the complete user → organization → repository → commit workflow.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • binaries.prisma.sh
    • Triggering command: node scripts/postinstall.js (dns block)
    • Triggering command: /usr/local/bin/node /home/REDACTED/work/Checkpoint/Checkpoint/src/app/node_modules/@prisma/client/node_modules/.bin/prisma -v (dns block)
    • Triggering command: /usr/local/bin/node /home/REDACTED/work/Checkpoint/Checkpoint/src/app/node_modules/.bin/prisma generate (dns block)
  • checkpoint.prisma.io
    • Triggering command: /usr/local/bin/node /home/REDACTED/work/Checkpoint/Checkpoint/src/app/node_modules/prisma/build/child {"product":"prisma","version":"6.14.0","cli_install_type":"local","information":"","local_timestamp":"2025-08-22T07:25:20Z","project_hash":"2323a7e3","cli_path":"/home/REDACTED/work/Checkpoint/Checkpoint/src/app/node_modules/.bin/prisma","cli_path_hash":"ed64f2a9","endpoint":"REDACTED","disable":false,"arch":"x64","os":"linux","node_version":"v20.19.4","ci":true,"ci_name":"GitHub Actions","command":"generate","schema_providers":["sqlite"],"schema_preview_features":[],"schema_generators_providers":["prisma-client-js"],"cache_file":"/home/REDACTED/.cache/checkpoint-nodejs/prisma-ed64f2a9","cache_duration":43200000,"remind_duration":172800000,"force":false,"timeout":5000,"unref":true,"child_path":"/home/REDACTED/work/Checkpoint/Checkpoint/src/app/node_modules/prisma/build/child","client_event_id":"","previous_client_event_id":"","check_if_update_available":true} (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits August 22, 2025 07:30
Co-authored-by: mikeseese <549323+mikeseese@users.noreply.github.com>
Co-authored-by: mikeseese <549323+mikeseese@users.noreply.github.com>
Copilot AI changed the title [WIP] I have several components in this monorepo where I would like to use Jest to do automated system tests. I'm primarily interested in testing src/app, src/core, and the docker-compose.dev.yaml (which tests src/seaweedfs). I'm fine running Docker... Add comprehensive Jest integration test setup for monorepo system testing Aug 22, 2025
Copilot AI requested a review from mikeseese August 22, 2025 07:34
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