patch #1488
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: Test Repomanager API | |
| on: | |
| push: | |
| jobs: | |
| api-test: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Install curl | |
| run: sudo apt-get install curl jq wget -y | |
| # Wait for the API to be ready | |
| # Generally after the 15 first minutes of the current hour (xx:15 to xx:59) | |
| - name: Wait until API URL is ready | |
| run: | | |
| while (true); do | |
| if $(date +%M | grep -q '^1[5-9]\|^[2-5][0-9]$'); then | |
| break | |
| fi | |
| sleep 60 | |
| done | |
| - name: Check if API is reachable | |
| run: | | |
| RESULT=$(curl --fail-with-body -L -s ${{ secrets.API_TEST_HOST }}) | |
| if [ $? -ne 0 ]; then | |
| echo "API is not unreachable" | |
| exit 1 | |
| fi | |
| # | |
| # Download rpm and deb packages from https://packages.repomanager.net that will be used for upload testing | |
| # To avoid an upload test failure due to the package already been uploaded (when multiple pipelines run at the same time), | |
| # prefix them with a unique ID (current timestamp) and put them in a directory named after the runner hostname. | |
| # | |
| - name: Download test packages | |
| run: | | |
| mkdir $HOSTNAME | |
| UNIQUE_ID=$(date +%s) | |
| wget -O $HOSTNAME/${UNIQUE_ID}_nginx-1.26.0-1.el7.ngx.x86_64.rpm https://packages.repomanager.net/repo/rpm/ci-test/8/prod/packages/x86_64/nginx-1.26.0-1.el7.ngx.x86_64.rpm | |
| wget -O $HOSTNAME/${UNIQUE_ID}_nginx_1.26.0-1~bookworm_amd64.deb https://packages.repomanager.net/repo/deb/ci-test/bookworm/main/prod/pool/main/nginx_1.26.0-1~bookworm_amd64.deb | |
| # | |
| # Run tests as admin user | |
| # | |
| - name: Run admin tasks tests | |
| uses: ./.github/actions/test-api/admin/tasks | |
| with: | |
| api-host: ${{ secrets.API_TEST_HOST }} | |
| api-key: ${{ secrets.API_TEST_ADMIN_API_KEY }} | |
| - name: Run admin environment point test | |
| uses: ./.github/actions/test-api/admin/environment/point | |
| with: | |
| api-host: ${{ secrets.API_TEST_HOST }} | |
| api-key: ${{ secrets.API_TEST_ADMIN_API_KEY }} | |
| - name: Run admin repositories tests | |
| uses: ./.github/actions/test-api/admin/repositories | |
| with: | |
| api-host: ${{ secrets.API_TEST_HOST }} | |
| api-key: ${{ secrets.API_TEST_ADMIN_API_KEY }} | |
| - name: Run admin source repositories tests | |
| uses: ./.github/actions/test-api/admin/source-repositories | |
| with: | |
| api-host: ${{ secrets.API_TEST_HOST }} | |
| api-key: ${{ secrets.API_TEST_ADMIN_API_KEY }} | |
| - name: Run admin snapshot details tests | |
| uses: ./.github/actions/test-api/admin/snapshot/details | |
| with: | |
| api-host: ${{ secrets.API_TEST_HOST }} | |
| api-key: ${{ secrets.API_TEST_ADMIN_API_KEY }} | |
| - name: Run admin snapshot diff tests | |
| uses: ./.github/actions/test-api/admin/snapshot/diff | |
| with: | |
| api-host: ${{ secrets.API_TEST_HOST }} | |
| api-key: ${{ secrets.API_TEST_ADMIN_API_KEY }} | |
| - name: Run admin package list tests | |
| uses: ./.github/actions/test-api/admin/snapshot/package/list | |
| with: | |
| api-host: ${{ secrets.API_TEST_HOST }} | |
| api-key: ${{ secrets.API_TEST_ADMIN_API_KEY }} | |
| - name: Run admin package upload tests | |
| uses: ./.github/actions/test-api/admin/snapshot/package/upload | |
| with: | |
| api-host: ${{ secrets.API_TEST_HOST }} | |
| api-key: ${{ secrets.API_TEST_ADMIN_API_KEY }} | |
| - name: Run admin hosts tests | |
| uses: ./.github/actions/test-api/admin/hosts | |
| with: | |
| api-host: ${{ secrets.API_TEST_HOST }} | |
| api-key: ${{ secrets.API_TEST_ADMIN_API_KEY }} | |
| - name: Run admin single host tests | |
| uses: ./.github/actions/test-api/admin/host | |
| with: | |
| api-host: ${{ secrets.API_TEST_HOST }} | |
| api-key: ${{ secrets.API_TEST_ADMIN_API_KEY }} | |
| # | |
| # Run tests as a regular user: test-user1 | |
| # This user has absolutely no permissions to do anything so all the tests must fail | |
| # | |
| - name: Run test-user1 repositories tests | |
| uses: ./.github/actions/test-api/test-user1/repositories | |
| with: | |
| api-host: ${{ secrets.API_TEST_HOST }} | |
| api-key: ${{ secrets.API_TEST_TEST_USER1_API_KEY }} | |
| - name: Run test-user1 source repositories tests | |
| uses: ./.github/actions/test-api/test-user1/source-repositories | |
| with: | |
| api-host: ${{ secrets.API_TEST_HOST }} | |
| api-key: ${{ secrets.API_TEST_TEST_USER1_API_KEY }} | |
| - name: Run test-user1 package upload tests | |
| uses: ./.github/actions/test-api/test-user1/snapshot/package/upload | |
| with: | |
| api-host: ${{ secrets.API_TEST_HOST }} | |
| api-key: ${{ secrets.API_TEST_TEST_USER1_API_KEY }} | |
| - name: Run test-user1 package delete tests | |
| uses: ./.github/actions/test-api/test-user1/snapshot/package/delete | |
| with: | |
| api-host: ${{ secrets.API_TEST_HOST }} | |
| api-key: ${{ secrets.API_TEST_TEST_USER1_API_KEY }} | |
| # | |
| # Run tests as a regular user: test-user2 | |
| # This user has permissions to upload packages and rebuild snapshots metadata | |
| # | |
| - name: Run test-user2 repositories tests | |
| uses: ./.github/actions/test-api/test-user2/repositories | |
| with: | |
| api-host: ${{ secrets.API_TEST_HOST }} | |
| api-key: ${{ secrets.API_TEST_TEST_USER2_API_KEY }} | |
| - name: Run test-user2 package upload tests | |
| uses: ./.github/actions/test-api/test-user2/snapshot/package/upload | |
| with: | |
| api-host: ${{ secrets.API_TEST_HOST }} | |
| api-key: ${{ secrets.API_TEST_TEST_USER2_API_KEY }} |