Skip to content

Commit 9618356

Browse files
authored
Support all 7.x versions of Elasticsearch (#1075) (#1085)
1 parent abef7e9 commit 9618356

File tree

2 files changed

+68
-2
lines changed

2 files changed

+68
-2
lines changed

operators/pkg/controller/elasticsearch/driver/driver.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@ func SupportedVersions(v version.Version) *esversion.LowestHighestSupportedVersi
111111
// Min. version is 6.7.0 for now. Will be 6.8.0 soon.
112112
LowestSupportedVersion: version.MustParse("6.7.0"),
113113
// higher may be possible, but not proven yet, lower may also be a requirement...
114-
HighestSupportedVersion: version.MustParse("6.8.99"),
114+
HighestSupportedVersion: version.MustParse("6.99.99"),
115115
}
116116
case 7:
117117
res = &esversion.LowestHighestSupportedVersions{
118118
// 6.7.0 is the lowest wire compatibility version for 7.x
119119
LowestSupportedVersion: version.MustParse("6.7.0"),
120120
// higher may be possible, but not proven yet, lower may also be a requirement...
121-
HighestSupportedVersion: version.MustParse("7.1.99"),
121+
HighestSupportedVersion: version.MustParse("7.99.99"),
122122
}
123123
}
124124
return res
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
2+
// or more contributor license agreements. Licensed under the Elastic License;
3+
// you may not use this file except in compliance with the Elastic License.
4+
5+
package driver
6+
7+
import (
8+
"testing"
9+
10+
"github.com/elastic/cloud-on-k8s/operators/pkg/controller/common/version"
11+
"github.com/stretchr/testify/require"
12+
)
13+
14+
func TestSupportedVersions(t *testing.T) {
15+
type args struct {
16+
v version.Version
17+
}
18+
tests := []struct {
19+
name string
20+
args args
21+
supported []version.Version
22+
unsupported []version.Version
23+
}{
24+
{
25+
name: "6.x",
26+
args: args{
27+
v: version.MustParse("6.8.0"),
28+
},
29+
supported: []version.Version{
30+
version.MustParse("6.7.0"),
31+
version.MustParse("6.8.0"),
32+
version.MustParse("6.99.99"),
33+
},
34+
unsupported: []version.Version{
35+
version.MustParse("6.5.0"),
36+
version.MustParse("7.0.0"),
37+
},
38+
},
39+
{
40+
name: "7.x",
41+
args: args{
42+
v: version.MustParse("7.1.0"),
43+
},
44+
supported: []version.Version{
45+
version.MustParse("6.7.0"), //wire compat
46+
version.MustParse("7.2.0"),
47+
version.MustParse("7.99.99"),
48+
},
49+
unsupported: []version.Version{
50+
version.MustParse("6.6.0"),
51+
version.MustParse("8.0.0"),
52+
},
53+
},
54+
}
55+
for _, tt := range tests {
56+
t.Run(tt.name, func(t *testing.T) {
57+
vs := SupportedVersions(tt.args.v)
58+
for _, v := range tt.supported {
59+
require.NoError(t, vs.Supports(v))
60+
}
61+
for _, v := range tt.unsupported {
62+
require.Error(t, vs.Supports(v))
63+
}
64+
})
65+
}
66+
}

0 commit comments

Comments
 (0)