Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to MongoDB 7.0.4 #141

Merged
merged 25 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ jobs:
- go: '1.12'
mongo: 'mongodb-linux-x86_64-3.6.20'
minio: '2019-05-23T00-29-34Z'
wired_tiger: 'true'
- go: '1.12'
mongo: 'mongodb-linux-x86_64-ubuntu2204-7.0.4'
minio: '2019-05-23T00-29-34Z'
wired_tiger: 'false'
- go: '1.12'
mongo: 'mongodb-linux-x86_64-3.6.20'
mongo: 'mongodb-linux-x86_64-ubuntu2204-7.0.4'
minio: '2019-05-23T00-29-34Z'
wired_tiger: 'true'
MrCreosote marked this conversation as resolved.
Show resolved Hide resolved
steps:
Expand Down
11 changes: 5 additions & 6 deletions nodestore/mongostore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ func (t *TestSuite) TestConstructFailAddConfigIndex() {
t.Contains(err.Error(), "E11000 duplicate key error", "incorrect error")
t.Contains(err.Error(), testDB+".config", "incorrect error")
t.Contains(err.Error(), "schema_1", "incorrect error")
t.Contains(err.Error(), "dup key: { : \"schema\" }", "incorrect error")
t.Contains(err.Error(), "dup key: { ", "incorrect error")
t.Contains(err.Error(), ": \"schema\" }", "incorrect error")
}

func (t *TestSuite) TestConstructFailTwoConfigDocs() {
Expand Down Expand Up @@ -773,7 +774,7 @@ func (t *TestSuite) TestConfigIndexes() {
"_id_": false,
"schema_1": true,
}
t.checkIndexes("config", testDB+".config", expected)
t.checkIndexes("config", expected)
}

func (t *TestSuite) TestUserIndexes() {
Expand All @@ -782,20 +783,19 @@ func (t *TestSuite) TestUserIndexes() {
"user_1": true,
"id_1": true,
}
t.checkIndexes("users", testDB+".users", expected)
t.checkIndexes("users", expected)
}

func (t *TestSuite) TestNodeIndexes() {
expected := map[string]bool{
"_id_": false,
"id_1": true,
}
t.checkIndexes("nodes", testDB+".nodes", expected)
t.checkIndexes("nodes", expected)
}

