test: providing a GH workflow to test HTCondor job submission/tracking #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: HTCondor Integration Test | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| htcondor-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository code | |
| uses: actions/checkout@v4 | |
| - name: Start HTCondor Mini-Cluster Container | |
| run: | | |
| # Spin up the container, mapping the local repository workspace to /job | |
| docker run -d \ | |
| --name condor-local \ | |
| -v "${{ github.workspace }}/sandbox":/job \ | |
| -w /job \ | |
| htcondor/mini:el9 | |
| - name: Setup Test User and Directory Permissions | |
| run: | | |
| # Create the unprivileged user inside the container | |
| docker exec condor-local useradd -m test_user | |
| # Fix ownership so test_user can write stdout/logs back to the host filesystem | |
| docker exec condor-local chown -R test_user:test_user /job | |
| - name: Verify Workspace Inside Container | |
| run: | | |
| # Diagnostic step to ensure dummy_job.sub and payload.sh are present | |
| docker exec condor-local ls -la /job | |
| - name: Submit Dummy Job | |
| run: | | |
| # Cluster number will always be 1, as we use a fresh container | |
| echo "Before submitting this job, sleep for 10 seconds" && sleep 10 | |
| docker exec -u test_user condor-local condor_submit dummy_job.sub | |
| - name: Wait for Job Completion | |
| run: | | |
| echo "Monitoring Cluster ID: 1" | |
| docker exec -u test_user condor-local condor_watch_q -exit all,done -clusters 1 | |
| - name: Verify Job Output Logs | |
| run: | | |
| # Check the output file written back to the GitHub workspace runner | |
| echo "=== Content of job.out ===" | |
| cat sandbox/job.out | |
| # Check the standard error to ensure no underlying bash glitches occurred | |
| echo "=== Content of job.err ===" | |
| cat sandbox/job.err | |
| # 1. Assert that our expected string exists in the output file | |
| if ! grep -q "Hello from native HTCondor!" sandbox/job.out; then | |
| echo "Failure: Expected job output string not found." | |
| exit 1 | |
| fi | |
| # 2. Assert that the error log is completely empty | |
| if [ -s sandbox/job.err ]; then | |
| echo "Failure: job.err is not empty! Something went wrong during execution." | |
| exit 2 | |
| fi | |
| echo "Success: Job completed perfectly with no errors!" | |
| - name: Cleanup Container | |
| if: always() # Ensures the container is torn down even if the tests fail | |
| run: | | |
| docker rm -f condor-local |