Skip to content

Commit 1cbc204

Browse files
authored
[chore] Fix upgrade tests on main (#1715)
This change simplifies the tests to always use the latest published version of the chart as a base for the upgrade
1 parent 24a84b3 commit 1cbc204

File tree

7 files changed

+29
-44
lines changed

7 files changed

+29
-44
lines changed

.github/workflows/functional_test_v2.yaml

Lines changed: 14 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -143,22 +143,11 @@ jobs:
143143
continue-on-error: ${{ contains(github.event.pull_request.labels.*.name, 'Ignore Tests') }}
144144
steps:
145145
- uses: actions/checkout@v4
146-
- name: Checkout main if in a PR
147-
if: github.event_name == 'pull_request'
148-
uses: actions/checkout@v4
149-
with:
150-
path: base
151-
ref: main
152-
- name: Checkout previous main commit if in main
153-
if: github.event_name != 'pull_request'
154-
uses: actions/checkout@v4
155-
with:
156-
path: base
157-
ref: HEAD
158-
fetch-depth: 2
159-
- name: Checkout previous main commit if in main
160-
if: github.event_name != 'pull_request'
161-
run: cd base && git checkout HEAD^
146+
- name: Download the latest published release to use as a base for the upgrade
147+
run: |
148+
helm repo add splunk-otel-collector-chart https://signalfx.github.io/splunk-otel-collector-chart
149+
helm repo update
150+
helm pull splunk-otel-collector-chart/splunk-otel-collector --untar --untardir base
162151
- uses: actions/setup-go@v5
163152
with:
164153
go-version: ${{ env.GO_VERSION }}
@@ -174,12 +163,12 @@ jobs:
174163
aws eks update-kubeconfig --name rotel-eks --region us-west-1
175164
- name: Update dependencies
176165
run: |
177-
make dep-update && cd base && make dep-update
166+
make dep-update
178167
- name: run functional tests
179168
env:
180169
HOST_ENDPOINT: 0.0.0.0
181170
UPGRADE_FROM_VALUES: aws_upgrade_from_previous_release_values.yaml
182-
UPGRADE_FROM_CHART_DIR: base
171+
UPGRADE_FROM_CHART_DIR: base/splunk-otel-collector
183172
run: |
184173
TEARDOWN_BEFORE_SETUP=true SUITE=functional make functionaltest
185174
@@ -232,22 +221,11 @@ jobs:
232221
continue-on-error: ${{ contains(github.event.pull_request.labels.*.name, 'Ignore Tests') }}
233222
steps:
234223
- uses: actions/checkout@v4
235-
- name: Checkout main if in a PR
236-
if: github.event_name == 'pull_request'
237-
uses: actions/checkout@v4
238-
with:
239-
path: base
240-
ref: main
241-
- name: Checkout previous main commit if in main
242-
if: github.event_name != 'pull_request'
243-
uses: actions/checkout@v4
244-
with:
245-
path: base
246-
ref: HEAD
247-
fetch-depth: 2
248-
- name: Checkout previous main commit if in main
249-
if: github.event_name != 'pull_request'
250-
run: cd base && git checkout HEAD^
224+
- name: Download the latest published release to use as a base for the upgrade
225+
run: |
226+
helm repo add splunk-otel-collector-chart https://signalfx.github.io/splunk-otel-collector-chart
227+
helm repo update
228+
helm pull splunk-otel-collector-chart/splunk-otel-collector --untar --untardir base
251229
- uses: actions/setup-go@v5
252230
with:
253231
go-version: ${{ env.GO_VERSION }}
@@ -266,12 +244,12 @@ jobs:
266244
project_id: ${{ secrets.GKE_PROJECT }}
267245
- name: Update dependencies
268246
run: |
269-
make dep-update && cd base && make dep-update
247+
make dep-update
270248
- name: run functional tests
271249
env:
272250
HOST_ENDPOINT: 0.0.0.0
273251
UPGRADE_FROM_VALUES: gke_autopilot_upgrade_from_previous_release_values.yaml
274-
UPGRADE_FROM_CHART_DIR: base
252+
UPGRADE_FROM_CHART_DIR: base/splunk-otel-collector
275253
run: |
276254
TEARDOWN_BEFORE_SETUP=true SUITE=functional make functionaltest
277255

functional_tests/configuration_switching/configuration_switching_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func deployChartsAndApps(t *testing.T, valuesFileName string, repl map[string]in
6969
client, err := kubernetes.NewForConfig(kubeConfig)
7070
require.NoError(t, err)
7171

72-
chart := internal.LoadCollectorChart(t, "")
72+
chart := internal.LoadCollectorChart(t)
7373

7474
var valuesBytes []byte
7575
valuesBytes, err = os.ReadFile(filepath.Join(testDir, valuesDir, valuesFileName))

functional_tests/functional/functional_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ func deployChartsAndApps(t *testing.T, testKubeConfig string) {
185185
}
186186
}, 1*time.Minute, 5*time.Second)
187187

