Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ By default, `memongo` logs to stdout. To log somewhere else, specify a `Logger`
macOS running on Apple silicon (`GOOS darwin/arm64`) is a common, unsupported, platform. But as macOS will run MongoDB with Rosetta 2, you can still use `memongo` by specifying the download url.
```go
opts := &memongo.Options{
MongoVersion: "5.0.0",
MongoVersion: "8.0.0",
}
if runtime.GOARCH == "arm64" {
if runtime.GOOS == "darwin" {
// Only set the custom url as workaround for arm64 macs
opts.DownloadURL = "https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-5.0.0.tgz"
opts.DownloadURL = "https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-8.0.0.tgz"
}
}
```
12 changes: 6 additions & 6 deletions memongo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

func TestDefaultOptions(t *testing.T) {
versions := []string{"4.4.7", "5.0.0", "7.0.0", "8.0.0"}
versions := []string{"6.0.0", "7.0.0", "8.0.0"}

for _, version := range versions {
t.Run(version, func(t *testing.T) {
Expand All @@ -37,7 +37,7 @@ func TestDefaultOptions(t *testing.T) {
}

func TestWithReplica(t *testing.T) {
versions := []string{"4.4.7", "5.0.0", "7.0.0", "8.0.0"}
versions := []string{"6.0.0", "7.0.0", "8.0.0"}

for _, version := range versions {
t.Run(version, func(t *testing.T) {
Expand All @@ -62,7 +62,7 @@ func TestWithReplica(t *testing.T) {
}

func TestWithAuth(t *testing.T) {
versions := []string{"4.4.7", "5.0.0", "7.0.0", "8.0.0"}
versions := []string{"6.0.0", "7.0.0", "8.0.0"}

for _, version := range versions {
t.Run(version, func(t *testing.T) {
Expand Down Expand Up @@ -96,7 +96,7 @@ func TestWithAuth(t *testing.T) {

require.NoError(t, client2.Ping(context.Background(), nil))
_, err = client2.ListDatabaseNames(context.Background(), bson.D{})
if strings.HasPrefix(version, "7.") {
if strings.HasPrefix(version, "7.") || strings.HasPrefix(version, "8.") {
require.EqualError(t, err, "(Unauthorized) Command listDatabases requires authentication")
} else {
require.EqualError(t, err, "(Unauthorized) command listDatabases requires authentication")
Expand All @@ -120,7 +120,7 @@ func TestWithAuth(t *testing.T) {
}

func TestWithReplicaAndAuth(t *testing.T) {
versions := []string{"4.4.7", "5.0.0", "7.0.0", "8.0.0"}
versions := []string{"6.0.0", "7.0.0", "8.0.0"}

for _, version := range versions {
t.Run(version, func(t *testing.T) {
Expand Down Expand Up @@ -159,7 +159,7 @@ func TestWithReplicaAndAuth(t *testing.T) {

require.NoError(t, client2.Ping(context.Background(), nil))
_, err = client2.ListDatabaseNames(context.Background(), bson.D{})
if strings.HasPrefix(version, "7.") {
if strings.HasPrefix(version, "7.") || strings.HasPrefix(version, "8.") {
require.EqualError(t, err, "(Unauthorized) Command listDatabases requires authentication")
} else {
require.EqualError(t, err, "(Unauthorized) command listDatabases requires authentication")
Expand Down
74 changes: 49 additions & 25 deletions mongobin/downloadURL_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ import (
const testHTTPHead = true

func TestGetDownloadURL(t *testing.T) {
mongoVersionsToTest := []string{
"3.2.0", "3.2.22", "3.4.0", "3.4.19", "3.6.0", "3.6.10", "4.0.0", "4.0.13", "4.2.1", "4.4.7", "5.0.0",
}

tests := map[string]struct {
spec *mongobin.DownloadSpec
mongoVersions []string
Expand All @@ -34,7 +30,7 @@ func TestGetDownloadURL(t *testing.T) {
SSLBuildNeeded: true,
},
mongoVersions: []string{
"3.2.0", "3.2.22", "3.4.0", "3.4.19", "3.6.0", "3.6.10", "4.0.0", "4.0.13",
"4.0.0",
},
expectedURL: "https://fastdl.mongodb.org/osx/mongodb-osx-ssl-x86_64-VERSION.tgz",
},
Expand All @@ -45,7 +41,7 @@ func TestGetDownloadURL(t *testing.T) {
OSName: "",
},
mongoVersions: []string{
"4.2.1",
"5.0.0", "6.0.0", "7.0.0", "8.0.0",
},
expectedURL: "https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-VERSION.tgz",
},
Expand All @@ -56,7 +52,7 @@ func TestGetDownloadURL(t *testing.T) {
OSName: "",
},
mongoVersions: []string{
"6.0.0",
"6.0.0", "7.0.0", "8.0.0",
},
expectedURL: "https://fastdl.mongodb.org/osx/mongodb-macos-arm64-VERSION.tgz",
},
Expand All @@ -66,7 +62,7 @@ func TestGetDownloadURL(t *testing.T) {
Arch: "x86_64",
OSName: "ubuntu1804",
},
mongoVersions: []string{"4.0.1", "4.0.13", "4.2.1"},
mongoVersions: []string{"4.0.1", "4.2.1"},
expectedURL: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-VERSION.tgz",
},
"arm64 ubuntu 18.04": {
Expand All @@ -75,7 +71,7 @@ func TestGetDownloadURL(t *testing.T) {
Arch: "aarch64",
OSName: "ubuntu1804",
},
mongoVersions: []string{"4.2.1", "4.4.0", "6.0.0"},
mongoVersions: []string{"4.2.1", "4.4.0", "6.0.0", "7.0.0"},
expectedURL: "https://fastdl.mongodb.org/linux/mongodb-linux-aarch64-ubuntu1804-VERSION.tgz",
},
"arm64 ubuntu 20.04": {
Expand All @@ -84,7 +80,7 @@ func TestGetDownloadURL(t *testing.T) {
Arch: "aarch64",
OSName: "ubuntu2004",
},
mongoVersions: []string{"4.4.0", "6.0.0"},
mongoVersions: []string{"4.4.0", "6.0.0", "7.0.0", "8.0.0"},
expectedURL: "https://fastdl.mongodb.org/linux/mongodb-linux-aarch64-ubuntu2004-VERSION.tgz",
},
"arm64 ubuntu 22.04": {
Expand All @@ -103,7 +99,7 @@ func TestGetDownloadURL(t *testing.T) {
OSName: "ubuntu1604",
},
mongoVersions: []string{
"3.2.7", "3.4.0", "3.4.19", "3.6.0", "3.6.10", "4.0.0", "4.0.13", "4.2.1",
"4.0.0", "4.2.1",
},
expectedURL: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-VERSION.tgz",
},
Expand All @@ -114,7 +110,7 @@ func TestGetDownloadURL(t *testing.T) {
OSName: "ubuntu1604",
},
mongoVersions: []string{
"3.4.0", "3.4.19", "3.6.0", "3.6.10", "4.0.0", "4.0.13",
"4.0.0",
},
expectedURL: "https://fastdl.mongodb.org/linux/mongodb-linux-arm64-ubuntu1604-VERSION.tgz",
},
Expand All @@ -125,18 +121,31 @@ func TestGetDownloadURL(t *testing.T) {
OSName: "ubuntu1404",
},
mongoVersions: []string{
"3.2.0", "3.2.22", "3.4.0", "3.4.19", "3.6.0", "3.6.10", "4.0.0", "4.0.13",
"4.0.0",
},
expectedURL: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1404-VERSION.tgz",
},
"SUSE 15": {
spec: &mongobin.DownloadSpec{
Platform: "linux",
Arch: "x86_64",
OSName: "suse15",
},
mongoVersions: []string{
"5.0.0", "6.0.0", "7.0.0", "8.0.0",
},
expectedURL: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-suse15-VERSION.tgz",
},
"SUSE 12": {
spec: &mongobin.DownloadSpec{
Platform: "linux",
Arch: "x86_64",
OSName: "suse12",
},
mongoVersions: mongoVersionsToTest,
expectedURL: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-suse12-VERSION.tgz",
mongoVersions: []string{
"5.0.0", "6.0.0", "7.0.0",
},
expectedURL: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-suse12-VERSION.tgz",
},
"ARM64 RHEL 8.2": {
spec: &mongobin.DownloadSpec{
Expand All @@ -147,14 +156,27 @@ func TestGetDownloadURL(t *testing.T) {
mongoVersions: []string{"4.4.4", "5.0.1", "6.0.4"},
expectedURL: "https://fastdl.mongodb.org/linux/mongodb-linux-aarch64-rhel82-VERSION.tgz",
},
"RHEL 8": {
spec: &mongobin.DownloadSpec{
Platform: "linux",
Arch: "x86_64",
OSName: "rhel80",
},
mongoVersions: []string{
"5.0.0", "6.0.0", "7.0.0",
},
expectedURL: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-VERSION.tgz",
},
"RHEL 7": {
spec: &mongobin.DownloadSpec{
Platform: "linux",
Arch: "x86_64",
OSName: "rhel70",
},
mongoVersions: mongoVersionsToTest,
expectedURL: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-VERSION.tgz",
mongoVersions: []string{
"5.0.0", "6.0.0", "7.0.0",
},
expectedURL: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-VERSION.tgz",
},
"RHEL 6": {
spec: &mongobin.DownloadSpec{
Expand All @@ -163,7 +185,7 @@ func TestGetDownloadURL(t *testing.T) {
OSName: "rhel62",
},
mongoVersions: []string{
"3.2.0", "3.2.22", "3.4.0", "3.4.19", "3.6.0", "3.6.10", "4.0.0", "4.0.13", "4.2.1", "4.4.7",
"4.0.0",
},
expectedURL: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-VERSION.tgz",
},
Expand All @@ -174,7 +196,7 @@ func TestGetDownloadURL(t *testing.T) {
OSName: "debian10",
},
mongoVersions: []string{
"4.2.1", "4.4.7", "5.0.0",
"5.0.0",
},
expectedURL: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian10-VERSION.tgz",
},
Expand All @@ -185,7 +207,7 @@ func TestGetDownloadURL(t *testing.T) {
OSName: "debian92",
},
mongoVersions: []string{
"3.6.5", "3.6.10", "4.0.0", "4.0.13", "4.2.1",
"3.6.5", "3.6.10", "4.0.0", "4.2.1",
},
expectedURL: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian92-VERSION.tgz",
},
Expand All @@ -196,7 +218,7 @@ func TestGetDownloadURL(t *testing.T) {
OSName: "debian81",
},
mongoVersions: []string{
"3.2.8", "3.2.22", "3.4.0", "3.4.19", "3.6.0", "3.6.10", "4.0.0", "4.0.13",
"3.2.8", "3.2.22", "3.4.0", "3.4.19", "3.6.0", "3.6.10", "4.0.0",
},
expectedURL: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian81-VERSION.tgz",
},
Expand All @@ -206,8 +228,10 @@ func TestGetDownloadURL(t *testing.T) {
Arch: "x86_64",
OSName: "amazon",
},
mongoVersions: mongoVersionsToTest,
expectedURL: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon-VERSION.tgz",
mongoVersions: []string{
"4.0.0", "5.0.0",
},
expectedURL: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon-VERSION.tgz",
},
"Amazon Linux 2": {
spec: &mongobin.DownloadSpec{
Expand All @@ -216,7 +240,7 @@ func TestGetDownloadURL(t *testing.T) {
OSName: "amazon2",
},
mongoVersions: []string{
"4.0.0", "4.0.13", "4.2.1",
"4.0.0", "4.2.1",
},
expectedURL: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon2-VERSION.tgz",
},
Expand All @@ -236,7 +260,7 @@ func TestGetDownloadURL(t *testing.T) {
OSName: "",
},
mongoVersions: []string{
"3.2.0", "3.2.22", "3.4.0", "3.4.19", "3.6.0", "3.6.10", "4.0.0", "4.0.13",
"4.0.0",
},
expectedURL: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-VERSION.tgz",
},
Expand Down
Loading