func (t *TestSuite) checkIndexes(
collection string,
expectedNamespace string,
expectedIndexes map[string]bool) {
_, err := NewMongoNodeStore(t.client.Database(testDB))
if err != nil {
Expand All @@ -815,7 +815,6 @@ func (t *TestSuite) checkIndexes(
t.Fail(err.Error())
}
m := elem.Map()
t.Equal(expectedNamespace, m["ns"], "incorrect name space")
if un, ok := m["unique"]; ok {
names[m["name"].(string)] = un.(bool)
} else {
Expand Down
75 changes: 5 additions & 70 deletions test/kbaseauthcontroller/authjars.go
MrCreosote marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,76 +1,11 @@
package kbaseauthcontroller

// this file simply lists the jars that are required to run the KBase auth server in test mode.
// this file simply lists the template and the jar in the KBase jars repo (https://github.com/kbase/jars)
// that are required to run the KBase auth server in test mode.
const (
// authTemplates is the zip file containing templates for the server
authTemplates = "kbase/auth2/kbase-auth2templates-0.2.4.zip"
)

// jars contains the list of jars in the KBase jars repo (https://github.com/kbase/jars)
// required for the auth server.
// might want to make the paths non-unix specific... yagni
var jars = []string{
"kbase/auth2/kbase-auth2-0.2.4.jar",
"kbase/auth2/kbase-auth2test-0.2.4.jar",
//lib
"apache_commons/commons-codec-1.8.jar",
"apache_commons/commons-validator-1.5.1.jar",
"google/guava-18.0.jar",
"ini4j/ini4j-0.5.2.jar",
"jcommander/jcommander-1.48.jar",
"mongo/mongo-java-driver-3.3.0.jar",
"mustache/compiler-0.9.3.jar",
"nulab-inc/zxcvbn-1.2.2.jar",
//logging
"kbase/common/kbase-common-0.0.22.jar",
"jna/jna-3.4.0.jar",
"logback/logback-core-1.1.2.jar",
"logback/logback-classic-1.1.2.jar",
"slf4j/slf4j-api-1.7.25.jar",
"syslog4j/syslog4j-0.9.46.jar",
//yauaa
"yauaa/yauaa-1.3.jar",
"apache_commons/commons-lang3-3.5.jar",
"apache_commons/commons-collections4-4.1.jar",
"apache_commons/commons-logging-1.2.jar",
"kohsuke/args4j-2.33.jar",
"snakeyaml/snakeyaml-1.18.jar",
//jackson
"jackson/jackson-annotations-2.5.4.jar",
"jackson/jackson-core-2.5.4.jar",
"jackson/jackson-databind-2.5.4.jar",
"jackson/jackson-jaxrs-base-2.5.4.jar",
"jackson/jackson-jaxrs-json-provider-2.5.4.jar",
"jackson/jackson-module-jaxb-annotations-2.5.4.jar",
//jersey
"jersey/entity-filtering/jersey-entity-filtering-2.23.2.jar",
"jersey/entity-filtering/jersey-media-json-jackson-2.23.2.jar",
"jersey/mvc/jersey-mvc-2.23.2.jar",
"jersey/mvc/jersey-mvc-mustache-2.23.2.jar",
"jersey/jersey-client-2.23.2.jar",
"jersey/jersey-common-2.23.2.jar",
"jersey/jersey-container-servlet-2.23.2.jar",
"jersey/jersey-container-servlet-core-2.23.2.jar",
"jersey/jersey-guava-2.23.2.jar",
"jersey/jersey-media-jaxb-2.23.2.jar",
"jersey/jersey-server-2.23.2.jar",
//jerseydeps
"annotation/javax.annotation-api-1.2.jar",
"asm/asm-debug-all-5.0.4.jar",
"inject/javax.inject-2.5.0-b05.jar",
"javassist/javassist-3.20.0-GA.jar",
"jaxb/jaxb-api-2.2.7.jar",
"jaxrs/javax.ws.rs-api-2.0.1.jar",
"osgi/org.osgi.core-4.2.0.jar",
"persistence/persistence-api-1.0.jar",
"servlet/javax.servlet-api-3.0.1.jar",
"validationapi/validation-api-1.1.0.Final.jar",
//jerseydep_hk2
"hk2/aopalliance-repackaged-2.5.0-b05.jar",
"hk2/hk2-api-2.5.0-b05.jar",
"hk2/hk2-locator-2.5.0-b05.jar",
"hk2/hk2-utils-2.5.0-b05.jar",
"hk2/osgi-resource-locator-1.0.1.jar",
//test
"jetty/jetty-all-9.3.11.v20160721-uber.jar",
}
// auth2ShadowAllJar is the jar required for the server
authShadowAllJar = "kbase/auth2/kbase-auth2-test-shadow-all-0.7.0.jar"
)
12 changes: 4 additions & 8 deletions test/kbaseauthcontroller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,11 @@ func getClassPath(jarsDir string) (string, error) {
if err != nil {
return "", err
}
cp := []string(nil)
for _, j := range jars { // global variable, yech
jpath := path.Join(jarsDir, j)
if _, err := os.Stat(jpath); os.IsNotExist(err) {
return "", fmt.Errorf("Jar %v does not exist", jpath)
}
cp = append(cp, jpath)
jpath := path.Join(jarsDir, authShadowAllJar)
if _, err := os.Stat(jpath); os.IsNotExist(err) {
return "", fmt.Errorf("Jar %v does not exist", jpath)
}
return strings.Join(cp, ":"), nil
return jpath, nil
}

func installTemplates(jarsDir string, templateDir string) error {
Expand Down
41 changes: 29 additions & 12 deletions test/mongocontroller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os/exec"
"path/filepath"
"strconv"
"strings"
"time"

"go.mongodb.org/mongo-driver/mongo"
Expand All @@ -28,7 +29,7 @@ type Params struct {
UseWiredTiger bool
}

// Controller is a Minio controller.
// Controller is a Mongo controller.
type Controller struct {
port int
tempDir string
Expand All @@ -53,14 +54,29 @@ func New(p Params) (*Controller, error) {
if err != nil {
return nil, err
}

cmdargs := []string{
"--port", strconv.Itoa(port),
"--dbpath", ddir,
"--nojournal",
}

// check mongodb version
ver, err := getMongoDBVer(p.ExecutablePath)
if err != nil {
return nil, err
}

// Starting in MongoDB 6.1, journaling is always enabled.
// As a result, MongoDB removes the storage.journal.enabled option and
// the corresponding --journal and --nojournal command-line options.
// https://www.mongodb.com/docs/manual/release-notes/6.1/#changes-to-journaling
if ver.LessThan(*semver.New("6.1.0")) {
cmdargs = append(cmdargs, "--nojournal")
}
if p.UseWiredTiger {
cmdargs = append(cmdargs, "--storageEngine", "wiredTiger")
}

cmd := exec.Command(p.ExecutablePath, cmdargs...)
cmd.Stdout = outfile
cmd.Stderr = outfile
Expand All @@ -80,18 +96,8 @@ func New(p Params) (*Controller, error) {
if err != nil {
return nil, err
}
res := client.Database("foo").RunCommand(nil, map[string]int{"buildinfo": 1})
if res.Err() != nil {
return nil, res.Err()
}
var doc map[string]interface{}
err = res.Decode(&doc)
if err != nil {
return nil, err
}
MrCreosote marked this conversation as resolved.
Show resolved Hide resolved
// wired tiger will also not include index names for 3.0, but we're not going to test
// that so screw it
ver := semver.New(doc["version"].(string))
return &Controller{port, tdir, cmd, ver.LessThan(*semver.New("3.2.1000"))}, nil
}

Expand Down Expand Up @@ -121,3 +127,14 @@ func (c *Controller) Destroy(deleteTempDir bool) error {
}
return nil
}

func getMongoDBVer(ExecutablePath string) (*semver.Version, error) {
MrCreosote marked this conversation as resolved.
Show resolved Hide resolved
cmd := exec.Command(ExecutablePath, "--version")
stdout, err := cmd.Output()
if err != nil {
return nil, err
}
rep := strings.Replace(string(stdout), "\n", " ", -1)
ver := strings.Split(rep, " ")[2][1:]
return semver.New(ver), err
}
Loading