188-
chart := internal.LoadCollectorChart(t, "")
188+
chart := internal.LoadCollectorChart(t)
189189

190190
var valuesBytes []byte
191191
switch kubeTestEnv {
@@ -251,9 +251,10 @@ func deployChartsAndApps(t *testing.T, testKubeConfig string) {
251251
// install the base chart
252252
initValuesBytes, rfErr := os.ReadFile(filepath.Join(testDir, valuesDir, upgradeFromValues))
253253
require.NoError(t, rfErr)
254-
initChart := internal.LoadCollectorChart(t, os.Getenv("UPGRADE_FROM_CHART_DIR"))
254+
initChart := internal.LoadCollectorChartFromDir(t, os.Getenv("UPGRADE_FROM_CHART_DIR"))
255255
var initValues map[string]interface{}
256256
require.NoError(t, yaml.Unmarshal(initValuesBytes, &initValues))
257+
t.Log("Running helm install of the base release")
257258
_, err = install.Run(initChart, initValues)
258259
require.NoError(t, err)
259260

@@ -262,8 +263,10 @@ func deployChartsAndApps(t *testing.T, testKubeConfig string) {
262263
upgrade.Namespace = "default"
263264
upgrade.Install = true
264265
upgrade.Timeout = helmActionTimeout
266+
t.Log("Running helm upgrade")
265267
_, err = upgrade.Run("sock", chart, values)
266268
} else {
269+
t.Log("Running helm install")
267270
_, err = install.Run(chart, values)
268271
}
269272
require.NoError(t, err)

functional_tests/histogram/histogram_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func deployChartsAndApps(t *testing.T) {
5959
testKubeConfig, setKubeConfig := os.LookupEnv("KUBECONFIG")
6060
require.True(t, setKubeConfig, "the environment variable KUBECONFIG must be set")
6161

62-
chart := internal.LoadCollectorChart(t, "")
62+
chart := internal.LoadCollectorChart(t)
6363

6464
valuesBytes, err := os.ReadFile(filepath.Join("testdata", valuesDir, "test_values.yaml.tmpl"))
6565
require.NoError(t, err)

functional_tests/internal/common.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,12 @@ func LabelNamespace(t *testing.T, clientset *kubernetes.Clientset, name, key, va
168168
require.NoError(t, err)
169169
}
170170

171-
func LoadCollectorChart(t *testing.T, subdir string) *chart.Chart {
172-
chartPath := filepath.Join("..", "..", subdir, "helm-charts", "splunk-otel-collector")
171+
func LoadCollectorChart(t *testing.T) *chart.Chart {
172+
return LoadCollectorChartFromDir(t, "helm-charts/splunk-otel-collector")
173+
}
174+
175+
func LoadCollectorChartFromDir(t *testing.T, dir string) *chart.Chart {
176+
chartPath := filepath.Join("..", "..", dir)
173177
c, err := loader.Load(chartPath)
174178
require.NoError(t, err)
175179
return c

functional_tests/istio/istio_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func deployIstioAndCollector(t *testing.T) {
120120
// Send traffic through ingress gateways
121121
sendWorkloadHTTPRequests(t)
122122

123-
chart := internal.LoadCollectorChart(t, "")
123+
chart := internal.LoadCollectorChart(t)
124124

125125
valuesBytes, err := os.ReadFile(filepath.Join("testdata", "istio_values.yaml.tmpl"))
126126
require.NoError(t, err)

functional_tests/k8sevents/k8sevents_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func deployWorkloadAndCollector(t *testing.T) {
153153
k8sClient, err := k8stest.NewK8sClient(testKubeConfig)
154154
require.NoError(t, err)
155155

156-
chart := internal.LoadCollectorChart(t, "")
156+
chart := internal.LoadCollectorChart(t)
157157

158158
valuesBytes, err := os.ReadFile(filepath.Join("testdata", "k8sevents_values.yaml.tmpl"))
159159
require.NoError(t, err)

0 commit comments

Comments
 (0)