From 0b4114ddfd6663aaafeaacb983335140cd44a358 Mon Sep 17 00:00:00 2001 From: Konrad Bańka Date: Wed, 13 Jan 2021 13:39:53 +0100 Subject: Provide simple v3 chart mock test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue-ID: MULTICLOUD-1267 Signed-off-by: Konrad Bańka Change-Id: Ib05167a6e0e2c69268bcd85c0ae3fa30fdd78e39 --- src/k8splugin/internal/helm/helm_test.go | 11 ++++++++ .../mock_files/mock_charts/mockv3/Chart.yaml | 6 ++++ .../mock_charts/mockv3/templates/deployment.yaml | 32 ++++++++++++++++++++++ .../mock_files/mock_charts/mockv3/values.yaml | 6 ++++ 4 files changed, 55 insertions(+) create mode 100644 src/k8splugin/mock_files/mock_charts/mockv3/Chart.yaml create mode 100644 src/k8splugin/mock_files/mock_charts/mockv3/templates/deployment.yaml create mode 100644 src/k8splugin/mock_files/mock_charts/mockv3/values.yaml (limited to 'src/k8splugin') diff --git a/src/k8splugin/internal/helm/helm_test.go b/src/k8splugin/internal/helm/helm_test.go index 817bbaa3..d25ca091 100644 --- a/src/k8splugin/internal/helm/helm_test.go +++ b/src/k8splugin/internal/helm/helm_test.go @@ -1,5 +1,6 @@ /* * Copyright 2018 Intel Corporation, Inc + * Copyright 2020,2021 Samsung Electronics, Modifications * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -182,6 +183,16 @@ func TestGenerateKubernetesArtifacts(t *testing.T) { }, expectedError: "", }, + { + label: "Test simple v3 helm charts support", + chartPath: "../../mock_files/mock_charts/mockv3", + valueFiles: []string{}, + values: []string{}, + expectedError: "", + expectedHashMap: map[string]string{ + "mockv3/templates/deployment.yaml": "259a027a4957e7428eb1d2e774fa1afaa62449521853f8b2916887040bae2ca4", + }, + }, } h := sha256.New() diff --git a/src/k8splugin/mock_files/mock_charts/mockv3/Chart.yaml b/src/k8splugin/mock_files/mock_charts/mockv3/Chart.yaml new file mode 100644 index 00000000..97233399 --- /dev/null +++ b/src/k8splugin/mock_files/mock_charts/mockv3/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: mockv3 +description: A Helm chart for Kubernetes +type: application +version: 0.1.0 +appVersion: 1.16.0 diff --git a/src/k8splugin/mock_files/mock_charts/mockv3/templates/deployment.yaml b/src/k8splugin/mock_files/mock_charts/mockv3/templates/deployment.yaml new file mode 100644 index 00000000..b901e337 --- /dev/null +++ b/src/k8splugin/mock_files/mock_charts/mockv3/templates/deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: dummy + labels: + dummy: yes +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + dummy: yes + template: + metadata: + labels: + dummy: yes + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 80 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http diff --git a/src/k8splugin/mock_files/mock_charts/mockv3/values.yaml b/src/k8splugin/mock_files/mock_charts/mockv3/values.yaml new file mode 100644 index 00000000..43850077 --- /dev/null +++ b/src/k8splugin/mock_files/mock_charts/mockv3/values.yaml @@ -0,0 +1,6 @@ +replicaCount: 1 + +image: + repository: nginx + pullPolicy: IfNotPresent + tag: "" -- cgit 1.2.3-korg