Skip to content

Commit 193d3cc

Browse files
authored
Fix RHEL 8 provisioning in tests (#769)
This fixes several things: - Drop tests for 4.0 and earlier. - Newer RHEL 8.0 builds are published as just `rhel-8` rather than `rhel-80`. We now treat these identically. - Ignore release-candidate releases when iterating the release feed. Thus, testing `8.0` tests (as of this writing) 8.0.5 rather than 8.0.6-rc1. - Test no server versions newer than a hard-coded max version, which is currently 8.0.999. Thus, `latest` tests (as of this writing) 8.0.6-rc1 rather than an 8.1.0 alpha release. - mongodump testing now makes 6.0 and 7.0 builds accommodate mixed time-series schemas as needed. - (Unrelated, but worthy) Checks for CannotInsertTimeseriesBucketsWithMixedSchema errors now use mongo.ServerError.HasErrorCode(), which is more comprehensive than type-asserting to specific concrete error types. Additionally, this accommodates the following recent `mongo` shell changes: - SERVER-91804: Test runs now fail by default if child processes remain unterminated. We now always set `TestData.ignoreUnterminatedProcesses` to true. - SERVER-81339: The `ReplSetTest` global no longer exists by default. This changeset copies replsettest.js from v8.0 and imports it when the `mongo` version matches.
1 parent 8ece9ae commit 193d3cc

File tree

14 files changed

+4271
-272
lines changed

14 files changed

+4271
-272
lines changed

Diff for: .eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
# eslint fails to parse this file for some reason
22
test/qa-tests/jstests/ssl/ssl_with_system_ca.js
3+
4+
test/qa-tests/jstests/libs/replsettest-*.js

Diff for: buildscript/build.go

+13-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bytes"
55
"fmt"
66
"io"
7+
"log"
78
"os"
89
"os/exec"
910
"path/filepath"
@@ -275,9 +276,18 @@ func selectedPkgs(ctx *task.Context) []string {
275276
return selectedPkgs
276277
}
277278

278-
func getPlatform() (platform.Platform, error) {
279+
func getPlatform() (pf platform.Platform, err error) {
279280
if os.Getenv("CI") != "" {
280-
return platform.GetFromEnv()
281+
pf, err = platform.GetFromEnv()
282+
if err == nil {
283+
log.Printf("Platform from env: %+v\n", pf)
284+
}
285+
} else {
286+
pf, err = platform.DetectLocal()
287+
if err == nil {
288+
log.Printf("Platform detected: %+v\n", pf)
289+
}
281290
}
282-
return platform.DetectLocal()
291+
292+
return
283293
}

Diff for: common.yml

-159
Original file line numberDiff line numberDiff line change
@@ -771,119 +771,6 @@ tasks:
771771
- command: expansions.update
772772
- func: "generate full JSON feed"
773773

774-
- name: integration-3.6
775-
tags: ["3.6"]
776-
commands:
777-
- func: "fetch source"
778-
- command: expansions.update
779-
- func: "download mongod and shell"
780-
vars:
781-
mongo_version: "3.6"
782-
- func: "start mongod"
783-
- func: "wait for mongod to be ready"
784-
- func: "run make target"
785-
vars:
786-
target: build
787-
- func: "run make target"
788-
vars:
789-
target: test:integration -ssl=true ${testArgs}
790-
791-
- name: integration-3.6-mmapv1
792-
tags: ["3.6", "mmap"]
793-
commands:
794-
- func: "fetch source"
795-
- command: expansions.update
796-
- func: "download mongod and shell"
797-
vars:
798-
mongo_version: "3.6"
799-
- func: "start mongod"
800-
vars:
801-
STORAGE_ENGINE: "mmapv1"
802-
- func: "wait for mongod to be ready"
803-
- func: "run make target"
804-
vars:
805-
target: build
806-
- func: "run make target"
807-
vars:
808-
target: test:integration -ssl=true ${testArgs}
809-
810-
- name: integration-4.0
811-
tags: ["4.0"]
812-
commands:
813-
- func: "fetch source"
814-
- command: expansions.update
815-
- func: "download mongod and shell"
816-
vars:
817-
mongo_version: "4.0"
818-
- func: "start mongod"
819-
- func: "wait for mongod to be ready"
820-
- func: "run make target"
821-
vars:
822-
target: build
823-
- func: "run make target"
824-
vars:
825-
target: test:integration -ssl=true ${testArgs}
826-
827-
- name: integration-4.0-auth
828-
tags: ["4.0", "auth"]
829-
commands:
830-
- func: "fetch source"
831-
# Concat auth args
832-
- command: expansions.update
833-
params:
834-
updates:
835-
- key: "mongod_args"
836-
concat: " --auth"
837-
- func: "download mongod and shell"
838-
vars:
839-
mongo_version: "4.0"
840-
- func: "start mongod"
841-
- func: "wait for mongod to be ready"
842-
- func: "create mongod users"
843-
- func: "run make target"
844-
vars:
845-
target: build
846-
- func: "run make target"
847-
vars:
848-
target: test:integration -ssl=true -auth=true ${testArgs}
849-
850-
- name: integration-4.0-cluster
851-
tags: ["4.0", "cluster"]
852-
commands:
853-
- func: "fetch source"
854-
- command: expansions.update
855-
- func: "download mongod and shell"
856-
vars:
857-
mongo_version: "4.0"
858-
- func: "create repl_set"
859-
vars:
860-
USE_SSL: "true"
861-
- func: "run make target"
862-
vars:
863-
target: build
864-
- func: "run make target"
865-
vars:
866-
target: test:integration -ssl=true ${testArgs}
867-
868-
- name: integration-4.0-mmapv1
869-
tags: ["4.0", "mmap"]
870-
commands:
871-
- func: "fetch source"
872-
- command: expansions.update
873-
- func: "download mongod and shell"
874-
vars:
875-
mongo_version: "4.0"
876-
- func: "start mongod"
877-
vars:
878-
STORAGE_ENGINE: "mmapv1"
879-
- func: "wait for mongod to be ready"
880-
- func: "run make target"
881-
vars:
882-
target: build
883-
- func: "run make target"
884-
vars:
885-
target: test:integration -ssl=true ${testArgs}
886-
887774
- name: integration-4.2
888775
tags: ["4.2"]
889776
commands:
@@ -1749,40 +1636,6 @@ tasks:
17491636
resmoke_suite: "core${resmoke_use_tls}"
17501637
excludes: "requires_unstable,${excludes}"
17511638

1752-
- name: qa-tests-4.0
1753-
tags: ["4.0"]
1754-
commands:
1755-
- func: "fetch source"
1756-
- func: "get buildnumber"
1757-
- func: "setup credentials"
1758-
- func: "download mongod and shell"
1759-
vars:
1760-
mongo_version: "4.0"
1761-
- func: "run make target"
1762-
vars:
1763-
target: build
1764-
- func: "run qa-tests"
1765-
vars:
1766-
resmoke_suite: "core${resmoke_use_ssl}"
1767-
excludes: "requires_min_mongo_42,requires_unstable,${excludes}"
1768-
1769-
- name: qa-tests-3.6
1770-
tags: ["3.6"]
1771-
commands:
1772-
- func: "fetch source"
1773-
- func: "get buildnumber"
1774-
- func: "setup credentials"
1775-
- func: "download mongod and shell"
1776-
vars:
1777-
mongo_version: "3.6"
1778-
- func: "run make target"
1779-
vars:
1780-
target: build
1781-
- func: "run qa-tests"
1782-
vars:
1783-
resmoke_suite: "core${resmoke_use_ssl}"
1784-
excludes: "requires_min_mongo_40,requires_min_mongo_42,requires_unstable,${excludes}"
1785-
17861639
- name: native-cert-ssl-4.4
17871640
tags: ["4.4"]
17881641
commands:
@@ -2047,16 +1900,12 @@ buildvariants:
20471900
]
20481901
mongo_os: "rhel80"
20491902
mongo_edition: "enterprise"
2050-
smoke_use_ssl: --use-ssl
2051-
resmoke_use_ssl: _ssl
2052-
smoke_use_tls: --use-tls
20531903
resmoke_use_tls: _tls
20541904
edition: enterprise
20551905
run_kinit: true
20561906
resmoke_args: --jobs 4
20571907
tasks:
20581908
- name: "unit"
2059-
- name: ".4.0"
20601909
- name: ".4.2"
20611910
- name: ".4.4"
20621911
- name: ".5.0"
@@ -2086,16 +1935,12 @@ buildvariants:
20861935
mongo_os: "rhel80"
20871936
mongo_edition: "enterprise"
20881937
testArgs: "-race=true"
2089-
smoke_use_ssl: --use-ssl
2090-
resmoke_use_ssl: _ssl
2091-
smoke_use_tls: --use-tls
20921938
resmoke_use_tls: _tls
20931939
edition: enterprise
20941940
run_kinit: true
20951941
resmoke_args: --jobs 4
20961942
tasks:
20971943
- name: "unit"
2098-
- name: ".4.0"
20991944
- name: ".4.2"
21001945
- name: ".4.4"
21011946
- name: ".5.0"
@@ -2233,10 +2078,7 @@ buildvariants:
22332078
mongo_os: "windows-64"
22342079
mongo_edition: "enterprise"
22352080
mongo_target: "windows"
2236-
smoke_use_ssl: --use-ssl
22372081
resmoke_args: --jobs 4
2238-
resmoke_use_ssl: _ssl
2239-
smoke_use_tls: --use-tls
22402082
resmoke_use_tls: _tls
22412083
excludes: requires_large_ram,requires_mongo_24
22422084
edition: enterprise
@@ -2245,7 +2087,6 @@ buildvariants:
22452087
USE_SSL: "true"
22462088
tasks:
22472089
- name: "unit"
2248-
- name: ".4.0"
22492090
- name: ".4.2"
22502091
- name: ".4.4"
22512092
- name: ".5.0"

Diff for: common/db/db.go

+3-16
Original file line numberDiff line numberDiff line change
@@ -623,23 +623,10 @@ func CanIgnoreError(err error) bool {
623623

624624
// Returns a boolean based on whether the given error indicates that this timeseries collection needs to be updated to set `timeseriesBucketsMayHaveMixedSchemaData` to `true`.
625625
func TimeseriesBucketNeedsMixedSchema(err error) bool {
626-
if err == nil {
627-
return false
628-
}
629-
630-
switch mongoErr := err.(type) {
631-
case mongo.WriteError:
632-
return mongoErr.Code == ErrCannotInsertTimeseriesBucketsWithMixedSchema
626+
var mongoErr mongo.ServerError
633627

634-
case mongo.BulkWriteException:
635-
for _, writeErr := range mongoErr.WriteErrors {
636-
if writeErr.Code == ErrCannotInsertTimeseriesBucketsWithMixedSchema {
637-
return true
638-
}
639-
}
640-
return false
641-
}
642-
return false
628+
return errors.As(err, &mongoErr) &&
629+
mongoErr.HasErrorCode(ErrCannotInsertTimeseriesBucketsWithMixedSchema)
643630
}
644631

645632
// IsMMAPV1 returns whether the storage engine is MMAPV1. Also returns false

Diff for: mongodump/mongodump_test.go

+13-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,19 @@ func setupTimeseriesWithMixedSchema(dbName string, collName string) error {
379379

380380
// SERVER-84531 was only backported to 7.3.
381381
// TODO: Run collMod command on 6.0 and 7.0 (TOOLS-3597).
382-
if cmp, err := testutil.CompareFCV(testutil.GetFCV(client), "7.3"); err != nil || cmp >= 0 {
382+
clientFCV := testutil.GetFCV(client)
383+
384+
shouldAccommodateMixedSchema := clientFCV == "6.0" || clientFCV == "7.0"
385+
if !shouldAccommodateMixedSchema {
386+
cmp, err := testutil.CompareFCV(clientFCV, "7.3")
387+
if err != nil {
388+
return errors.Wrapf(err, "failed to compare client FCV (%s)", clientFCV)
389+
}
390+
391+
shouldAccommodateMixedSchema = cmp >= 0
392+
}
393+
394+
if shouldAccommodateMixedSchema {
383395
if res := sessionProvider.DB(dbName).RunCommand(context.Background(), bson.D{
384396
{"collMod", collName},
385397
{"timeseriesBucketsMayHaveMixedSchemaData", true},

Diff for: release/download/download_server.go

+31-5
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@ package download
22

33
import (
44
"fmt"
5+
"strings"
56

7+
"github.com/mongodb/mongo-tools/release/platform"
68
"github.com/mongodb/mongo-tools/release/version"
79
)
810

11+
// Increase this as needed for new server versions.
12+
var maxServerVersion = version.Version{8, 0, 999, ""}
13+
914
// JSONFeed represents the structure of the JSON
1015
// document consumed by the MongoDB downloads center.
1116
type ServerJSONFeed struct {
@@ -37,11 +42,10 @@ var (
3742

3843
func (f *ServerJSONFeed) FindURLHashAndVersion(
3944
serverVersion string,
40-
target string,
41-
arch string,
45+
platform platform.Platform,
4246
edition string,
4347
) (string, string, string, error) {
44-
fmt.Printf("Finding %v, %v, %v, %v\n", serverVersion, target, arch, edition)
48+
fmt.Printf("Finding %v, %v, %v\n", serverVersion, platform, edition)
4549

4650
var sv version.Version
4751
var err error
@@ -58,19 +62,41 @@ func (f *ServerJSONFeed) FindURLHashAndVersion(
5862
// This is useful to find a server release that is not in the feed.
5963
versionGuess := ""
6064
for _, v := range f.Versions {
65+
if serverVersion != "latest" && strings.Contains(v.Version, "-rc") {
66+
fmt.Printf("Skipping release candidate: %v\n", v.Version)
67+
continue
68+
}
69+
6170
feedVersion, err := version.Parse(v.Version)
6271
if err != nil {
6372
return "", "", "", fmt.Errorf("Unable to parse feed version: %v", err)
6473
}
65-
fmt.Printf("feedVersion: %+v\n", feedVersion)
74+
fmt.Printf("feedVersion: %+v (%s)\n", feedVersion, v.Version)
6675

6776
if serverVersion == "latest" ||
6877
(feedVersion.Major == sv.Major && feedVersion.Minor == sv.Minor) {
78+
79+
if feedVersion.GreaterThan(maxServerVersion) {
80+
if serverVersion == "latest" {
81+
fmt.Printf(
82+
"Skipping because it exceeds the max server version (%v)\n",
83+
maxServerVersion,
84+
)
85+
continue
86+
} else {
87+
return "", "", "", fmt.Errorf("cannot match a server version (%v) that exceeds the max server version (%v)", feedVersion, maxServerVersion)
88+
}
89+
}
90+
6991
if versionGuess == "" {
7092
versionGuess = feedVersion.String()
7193
}
7294
for _, dl := range v.Downloads {
73-
if dl.Target == target && dl.Arch == arch && dl.Edition == edition {
95+
if !platform.TargetMatches(dl.Target) {
96+
continue
97+
}
98+
99+
if dl.Arch == platform.Arch.String() && dl.Edition == edition {
74100
return dl.Archive.URL, v.GitHash, v.Version, nil
75101
}
76102
}

0 commit comments

Comments
 (0)