Skip to content

Commit cfad2ac

Browse files
authored
Add 8.17, 8.18, 8.19 and 9.1 active versions tests (#16394)
1 parent 36f936d commit cfad2ac

File tree

9 files changed

+453
-24
lines changed

9 files changed

+453
-24
lines changed

functionaltests/8_16_test.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ import (
2323
"github.com/elastic/go-elasticsearch/v8/typedapi/types"
2424
)
2525

26+
// In 8.15, the data stream management was migrated from ILM to DSL.
27+
// However, a bug was introduced, causing data streams to be unmanaged.
28+
// See https://github.com/elastic/apm-server/issues/13898.
29+
//
30+
// It was fixed by defaulting data stream management to DSL, and eventually
31+
// reverted back to ILM in 8.17. Therefore, data streams created in 8.15 and
32+
// 8.16 are managed by DSL instead of ILM.
33+
2634
func TestUpgrade_8_15_to_8_16_Snapshot(t *testing.T) {
2735
t.Parallel()
2836

@@ -52,8 +60,8 @@ func TestUpgrade_8_15_to_8_16_BC(t *testing.T) {
5260
t.Parallel()
5361

5462
scenarios := basicUpgradeLazyRolloverDSLTestScenarios(
55-
getLatestVersion(t, "8.15"),
56-
getBCVersionOrSkip(t, "8.16"),
63+
getLatestVersionOrSkip(t, "8.15"),
64+
getLatestBCOrSkip(t, "8.16"),
5765
[]types.Query{
5866
tlsHandshakeError,
5967
esReturnedUnknown503,

functionaltests/8_17_test.go

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
// Licensed to Elasticsearch B.V. under one or more contributor
2+
// license agreements. See the NOTICE file distributed with
3+
// this work for additional information regarding copyright
4+
// ownership. Elasticsearch B.V. licenses this file to you under
5+
// the Apache License, Version 2.0 (the "License"); you may
6+
// not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
package functionaltests
19+
20+
import (
21+
"testing"
22+
23+
"github.com/elastic/go-elasticsearch/v8/typedapi/types"
24+
25+
"github.com/elastic/apm-server/functionaltests/internal/asserts"
26+
)
27+
28+
// In 8.15, the data stream management was migrated from ILM to DSL.
29+
// However, a bug was introduced, causing data streams to be unmanaged.
30+
// See https://github.com/elastic/apm-server/issues/13898.
31+
//
32+
// It was fixed by defaulting data stream management to DSL, and eventually
33+
// reverted back to ILM in 8.17. Therefore, data streams created in 8.15 and
34+
// 8.16 are managed by DSL instead of ILM.
35+
36+
func TestUpgrade_8_16_to_8_17_Snapshot(t *testing.T) {
37+
t.Parallel()
38+
39+
scenarios := allBasicUpgradeScenarios(
40+
getLatestSnapshot(t, "8.16"),
41+
getLatestSnapshot(t, "8.17"),
42+
// Data streams managed by DSL pre-upgrade.
43+
asserts.CheckDataStreamsWant{
44+
Quantity: 8,
45+
PreferIlm: false,
46+
DSManagedBy: managedByDSL,
47+
IndicesPerDS: 1,
48+
IndicesManagedBy: []string{managedByDSL},
49+
},
50+
// Data streams managed by ILM post-upgrade.
51+
// However, the index created before upgrade is still managed by DSL.
52+
asserts.CheckDataStreamsWant{
53+
Quantity: 8,
54+
PreferIlm: true,
55+
DSManagedBy: managedByILM,
56+
IndicesPerDS: 1,
57+
IndicesManagedBy: []string{managedByDSL},
58+
},
59+
// Verify lazy rollover happened, i.e. 2 indices.
60+
asserts.CheckDataStreamsWant{
61+
Quantity: 8,
62+
PreferIlm: true,
63+
DSManagedBy: managedByILM,
64+
IndicesPerDS: 2,
65+
IndicesManagedBy: []string{managedByDSL, managedByILM},
66+
},
67+
[]types.Query{
68+
tlsHandshakeError,
69+
esReturnedUnknown503,
70+
refreshCache503,
71+
refreshCacheCtxCanceled,
72+
populateSourcemapFetcher403,
73+
},
74+
)
75+
for _, scenario := range scenarios {
76+
t.Run(scenario.Name, func(t *testing.T) {
77+
t.Parallel()
78+
scenario.Runner.Run(t)
79+
})
80+
}
81+
}
82+
83+
func TestUpgrade_8_16_to_8_17_BC(t *testing.T) {
84+
t.Parallel()
85+
86+
scenarios := allBasicUpgradeScenarios(
87+
getLatestVersionOrSkip(t, "8.16"),
88+
getLatestBCOrSkip(t, "8.17"),
89+
// Data streams managed by DSL pre-upgrade.
90+
asserts.CheckDataStreamsWant{
91+
Quantity: 8,
92+
PreferIlm: false,
93+
DSManagedBy: managedByDSL,
94+
IndicesPerDS: 1,
95+
IndicesManagedBy: []string{managedByDSL},
96+
},
97+
// Data streams managed by ILM post-upgrade.
98+
// However, the index created before upgrade is still managed by DSL.
99+
asserts.CheckDataStreamsWant{
100+
Quantity: 8,
101+
PreferIlm: true,
102+
DSManagedBy: managedByILM,
103+
IndicesPerDS: 1,
104+
IndicesManagedBy: []string{managedByDSL},
105+
},
106+
// Verify lazy rollover happened, i.e. 2 indices.
107+
asserts.CheckDataStreamsWant{
108+
Quantity: 8,
109+
PreferIlm: true,
110+
DSManagedBy: managedByILM,
111+
IndicesPerDS: 2,
112+
IndicesManagedBy: []string{managedByDSL, managedByILM},
113+
},
114+
[]types.Query{
115+
tlsHandshakeError,
116+
esReturnedUnknown503,
117+
refreshCache503,
118+
refreshCacheCtxCanceled,
119+
populateSourcemapFetcher403,
120+
},
121+
)
122+
for _, scenario := range scenarios {
123+
t.Run(scenario.Name, func(t *testing.T) {
124+
t.Parallel()
125+
scenario.Runner.Run(t)
126+
})
127+
}
128+
}

functionaltests/8_18_test.go

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// Licensed to Elasticsearch B.V. under one or more contributor
2+
// license agreements. See the NOTICE file distributed with
3+
// this work for additional information regarding copyright
4+
// ownership. Elasticsearch B.V. licenses this file to you under
5+
// the Apache License, Version 2.0 (the "License"); you may
6+
// not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
package functionaltests
19+
20+
import (
21+
"testing"
22+
23+
"github.com/elastic/go-elasticsearch/v8/typedapi/types"
24+
)
25+
26+
func TestUpgrade_8_17_to_8_18_Snapshot(t *testing.T) {
27+
t.Parallel()
28+
29+
scenarios := basicUpgradeILMTestScenarios(
30+
getLatestSnapshot(t, "8.17"),
31+
getLatestSnapshot(t, "8.18"),
32+
[]types.Query{
33+
tlsHandshakeError,
34+
esReturnedUnknown503,
35+
refreshCache503,
36+
populateSourcemapFetcher403,
37+
},
38+
)
39+
for _, scenario := range scenarios {
40+
t.Run(scenario.Name, func(t *testing.T) {
41+
t.Parallel()
42+
scenario.Runner.Run(t)
43+
})
44+
}
45+
}
46+
47+
func TestUpgrade_8_17_to_8_18_BC(t *testing.T) {
48+
t.Parallel()
49+
50+
scenarios := basicUpgradeILMTestScenarios(
51+
getLatestVersionOrSkip(t, "8.17"),
52+
getLatestBCOrSkip(t, "8.18"),
53+
[]types.Query{
54+
tlsHandshakeError,
55+
esReturnedUnknown503,
56+
refreshCache503,
57+
populateSourcemapFetcher403,
58+
},
59+
)
60+
for _, scenario := range scenarios {
61+
t.Run(scenario.Name, func(t *testing.T) {
62+
t.Parallel()
63+
scenario.Runner.Run(t)
64+
})
65+
}
66+
}

functionaltests/8_19_test.go

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// Licensed to Elasticsearch B.V. under one or more contributor
2+
// license agreements. See the NOTICE file distributed with
3+
// this work for additional information regarding copyright
4+
// ownership. Elasticsearch B.V. licenses this file to you under
5+
// the Apache License, Version 2.0 (the "License"); you may
6+
// not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
package functionaltests
19+
20+
import (
21+
"testing"
22+
23+
"github.com/elastic/go-elasticsearch/v8/typedapi/types"
24+
)
25+
26+
// Data streams get marked for lazy rollover by ES when something
27+
// changed in the underlying template(s), which in this case is
28+
// the apm-data plugin update for 8.19 and 9.1:
29+
// https://github.com/elastic/elasticsearch/pull/119995.
30+
31+
func TestUpgrade_8_18_to_8_19_Snapshot(t *testing.T) {
32+
t.Parallel()
33+
34+
scenarios := basicUpgradeLazyRolloverILMTestScenarios(
35+
getLatestSnapshot(t, "8.18"),
36+
getLatestSnapshot(t, "8.19"),
37+
[]types.Query{
38+
tlsHandshakeError,
39+
esReturnedUnknown503,
40+
refreshCache503,
41+
populateSourcemapFetcher403,
42+
},
43+
)
44+
for _, scenario := range scenarios {
45+
t.Run(scenario.Name, func(t *testing.T) {
46+
t.Parallel()
47+
scenario.Runner.Run(t)
48+
})
49+
}
50+
}
51+
52+
func TestUpgrade_8_18_to_8_19_BC(t *testing.T) {
53+
t.Parallel()
54+
55+
scenarios := basicUpgradeLazyRolloverILMTestScenarios(
56+
getLatestVersionOrSkip(t, "8.18"),
57+
getLatestBCOrSkip(t, "8.19"),
58+
[]types.Query{
59+
tlsHandshakeError,
60+
esReturnedUnknown503,
61+
refreshCache503,
62+
populateSourcemapFetcher403,
63+
},
64+
)
65+
for _, scenario := range scenarios {
66+
t.Run(scenario.Name, func(t *testing.T) {
67+
t.Parallel()
68+
scenario.Runner.Run(t)
69+
})
70+
}
71+
}

functionaltests/9_0_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ func TestUpgrade_8_18_to_9_0_BC(t *testing.T) {
4949
t.Parallel()
5050

5151
scenarios := basicUpgradeILMTestScenarios(
52-
getLatestVersion(t, "8.18"),
53-
getBCVersionOrSkip(t, "9.0"),
52+
getLatestVersionOrSkip(t, "8.18"),
53+
getLatestBCOrSkip(t, "9.0"),
5454
[]types.Query{
5555
tlsHandshakeError,
5656
esReturnedUnknown503,

0 commit comments

Comments
 (0)