blob: 64ccb2ec09af4756cd4ff72c262da2fbd8f6480b [file] [log] [blame]
---
# xos auth test
- job-template:
id: 'xos-auth-test'
name: 'verify_{project}_auth-test'
description: |
Created by {id} job-template from ci-management/jjb/xos-auth.yaml
triggers:
- cord-infra-gerrit-trigger-patchset:
gerrit-server-name: '{gerrit-server-name}'
project-regexp: '^{project}$'
branch-regexp: '{branch-regexp}'
dependency-jobs: '{dependency-jobs}'
file-include-regexp: '{all-files-regexp}'
properties:
- cord-infra-properties:
build-days-to-keep: '{build-days-to-keep}'
artifact-num-to-keep: '{artifact-num-to-keep}'
wrappers:
- lf-infra-wrappers:
build-timeout: '20'
jenkins-ssh-credential: '{jenkins-ssh-credential}'
scm:
- cord-infra-gerrit-repo-scm:
manifest-url: '{gerrit-server-url}/{cord-repo-manifest}'
branch: '$GERRIT_BRANCH'
destination-dir: 'cord'
# node: 'ubuntu18.04-basebuild-4c-8g'
node: 'ubuntu18.04-basebuild-8c-15g'
project-type: freestyle
concurrent: true
builders:
- onf-infra-gerrit-repo-patch:
basedir: 'cord'
project: '$GERRIT_PROJECT'
change-number: '$GERRIT_CHANGE_NUMBER'
patchset-number: '$GERRIT_PATCHSET_NUMBER'
- shell: |
#!/usr/bin/env bash
set -ex -o pipefail
export XOS_DIR=$WORKSPACE/cord/orchestration/xos
export CHAMELEON_DIR=$WORKSPACE/cord/component/chameleon
#install minikube+helm
export MINIKUBE_WANTUPDATENOTIFICATION=false
export MINIKUBE_WANTREPORTERRORPROMPT=false
export CHANGE_MINIKUBE_NONE_USER=true
export MINIKUBE_HOME=$HOME
mkdir -p $HOME/.kube || true
touch $HOME/.kube/config
export KUBECONFIG=$HOME/.kube/config
sudo -E /usr/bin/minikube start --vm-driver=none
sleep 300
helm init
sleep 60
helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/
# build chameleon container
cd $CHAMELEON_DIR
make DOCKER_REPOSITORY=xosproject/ docker-build
#deploy xos core
cd $WORKSPACE/cord/helm-charts
helm dep update xos-core
helm install --set images.xos_chameleon.tag=candidate -f examples/imagePullPolicy-IfNotPresent.yaml -n xos-core xos-core
#wait for xos-core and models to be loaded
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"
#test apis
curl -Is -u admin@opencord.org:letmein GET http://127.0.0.1:30001/xosapi/v1/core/sites | grep -q '200 OK'
curl -Is -u wronguser@opencord.org:wrongpass GET http://127.0.0.1:30001/xosapi/v1/core/sites | grep '403 Forbidden'
curl -Is -u admin@opencord.org:letmein GET http://127.0.0.1:30001/xosapi/v1/utility/auth_noop | grep '405 Method Not Allowed'
curl -Is -u wronguser@opencord.org:wrongpass GET http://127.0.0.1:30001/xosapi/v1/utility/auth_noop | grep '405 Method Not Allowed'
curl -Is -u wronguser@opencord.org:wrongpass GET http://127.0.0.1:30001/xosapi/v1/utility/noop | grep '405 Method Not Allowed'
curl -Is GET http://127.0.0.1:30001/xosapi/v1/utility/noop | grep '405 Method Not Allowed'
# [EOF]