Zack Williams | ae8b48b | 2019-04-16 15:00:37 -0700 | [diff] [blame] | 1 | --- |
| 2 | # xos auth test |
| 3 | |
| 4 | - job-template: |
| 5 | id: 'xos-auth-test' |
| 6 | name: 'verify_{project}_auth-test' |
| 7 | |
| 8 | description: | |
| 9 | Created by {id} job-template from ci-management/jjb/xos-auth.yaml |
| 10 | |
| 11 | triggers: |
| 12 | - cord-infra-gerrit-trigger-patchset: |
| 13 | gerrit-server-name: '{gerrit-server-name}' |
| 14 | project-regexp: '^{project}$' |
| 15 | branch-regexp: '{branch-regexp}' |
| 16 | dependency-jobs: '{dependency-jobs}' |
| 17 | file-include-regexp: '{all-files-regexp}' |
| 18 | |
| 19 | properties: |
| 20 | - cord-infra-properties: |
| 21 | build-days-to-keep: '{build-days-to-keep}' |
| 22 | artifact-num-to-keep: '{artifact-num-to-keep}' |
| 23 | |
| 24 | wrappers: |
| 25 | - lf-infra-wrappers: |
| 26 | build-timeout: '20' |
| 27 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 28 | |
| 29 | scm: |
| 30 | - cord-infra-gerrit-repo-scm: |
| 31 | manifest-url: '{gerrit-server-url}/{cord-repo-manifest}' |
| 32 | branch: '$GERRIT_BRANCH' |
| 33 | destination-dir: 'cord' |
| 34 | |
Hung-Wei Chiu | f6cbde2 | 2021-04-22 22:15:23 -0700 | [diff] [blame] | 35 | node: 'ubuntu18.04-basebuild-4c-8g' |
Zack Williams | ae8b48b | 2019-04-16 15:00:37 -0700 | [diff] [blame] | 36 | project-type: freestyle |
| 37 | concurrent: true |
| 38 | |
| 39 | builders: |
Zack Williams | be54231 | 2022-06-23 21:51:32 -0700 | [diff] [blame] | 40 | - onf-infra-gerrit-repo-patch: |
| 41 | basedir: 'cord' |
Zack Williams | ae8b48b | 2019-04-16 15:00:37 -0700 | [diff] [blame] | 42 | project: '$GERRIT_PROJECT' |
| 43 | change-number: '$GERRIT_CHANGE_NUMBER' |
| 44 | patchset-number: '$GERRIT_PATCHSET_NUMBER' |
| 45 | - shell: | |
| 46 | #!/usr/bin/env bash |
| 47 | set -ex -o pipefail |
| 48 | |
| 49 | export XOS_DIR=$WORKSPACE/cord/orchestration/xos |
| 50 | export CHAMELEON_DIR=$WORKSPACE/cord/component/chameleon |
| 51 | |
| 52 | #install minikube+helm |
| 53 | export MINIKUBE_WANTUPDATENOTIFICATION=false |
| 54 | export MINIKUBE_WANTREPORTERRORPROMPT=false |
| 55 | export CHANGE_MINIKUBE_NONE_USER=true |
| 56 | export MINIKUBE_HOME=$HOME |
| 57 | mkdir -p $HOME/.kube || true |
| 58 | touch $HOME/.kube/config |
| 59 | export KUBECONFIG=$HOME/.kube/config |
| 60 | sudo -E /usr/bin/minikube start --vm-driver=none |
| 61 | sleep 300 |
| 62 | |
| 63 | helm init |
| 64 | sleep 60 |
| 65 | helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/ |
| 66 | |
| 67 | # build chameleon container |
| 68 | cd $CHAMELEON_DIR |
| 69 | make DOCKER_REPOSITORY=xosproject/ docker-build |
| 70 | |
| 71 | #deploy xos core |
| 72 | cd $WORKSPACE/cord/helm-charts |
| 73 | helm dep update xos-core |
| 74 | helm install --set images.xos_chameleon.tag=candidate -f examples/imagePullPolicy-IfNotPresent.yaml -n xos-core xos-core |
| 75 | |
| 76 | #wait for xos-core and models to be loaded |
| 77 | timeout 300 bash -c "until http -a admin@opencord.org:letmein GET http://127.0.0.1:30001/xosapi/v1/core/sites |jq '.items[0].name'|grep -q mysite; do echo 'Waiting for API To be up'; sleep 10; done" |
| 78 | |
| 79 | #test apis |
| 80 | curl -Is -u admin@opencord.org:letmein GET http://127.0.0.1:30001/xosapi/v1/core/sites | grep -q '200 OK' |
| 81 | curl -Is -u wronguser@opencord.org:wrongpass GET http://127.0.0.1:30001/xosapi/v1/core/sites | grep '403 Forbidden' |
| 82 | curl -Is -u admin@opencord.org:letmein GET http://127.0.0.1:30001/xosapi/v1/utility/auth_noop | grep '405 Method Not Allowed' |
| 83 | curl -Is -u wronguser@opencord.org:wrongpass GET http://127.0.0.1:30001/xosapi/v1/utility/auth_noop | grep '405 Method Not Allowed' |
| 84 | curl -Is -u wronguser@opencord.org:wrongpass GET http://127.0.0.1:30001/xosapi/v1/utility/noop | grep '405 Method Not Allowed' |
| 85 | curl -Is GET http://127.0.0.1:30001/xosapi/v1/utility/noop | grep '405 Method Not Allowed' |