From 6b7f74084779d0a2ed2ad122be9ea1310271950b Mon Sep 17 00:00:00 2001 From: danfengliu Date: Thu, 3 Dec 2020 00:02:30 -0800 Subject: [PATCH] Move proxy cache e2e test into a new CI job CI job timeout is 60 minutes, but proxy cache case timeout is 20 minutes, once proxy cache case is timeout, it will reach CI job timeout, then cause CI job terminated by timeout without running rest of test steps, expecially uploading useful harbor logs, so move this test into a new clean job for saving time and debugging. Signed-off-by: danfengliu --- .github/workflows/CI.yml | 60 +++++++++++++++++++ .../python/test_scan_image_artifact.py | 2 +- tests/ci/api_run.sh | 4 +- 3 files changed, 64 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c14da59f8..abdc9453f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -147,6 +147,66 @@ jobs: bash ./tests/showtime.sh ./tests/ci/api_run.sh DB $IP df -h + APITEST_DB_PROXY_CACHE: + env: + APITEST_DB: true + runs-on: + #- self-hosted + - ubuntu-latest + timeout-minutes: 60 + steps: + - name: Set up Go 1.14 + uses: actions/setup-go@v1 + with: + go-version: 1.14.7 + id: go + - name: setup Docker + uses: docker-practice/actions-setup-docker@0.0.1 + with: + docker_version: 18.09 + docker_channel: stable + - uses: actions/checkout@v2 + with: + path: src/github.com/goharbor/harbor + - name: setup env + run: | + cd src/github.com/goharbor/harbor + pwd + go env + echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV + echo "GOPATH=$(go env GOPATH):$GITHUB_WORKSPACE" >> $GITHUB_ENV + echo "$(go env GOPATH)/bin" >> $GITHUB_PATH + echo "TOKEN_PRIVATE_KEY_PATH=${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem" >> $GITHUB_ENV + IP=`hostname -I | awk '{print $1}'` + echo "IP=$IP" >> $GITHUB_ENV + shell: bash + - name: before_install + run: | + set -x + cd src/github.com/goharbor/harbor + pwd + env + df -h + #sudo apt install -y xvfb + #xvfb-run ls + curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose + chmod +x docker-compose + sudo mv docker-compose /usr/local/bin + - name: install + run: | + cd src/github.com/goharbor/harbor + env + df -h + docker system prune -a -f + bash ./tests/showtime.sh ./tests/ci/api_common_install.sh $IP DB + - name: script + run: | + cd src/github.com/goharbor/harbor + echo IP: $IP + df -h + bash ./tests/showtime.sh ./tests/ci/api_run.sh PROXY_CACHE $IP + df -h + APITEST_LDAP: env: APITEST_LDAP: true diff --git a/tests/apitests/python/test_scan_image_artifact.py b/tests/apitests/python/test_scan_image_artifact.py index ce6e5ce47..8b1301ea0 100644 --- a/tests/apitests/python/test_scan_image_artifact.py +++ b/tests/apitests/python/test_scan_image_artifact.py @@ -119,4 +119,4 @@ if __name__ == '__main__': suite = unittest.TestSuite(unittest.makeSuite(TestScan)) result = unittest.TextTestRunner(sys.stdout, verbosity=2, failfast=True).run(suite) if not result.wasSuccessful(): - raise Exception(r"Tag immutability test failed: {}".format(result)) \ No newline at end of file + raise Exception(r"Scan test failed: {}".format(result)) diff --git a/tests/ci/api_run.sh b/tests/ci/api_run.sh index 67d753715..dd0e8eba7 100755 --- a/tests/ci/api_run.sh +++ b/tests/ci/api_run.sh @@ -31,7 +31,9 @@ set +e docker ps # run db auth api cases if [ "$1" = 'DB' ]; then - docker run -i --privileged -v $DIR/../../:/drone -v $DIR/../:/ca -w /drone $E2E_IMAGE robot -v DOCKER_USER:${DOCKER_USER} -v DOCKER_PWD:${DOCKER_PWD} -v ip:$2 -v ip1: -v HARBOR_PASSWORD:Harbor12345 /drone/tests/robot-cases/Group1-Nightly/Setup.robot /drone/tests/robot-cases/Group0-BAT/API_DB.robot + docker run -i --privileged -v $DIR/../../:/drone -v $DIR/../:/ca -w /drone $E2E_IMAGE robot --exclude proxy_cache -v DOCKER_USER:${DOCKER_USER} -v DOCKER_PWD:${DOCKER_PWD} -v ip:$2 -v ip1: -v HARBOR_PASSWORD:Harbor12345 /drone/tests/robot-cases/Group1-Nightly/Setup.robot /drone/tests/robot-cases/Group0-BAT/API_DB.robot +elif [ "$1" = 'PROXY_CACHE' ]; then + docker run -i --privileged -v $DIR/../../:/drone -v $DIR/../:/ca -w /drone $E2E_IMAGE robot --include setup --include proxy_cache -v DOCKER_USER:${DOCKER_USER} -v DOCKER_PWD:${DOCKER_PWD} -v ip:$2 -v ip1: -v HARBOR_PASSWORD:Harbor12345 /drone/tests/robot-cases/Group1-Nightly/Setup.robot /drone/tests/robot-cases/Group0-BAT/API_DB.robot elif [ "$1" = 'LDAP' ]; then # run ldap api cases python $DIR/../../tests/configharbor.py -H $IP -u $HARBOR_ADMIN -p $HARBOR_ADMIN_PASSWD -c auth_mode=ldap_auth \