istio

Форк
0
/
helm_upgrade_test.go 
119 строк · 3.9 Кб
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 helmupgrade
19

20
import (
21
	"testing"
22

23
	"github.com/Masterminds/semver/v3"
24

25
	"istio.io/istio/pkg/test/env"
26
	"istio.io/istio/pkg/test/framework"
27
	"istio.io/istio/pkg/test/framework/resource"
28
	"istio.io/istio/pkg/util/image"
29
)
30

31
var (
32
	previousSupportedVersion string
33
	nMinusTwoVersion         string
34
)
35

36
const imageToCheck = "gcr.io/istio-release/pilot"
37

38
func initVersions(ctx resource.Context) error {
39
	versionFromFile, err := env.ReadVersion()
40
	if err != nil {
41
		return err
42
	}
43

44
	v, err := semver.NewVersion(versionFromFile)
45
	if err != nil {
46
		return err
47
	}
48

49
	previousVersion := semver.New(v.Major(), v.Minor()-1, v.Patch(), v.Prerelease(), v.Metadata())
50

51
	// If the previous version is not published yet, use the latest one
52
	if exists, err := image.Exists(imageToCheck + ":" + previousVersion.String()); err != nil {
53
		return err
54
	} else if !exists {
55
		previousVersion = semver.New(v.Major(), v.Minor()-2, v.Patch(), v.Prerelease(), v.Metadata())
56
	}
57

58
	previousSupportedVersion = previousVersion.String()
59
	nMinusTwoVersion = semver.New(previousVersion.Major(), previousVersion.Minor()-1, previousVersion.Patch(),
60
		previousVersion.Prerelease(), previousVersion.Metadata()).String()
61

62
	// Workaround publish issues
63
	if previousSupportedVersion == "1.17.0" {
64
		previousSupportedVersion = "1.17.1"
65
	}
66
	if nMinusTwoVersion == "1.17.0" {
67
		nMinusTwoVersion = "1.17.1"
68
	}
69

70
	return nil
71
}
72

73
// TestDefaultInPlaceUpgradeFromPreviousMinorRelease tests Istio upgrade using Helm with default options for Istio 1.(n-1)
74
func TestDefaultInPlaceUpgradeFromPreviousMinorRelease(t *testing.T) {
75
	framework.
76
		NewTest(t).
77
		Features("installation.helm.default.upgrade").
78
		Run(performInPlaceUpgradeFunc(previousSupportedVersion, false))
79
}
80

81
// TestCanaryUpgradeFromPreviousMinorRelease tests Istio upgrade using Helm with default options for Istio 1.(n-1)
82
func TestCanaryUpgradeFromPreviousMinorRelease(t *testing.T) {
83
	framework.
84
		NewTest(t).
85
		Features("installation.helm.default.upgrade").
86
		Run(performCanaryUpgradeFunc(previousSupportedVersion))
87
}
88

89
// TestCanaryUpgradeFromTwoMinorRelease tests Istio upgrade using Helm with default options for Istio 1.(n-2)
90
func TestCanaryUpgradeFromTwoMinorRelease(t *testing.T) {
91
	framework.
92
		NewTest(t).
93
		Features("installation.helm.default.upgrade").
94
		Run(performCanaryUpgradeFunc(nMinusTwoVersion))
95
}
96

97
// TestStableRevisionLabelsUpgradeFromPreviousMinorRelease tests Istio upgrade using Helm with default options for Istio 1.(n-1)
98
func TestStableRevisionLabelsUpgradeFromPreviousMinorRelease(t *testing.T) {
99
	framework.
100
		NewTest(t).
101
		Features("installation.helm.default.upgrade").
102
		Run(performRevisionTagsUpgradeFunc(previousSupportedVersion))
103
}
104

105
// TestStableRevisionLabelsUpgradeFromTwoMinorRelease tests Istio upgrade using Helm with default options for Istio 1.(n-2)
106
func TestStableRevisionLabelsUpgradeFromTwoMinorRelease(t *testing.T) {
107
	framework.
108
		NewTest(t).
109
		Features("installation.helm.default.upgrade").
110
		Run(performRevisionTagsUpgradeFunc(nMinusTwoVersion))
111
}
112

113
// TestAmbientInPlaceUpgradeFromPreviousMinorRelease tests Istio upgrade using Helm with ambient profile for Istio 1.(n-1)
114
func TestAmbientInPlaceUpgradeFromPreviousMinorRelease(t *testing.T) {
115
	framework.
116
		NewTest(t).
117
		Features("installation.helm.ambient.upgrade").
118
		Run(performInPlaceUpgradeFunc(previousSupportedVersion, true))
119
}
120

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

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

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

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