istio

Форк
0
/
install_test.go 
86 строк · 2.5 Кб
1
//go:build integ
2
// +build integ
3

4
// Copyright Istio Authors
5
//
6
// Licensed under the Apache License, Version 2.0 (the "License");
7
// you may not use this file except in compliance with the License.
8
// You may obtain a copy of the License at
9
//
10
//     http://www.apache.org/licenses/LICENSE-2.0
11
//
12
// Unless required by applicable law or agreed to in writing, software
13
// distributed under the License is distributed on an "AS IS" BASIS,
14
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
// See the License for the specific language governing permissions and
16
// limitations under the License.
17

18
package helm
19

20
import (
21
	"fmt"
22
	"os"
23
	"path/filepath"
24
	"testing"
25

26
	"istio.io/istio/pkg/test/framework"
27
	kubecluster "istio.io/istio/pkg/test/framework/components/cluster/kube"
28
	"istio.io/istio/pkg/test/framework/components/namespace"
29
	"istio.io/istio/pkg/test/helm"
30
	"istio.io/istio/tests/util/sanitycheck"
31
)
32

33
// TestDefaultInstall tests Istio installation using Helm with default options
34
func TestDefaultInstall(t *testing.T) {
35
	overrideValuesStr := `
36
global:
37
  hub: %s
38
  tag: %s
39
`
40
	framework.
41
		NewTest(t).
42
		Features("installation.helm.default.install").
43
		Run(setupInstallation(overrideValuesStr, false))
44
}
45

46
// TestAmbientInstall tests Istio ambient profile installation using Helm
47
func TestAmbientInstall(t *testing.T) {
48
	framework.
49
		NewTest(t).
50
		Features("installation.helm.ambient.install").
51
		Run(setupInstallation(ambientProfileOverride, true))
52
}
53

54
func setupInstallation(overrideValuesStr string, isAmbient bool) func(t framework.TestContext) {
55
	return func(t framework.TestContext) {
56
		workDir, err := t.CreateTmpDirectory("helm-install-test")
57
		if err != nil {
58
			t.Fatal("failed to create test directory")
59
		}
60
		cs := t.Clusters().Default().(*kubecluster.Cluster)
61
		h := helm.New(cs.Filename())
62
		s := t.Settings()
63
		overrideValues := fmt.Sprintf(overrideValuesStr, s.Image.Hub, s.Image.Tag)
64
		overrideValuesFile := filepath.Join(workDir, "values.yaml")
65
		if err := os.WriteFile(overrideValuesFile, []byte(overrideValues), os.ModePerm); err != nil {
66
			t.Fatalf("failed to write iop cr file: %v", err)
67
		}
68
		t.Cleanup(func() {
69
			if !t.Failed() {
70
				return
71
			}
72
			if t.Settings().CIMode {
73
				namespace.Dump(t, IstioNamespace)
74
			}
75
		})
76
		InstallIstio(t, cs, h, overrideValuesFile, "", true, isAmbient)
77

78
		VerifyInstallation(t, cs, true, isAmbient)
79
		verifyValidation(t)
80

81
		sanitycheck.RunTrafficTest(t, t)
82
		t.Cleanup(func() {
83
			DeleteIstio(t, h, cs, isAmbient)
84
		})
85
	}
86
}
87

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.