{"id":29035358,"url":"https://github.com/tpspace/thesis-tester","last_synced_at":"2026-05-05T13:37:54.089Z","repository":{"id":300691925,"uuid":"1006631994","full_name":"tpSpace/thesis-tester","owner":"tpSpace","description":"just an image for isolated testing environment.","archived":false,"fork":false,"pushed_at":"2025-06-23T04:26:45.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-23T05:29:21.902Z","etag":null,"topics":["bash","dockefile","github-actions","java"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tpSpace.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-22T17:25:20.000Z","updated_at":"2025-06-23T04:26:48.000Z","dependencies_parsed_at":"2025-06-23T05:29:23.830Z","dependency_job_id":"16d7f6bf-7922-4675-b379-b826a8f89310","html_url":"https://github.com/tpSpace/thesis-tester","commit_stats":null,"previous_names":["tpspace/thesis-tester"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tpSpace/thesis-tester","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpSpace%2Fthesis-tester","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpSpace%2Fthesis-tester/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpSpace%2Fthesis-tester/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpSpace%2Fthesis-tester/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tpSpace","download_url":"https://codeload.github.com/tpSpace/thesis-tester/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpSpace%2Fthesis-tester/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262063486,"owners_count":23252765,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","dockefile","github-actions","java"],"created_at":"2025-06-26T12:08:18.353Z","updated_at":"2026-05-05T13:37:54.012Z","avatar_url":"https://github.com/tpSpace.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Thesis Tester Image\n\nA Docker image for running Java tests in the thesis-llm grading service. This image can clone Java repositories, build them with Maven or Gradle, run tests, and return structured JSON results.\n\n## 🚀 Features\n\n- **Java 17 Support** - Full JDK and JRE environment\n- **Build System Support** - Maven and Gradle with auto-detection\n- **Git Integration** - Clone repositories and checkout specific commits\n- **Network Tools** - curl, ping, and other utilities\n- **Security** - Runs as non-root user with resource limits\n- **JSON Output** - Structured test results via stdout\n- **Timeout Protection** - Configurable execution timeouts\n\n## 📋 Prerequisites\n\n- Docker installed and running\n- Access to container registry (GitHub Container Registry recommended)\n- Java test repository for testing\n\n## 🔨 Building the Image\n\n### Quick Build\n\n```bash\n# Build with default settings\ndocker build -t thesis-tester:latest .\n```\n\n### Automated Build and Push\n\n```bash\n# Make scripts executable\nchmod +x build-and-push.sh test-local.sh\n\n# Build and optionally push to registry\n./build-and-push.sh ghcr.io/your-username latest\n```\n\n## 🧪 Testing Locally\n\n### Test with Sample Repository\n\n```bash\n# Test with a public Java repository\n./test-local.sh https://github.com/junit-team/junit4.git\n\n# Test with specific commit\n./test-local.sh https://github.com/your-repo/java-project.git abc123def\n\n# Test with custom image tag\n./test-local.sh https://github.com/your-repo/java-project.git HEAD thesis-tester:dev\n```\n\n### Manual Testing\n\n```bash\n# Run container manually\ndocker run --rm \\\n  -e GRADING_JOB_ID=123 \\\n  -e REPO_URL=\"https://github.com/junit-team/junit4.git\" \\\n  -e GIT_COMMIT_HASH=\"HEAD\" \\\n  -e OUTPUT_FORMAT=\"json\" \\\n  -e TIMEOUT_SECONDS=300 \\\n  thesis-tester:latest\n```\n\n## 🔧 Environment Variables\n\n| Variable | Description | Default |\n|----------|-------------|---------|\n| `GRADING_JOB_ID` | Unique job identifier | `unknown` |\n| `REPO_URL` | Git repository URL | Required |\n| `GIT_COMMIT_HASH` | Specific commit to checkout | `HEAD` |\n| `OUTPUT_FORMAT` | Output format (json) | `json` |\n| `TIMEOUT_SECONDS` | Maximum execution time | `300` |\n\n## 📊 Output Format\n\nThe image outputs structured JSON to stdout:\n\n```json\n{\n  \"gradingJobId\": 123,\n  \"status\": \"COMPLETED\",\n  \"startedAt\": \"2024-01-01T10:00:00Z\",\n  \"completedAt\": \"2024-01-01T10:05:00Z\",\n  \"testResults\": [\n    {\n      \"testName\": \"testAddition\",\n      \"className\": \"CalculatorTest\",\n      \"passed\": true,\n      \"output\": \"\",\n      \"durationMs\": 150\n    }\n  ],\n  \"compilationOutput\": \"BUILD SUCCESS\",\n  \"errorMessage\": null,\n  \"exitCode\": 0,\n  \"executionLogs\": [\n    {\n      \"type\": \"INFO\",\n      \"message\": \"Starting test execution\",\n      \"timestamp\": \"2024-01-01T10:00:00Z\"\n    }\n  ]\n}\n```\n\n## 🏗️ Supported Build Systems\n\n### Maven Projects\n\n- Automatically detected by `pom.xml`\n- Commands: `mvn clean compile test-compile test`\n- Test reports: `target/surefire-reports/TEST-*.xml`\n\n### Gradle Projects\n\n- Automatically detected by `build.gradle` or `build.gradle.kts`\n- Commands: `gradle clean compileJava compileTestJava test`\n- Test reports: `build/test-results/test/TEST-*.xml`\n- Supports both `gradle` command and `./gradlew` wrapper\n\n## 🔐 Security Features\n\n- **Non-root user** - Runs as `tester` user (UID 1000)\n- **Resource limits** - CPU and memory constraints in Kubernetes\n- **Read-only filesystem** - Where possible\n- **Minimal attack surface** - Alpine-based with only necessary tools\n\n## 🚀 Integration with thesis-llm\n\n### 1. Update Configuration\n\n```yaml\n# In thesis-llm/k8s/configmap.yaml\ntester-image: \"ghcr.io/your-username/thesis-tester:latest\"\n```\n\n### 2. Deploy Updated Configuration\n\n```bash\nkubectl apply -f thesis-llm/k8s/configmap.yaml\nkubectl rollout restart deployment/llm-grading-service -n my-thesis\n```\n\n### 3. Monitor Job Execution\n\n```bash\n# Watch for jobs being created\nkubectl get jobs -n my-thesis -w\n\n# Check job logs\nkubectl logs job/grading-job-XXX -n my-thesis\n```\n\n## 🛠️ Development\n\n### Project Structure\n\n```bash\nthesis-tester/\n├── Dockerfile              # Container definition\n├── test-runner.sh          # Main execution script\n├── test-local.sh          # Local testing script\n├── build-and-push.sh      # Build automation\n└── README.md              # This file\n```\n\n### Customizing the Image\n\n#### Adding New Build Systems\n\n1. Update `detect_build_system()` function\n2. Add new build and test functions\n3. Update the main execution flow\n\n#### Modifying Test Parsing\n\n1. Update `parse_*_test_results()` functions\n2. Ensure output matches expected JSON schema\n\n### Debugging\n\n#### Container Logs\n\n```bash\n# Check stderr logs (execution logs)\ndocker run thesis-tester:latest 2\u003e\u00261 | grep \"\\[ERROR\\]\"\n\n# Get full container output\ndocker run thesis-tester:latest \u003e output.json 2\u003e logs.txt\n```\n\n#### Health Check\n\n```bash\n# Verify tools are installed\ndocker run --rm thesis-tester:latest java -version\ndocker run --rm thesis-tester:latest mvn -version\ndocker run --rm thesis-tester:latest gradle -version\n```\n\n## 📝 Troubleshooting\n\n### Common Issues\n\n#### Build Failures\n\n- **Permission denied**: Check file permissions and user context\n- **Network timeout**: Increase `TIMEOUT_SECONDS` value\n- **Missing dependencies**: Verify build system configuration\n\n#### Test Parsing Issues\n\n- **No test results**: Check if tests are actually running\n- **Incorrect JSON**: Verify XML report format and parsing logic\n- **Missing test files**: Ensure build generates test reports\n\n#### Container Issues\n\n- **Image won't start**: Check Dockerfile syntax and base image\n- **Script not found**: Verify `test-runner.sh` is copied and executable\n- **Resource limits**: Adjust memory/CPU limits in Kubernetes\n\n### Support\n\nFor issues related to:\n\n- **Container building**: Check Docker logs and Dockerfile\n- **Test execution**: Review `test-runner.sh` and add debug logging\n- **Integration**: Verify thesis-llm configuration and logs\n\n## 🎯 Performance Tuning\n\n### Optimization Tips\n\n- Use specific base image tags for reproducibility\n- Minimize layer count in Dockerfile\n- Set appropriate resource limits\n- Use multi-stage builds to reduce image size\n\n### Resource Recommendations\n\n- **Memory**: 256Mi - 512Mi\n- **CPU**: 100m - 300m\n- **Timeout**: 300-600 seconds depending on project size\n\n## 📄 License\n\nThis project is part of the thesis-llm grading service infrastructure.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpspace%2Fthesis-tester","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftpspace%2Fthesis-tester","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpspace%2Fthesis-tester/lists"}