From df65245b1411b1d3945cf6f6986294149248d86e Mon Sep 17 00:00:00 2001 From: Sumra Zafar <suzafar@microsoft.com> Date: Fri, 13 Nov 2020 20:39:30 -0500 Subject: [PATCH] Revert "Reversion" This reverts commit bb1a91eef9f9291e17d6c3e0aa0e1eaa5d0e844f. --- .gitlab-ci.yml | 8 + devops/azure/Dockerfile | 6 - devops/azure/chart/.helmignore | 23 +++ devops/azure/chart/Chart.yaml | 38 +++- devops/azure/chart/templates/NOTES.txt | 15 ++ devops/azure/chart/templates/_helpers.tpl | 62 +++++++ devops/azure/chart/templates/deployment.yaml | 164 +++++++++++------- devops/azure/chart/templates/service.yaml | 31 +++- devops/azure/chart/values.yaml | 34 +++- devops/azure/pipeline.yml | 6 - devops/azure/release.yaml | 151 ++++++++++++++++ .../crs-converter-aks/pom.xml | 2 +- .../crs_converter_test_azure/requirements.txt | 18 ++ .../run-integration-tests.sh | 38 ++++ .../crs_converter_test_azure/run_test_api.py | 8 + 15 files changed, 512 insertions(+), 92 deletions(-) delete mode 100644 devops/azure/Dockerfile create mode 100644 devops/azure/chart/.helmignore create mode 100644 devops/azure/chart/templates/NOTES.txt create mode 100644 devops/azure/chart/templates/_helpers.tpl create mode 100644 devops/azure/release.yaml create mode 100644 testing/crs_converter_test_azure/requirements.txt create mode 100644 testing/crs_converter_test_azure/run-integration-tests.sh create mode 100644 testing/crs_converter_test_azure/run_test_api.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cff7fecd..5b41901e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,11 @@ variables: SIS_DATA: $CI_PROJECT_DIR/apachesis_setup/SIS_DATA + AZURE_SERVICE: crs_converter + AZURE_BUILD_SUBDIR: provider/crs-converter-azure/crs-converter-aks + AZURE_TEST_SUBDIR: testing/crs_converter_test_azure + + AWS_BUILD_SUBDIR: provider/crs-converter-aws/build-aws AWS_TEST_SUBDIR: testing/crs_converter_test_aws AWS_SERVICE: crs-conversion @@ -24,6 +29,9 @@ include: - project: "osdu/platform/ci-cd-pipelines" file: "scanners/gitlab-ultimate.yml" + - project: "osdu/platform/ci-cd-pipelines" + file: "cloud-providers/azure.yml" + - project: "osdu/platform/ci-cd-pipelines" file: "cloud-providers/aws.yml" diff --git a/devops/azure/Dockerfile b/devops/azure/Dockerfile deleted file mode 100644 index 95aa22a7..00000000 --- a/devops/azure/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM openjdk:8-jdk-alpine - -COPY provider/crs-converter-azure/crs-converter-aks/target/crs-converter-aks-1.0.0.jar /app.jar - -ENTRYPOINT ["java","-jar","/app.jar"] - diff --git a/devops/azure/chart/.helmignore b/devops/azure/chart/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/devops/azure/chart/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/devops/azure/chart/Chart.yaml b/devops/azure/chart/Chart.yaml index 7a9d162b..0f2538d6 100644 --- a/devops/azure/chart/Chart.yaml +++ b/devops/azure/chart/Chart.yaml @@ -1,6 +1,36 @@ +# Copyright Microsoft Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. apiVersion: v2 -name: crs-conversion-service -appVersion: "latest" -description: Helm Chart for installing crs-conversion-service service. -version: 0.1.0 +name: crs-converter +description: A Helm chart for installing crs-conversion-service on Azure + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +appVersion: "latest" \ No newline at end of file diff --git a/devops/azure/chart/templates/NOTES.txt b/devops/azure/chart/templates/NOTES.txt new file mode 100644 index 00000000..0840ebc4 --- /dev/null +++ b/devops/azure/chart/templates/NOTES.txt @@ -0,0 +1,15 @@ +1. Get the application URL by running these commands: +{{- if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "azure-crs-converter.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "azure-crs-converter.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "azure-crs-converter.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "azure-crs-converter.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/devops/azure/chart/templates/_helpers.tpl b/devops/azure/chart/templates/_helpers.tpl new file mode 100644 index 00000000..9fcf67ac --- /dev/null +++ b/devops/azure/chart/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "azure-crs-converter.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "azure-crs-converter.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "azure-crs-converter.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "azure-crs-converter.labels" -}} +helm.sh/chart: {{ include "azure-crs-converter.chart" . }} +{{ include "azure-crs-converter.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "azure-crs-converter.selectorLabels" -}} +app.kubernetes.io/name: {{ include "azure-crs-converter.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "azure-crs-converter.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "azure-crs-converter.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/devops/azure/chart/templates/deployment.yaml b/devops/azure/chart/templates/deployment.yaml index 7334c3dc..b178350c 100644 --- a/devops/azure/chart/templates/deployment.yaml +++ b/devops/azure/chart/templates/deployment.yaml @@ -1,81 +1,115 @@ +# Copyright © Microsoft Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. apiVersion: apps/v1 kind: Deployment metadata: - name: {{ .Release.Name }} namespace: osdu + name: {{ include "azure-crs-converter.fullname" . }} + labels: + app: {{ .Chart.Name }} + appversion: {{ .Chart.Version }} + aadpodidbinding: osdu-identity spec: +{{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.global.replicaCount }} +{{- end }} selector: matchLabels: + aadpodidbinding: osdu-identity app: {{ .Chart.Name }} + appversion: {{ .Chart.Version }} template: metadata: labels: - app: {{ .Chart.Name }} aadpodidbinding: osdu-identity + app: {{ .Chart.Name }} + appversion: {{ .Chart.Version }} spec: volumes: - - name: azure-keyvault - csi: - driver: secrets-store.csi.k8s.io - readOnly: true - volumeAttributes: - secretProviderClass: azure-keyvault - containers: - - name: {{ .Chart.Name }} - image: {{ .Values.image.repository }}/{{ .Chart.Name }}-{{ .Values.image.branch }}:{{ .Values.image.tag | default .Chart.AppVersion }} - imagePullPolicy: Always - ports: - - containerPort: 8080 - readinessProbe: - httpGet: - path: /api/crs/converter/swagger-ui.html - port: 8080 - volumeMounts: - name: azure-keyvault - mountPath: "/mnt/azure-keyvault" - readOnly: true - env: - - name: spring_application_name - value: crs-conversion-service - - name: server.servlet.contextPath - value: /api/crs/converter/ - - name: server_port - value: "8080" - - name: ACCEPT_HTTP # TEMPORARY UNTIL HTTPS - value: "true" - - name: KEYVAULT_URI - valueFrom: - configMapKeyRef: - name: osdu-svc-properties - key: ENV_KEYVAULT - - name: AZURE_TENANT_ID - valueFrom: - secretKeyRef: - name: active-directory - key: tenantid - - name: AZURE_CLIENT_ID - valueFrom: - secretKeyRef: - name: active-directory - key: principal-clientid - - name: AZURE_CLIENT_SECRET - valueFrom: - secretKeyRef: - name: active-directory - key: principal-clientpassword - - name: appinsights_key - valueFrom: - secretKeyRef: - name: central-logging - key: appinsights - - name: aad_client_id - valueFrom: - secretKeyRef: - name: active-directory - key: application-appid - - name: ENTITLEMENT_URL - value: http://entitlements-azure/entitlements/v1 - - name: azure_istioauth_enabled - value: "true" - + csi: + driver: secrets-store.csi.k8s.io + readOnly: true + volumeAttributes: + secretProviderClass: azure-keyvault + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}/{{ .Chart.Name }}-{{ .Values.image.branch }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.application.port }} + protocol: TCP + readinessProbe: + httpGet: + path: /api/crs/converter/swagger-ui.html + port: {{ .Values.application.port }} + initialDelaySeconds: 45 + timeoutSeconds: 15 + periodSeconds: 2 + successThreshold: 1 + failureThreshold: 5 + volumeMounts: + - name: azure-keyvault + mountPath: "/mnt/azure-keyvault" + readOnly: true + env: + - name: spring_application_name + value: crs-conversion-service + - name: server.servlet.contextPath + value: /api/crs/converter/ + - name: server_port + value: "8080" + - name: ACCEPT_HTTP # TEMPORARY UNTIL HTTPS + value: "true" + - name: KEYVAULT_URI + valueFrom: + configMapKeyRef: + name: osdu-svc-properties + key: ENV_KEYVAULT + - name: AZURE_TENANT_ID + valueFrom: + secretKeyRef: + name: active-directory + key: tenantid + - name: AZURE_CLIENT_ID + valueFrom: + secretKeyRef: + name: active-directory + key: principal-clientid + - name: AZURE_CLIENT_SECRET + valueFrom: + secretKeyRef: + name: active-directory + key: principal-clientpassword + - name: appinsights_key + valueFrom: + secretKeyRef: + name: central-logging + key: appinsights + - name: aad_client_id + valueFrom: + secretKeyRef: + name: active-directory + key: application-appid + - name: ENTITLEMENT_URL + value: http://entitlements-azure/entitlements/v1 + - name: azure_istioauth_enabled + value: "true" + - name: ESRI_DATA_PATH + value: \crs-conversion-service + - name: cosmosdb_database + value: osdu-db + - name: service_domain_name + value: contoso.com diff --git a/devops/azure/chart/templates/service.yaml b/devops/azure/chart/templates/service.yaml index a0134bfb..0e70c075 100644 --- a/devops/azure/chart/templates/service.yaml +++ b/devops/azure/chart/templates/service.yaml @@ -1,13 +1,34 @@ +# Copyright © Microsoft Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. apiVersion: v1 kind: Service metadata: - name: {{ .Chart.Name }} + name: crs-conversion-service namespace: osdu + labels: + resource: "crsService" + app: {{ .Chart.Name }} + appversion: {{ .Chart.Version }} + aadpodidbinding: osdu-identity spec: - type: ClusterIP + type: {{ .Values.service.type }} ports: - - protocol: TCP - port: 80 - targetPort: 8080 + - port: {{ .Values.service.port }} + targetPort: {{ .Values.service.targetport }} + protocol: TCP + name: http selector: app: {{ .Chart.Name }} + appversion: {{ .Chart.Version }} + aadpodidbinding: osdu-identity diff --git a/devops/azure/chart/values.yaml b/devops/azure/chart/values.yaml index 69862f83..bb51c8c5 100644 --- a/devops/azure/chart/values.yaml +++ b/devops/azure/chart/values.yaml @@ -1,10 +1,34 @@ +# Copyright © Microsoft Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + global: replicaCount: 1 image: - repository: ${CONTAINER_REGISTRY_NAME}.azurecr.io/crs-conversion-app - tag: latest + repository: community.opengroup.org:5555/osdu/platform/system/reference/crs-conversion-service pullPolicy: Always - - - + branch: master + tag: latest +service: + type: ClusterIP + port: 80 + targetport: 8080 +application: + port: 8080 +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 diff --git a/devops/azure/pipeline.yml b/devops/azure/pipeline.yml index 23ccad1c..110f4d54 100644 --- a/devops/azure/pipeline.yml +++ b/devops/azure/pipeline.yml @@ -1,4 +1,3 @@ - trigger: batch: true branches: @@ -31,9 +30,6 @@ variables: value: "devops/azure/chart/helm-config.yaml" - name: 'MANIFEST_REPO' value: $[ resources.repositories['FluxRepo'].name ] - - name: dockerFile - value: "devops/azure/Dockerfile" - stages: - template: /devops/build-stage.yml@TemplateRepo parameters: @@ -45,7 +41,6 @@ stages: pom.xml provider/crs-converter-azure/crs-converter-aks/pom.xml provider/crs-converter-azure/crs-converter-aks/target/*.jar - devops/azure/Dockerfile copyFileContentsToFlatten: '' mavenSettingsFile: './maven/settings.xml' serviceBase: ${{ variables.serviceName }} @@ -57,7 +52,6 @@ stages: serviceName: ${{ variables.serviceName }} chartPath: ${{ variables.chartPath }} valuesFile: ${{ variables.valuesFile }} - dockerFile: ${{ variables.dockerFile }} testCoreMavenPomFile: '' testCoreMavenOptions: '' skipDeploy: ${{ variables.SKIP_DEPLOY }} diff --git a/devops/azure/release.yaml b/devops/azure/release.yaml new file mode 100644 index 00000000..30148364 --- /dev/null +++ b/devops/azure/release.yaml @@ -0,0 +1,151 @@ +--- +# Source: crs-converter/templates/service.yaml +# Copyright © Microsoft Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +apiVersion: v1 +kind: Service +metadata: + name: crs-conversion-service + namespace: osdu + labels: + resource: "crsService" + app: crs-converter + appversion: 0.1.0 + aadpodidbinding: osdu-identity +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: 8080 + protocol: TCP + name: http + selector: + app: crs-converter + appversion: 0.1.0 + aadpodidbinding: osdu-identity +--- +# Source: crs-converter/templates/deployment.yaml +# Copyright © Microsoft Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: osdu + name: osdu-gitlab-crs-conversion-service-crs-converter + labels: + app: crs-converter + appversion: 0.1.0 + aadpodidbinding: osdu-identity +spec: + replicas: 1 + selector: + matchLabels: + aadpodidbinding: osdu-identity + app: crs-converter + appversion: 0.1.0 + template: + metadata: + labels: + aadpodidbinding: osdu-identity + app: crs-converter + appversion: 0.1.0 + spec: + volumes: + - name: azure-keyvault + csi: + driver: secrets-store.csi.k8s.io + readOnly: true + volumeAttributes: + secretProviderClass: azure-keyvault + containers: + - name: crs-converter + image: "community.opengroup.org:5555/osdu/platform/system/reference/crs-conversion-service/crs-converter-master:latest" + imagePullPolicy: Always + ports: + - name: http + containerPort: 8080 + protocol: TCP + readinessProbe: + httpGet: + path: /api/crs/converter/swagger-ui.html + port: 8080 + initialDelaySeconds: 45 + timeoutSeconds: 15 + periodSeconds: 2 + successThreshold: 1 + failureThreshold: 5 + volumeMounts: + - name: azure-keyvault + mountPath: "/mnt/azure-keyvault" + readOnly: true + env: + - name: spring_application_name + value: crs-conversion-service + - name: server.servlet.contextPath + value: /api/crs/converter/ + - name: server_port + value: "8080" + - name: ACCEPT_HTTP # TEMPORARY UNTIL HTTPS + value: "true" + - name: KEYVAULT_URI + valueFrom: + configMapKeyRef: + name: osdu-svc-properties + key: ENV_KEYVAULT + - name: AZURE_TENANT_ID + valueFrom: + secretKeyRef: + name: active-directory + key: tenantid + - name: AZURE_CLIENT_ID + valueFrom: + secretKeyRef: + name: active-directory + key: principal-clientid + - name: AZURE_CLIENT_SECRET + valueFrom: + secretKeyRef: + name: active-directory + key: principal-clientpassword + - name: appinsights_key + valueFrom: + secretKeyRef: + name: central-logging + key: appinsights + - name: aad_client_id + valueFrom: + secretKeyRef: + name: active-directory + key: application-appid + - name: ENTITLEMENT_URL + value: http://entitlements-azure/entitlements/v1 + - name: azure_istioauth_enabled + value: "true" + - name: ESRI_DATA_PATH + value: \crs-conversion-service + - name: cosmosdb_database + value: osdu-db + - name: service_domain_name + value: contoso.com \ No newline at end of file diff --git a/provider/crs-converter-azure/crs-converter-aks/pom.xml b/provider/crs-converter-azure/crs-converter-aks/pom.xml index 352b3167..e377fe72 100644 --- a/provider/crs-converter-azure/crs-converter-aks/pom.xml +++ b/provider/crs-converter-azure/crs-converter-aks/pom.xml @@ -22,7 +22,7 @@ </prerequisites> <artifactId>crs-converter-aks</artifactId> - <version>1.0.0-SNAPSHOT</version> + <version>1.0.1-SNAPSHOT</version> <name>crs-converter-aks</name> <description>CRS converter service Azure Kubernetes Deployment</description> diff --git a/testing/crs_converter_test_azure/requirements.txt b/testing/crs_converter_test_azure/requirements.txt new file mode 100644 index 00000000..106c21fe --- /dev/null +++ b/testing/crs_converter_test_azure/requirements.txt @@ -0,0 +1,18 @@ +adal==1.2.2 +boto3==1.14.40 +botocore==1.17.54 +certifi==2019.11.28 +cffi==1.14.0 +chardet==3.0.4 +cryptography==2.8 +docutils==0.15.2 +idna==2.9 +jmespath==0.10.0 +pycparser==2.20 +PyJWT==1.7.1 +python-dateutil==2.8.1 +requests==2.23.0 +s3transfer==0.3.3 +six==1.14.0 +urllib3==1.25.8 +xmlrunner==1.7.7 \ No newline at end of file diff --git a/testing/crs_converter_test_azure/run-integration-tests.sh b/testing/crs_converter_test_azure/run-integration-tests.sh new file mode 100644 index 00000000..63cf9d7c --- /dev/null +++ b/testing/crs_converter_test_azure/run-integration-tests.sh @@ -0,0 +1,38 @@ +#!/usr/bin/bash + +# Install venv for python3 +which apt-get && sudo apt-get install -y python3 python3-pip python3-venv || echo "Not Ubuntu, skipping" +which yum && sudo yum install -y python3 python3-pip python3-venv || echo "Not RHEL, skipping" +# if [[ "$OSTYPE" =~ ^msys ]]; then #windows + # if ! [ -x "$(command -v virtualenv)" ]; then + # python -m pip install virtualenv + # fi + + # python -m venv env + # source env/Scripts/activate + + # python -m pip install --upgrade pip + # python -m pip install -r requirements.txt +# else +python3 -m venv env +#sed -i 's/$1/${1:-}/' env/bin/activate # Fix deactivation bug '$1 unbound variable' +source env/bin/activate +python3 -m pip install --upgrade pip +python3 -m pip install -r requirements.txt + +# Run tests +echo ***RUNNING CRS Converter API TESTS*** +python3 run_test_api.py +TEST_STATUS=$? +echo ***FINISHED CRS Converter API V2 TESTS*** + + +# python3 -m pip freeze > requirements.txt +python3 -m pip uninstall -r requirements.txt -y +deactivate +rm -rf env/ + +if [ $TEST_STATUS -ne 0 ] +then + exit 1 +fi diff --git a/testing/crs_converter_test_azure/run_test_api.py b/testing/crs_converter_test_azure/run_test_api.py new file mode 100644 index 00000000..50ef45ed --- /dev/null +++ b/testing/crs_converter_test_azure/run_test_api.py @@ -0,0 +1,8 @@ +import sys +sys.path.append("..") + +from crs_converter_test_core.test_crs_converter import * + +if __name__ == '__main__': + import xmlrunner + unittest.main(testRunner=xmlrunner.XMLTestRunner(output='test-reports/v2', outsuffix='azure')) -- GitLab