Skip to content

Commit

Permalink
CLOUDP-271187 Add support for 8.0 in localdev (#3221)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmenezes authored Sep 19, 2024
1 parent 770df13 commit 3fc0b93
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
8 changes: 5 additions & 3 deletions internal/cli/deployments/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"math/rand"
"net"
"os"
"slices"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -49,6 +50,7 @@ import (
const (
internalMongodPort = 27017
mdb7 = "7.0"
mdb8 = "8.0"
defaultSettings = "default"
customSettings = "custom"
cancelSettings = "cancel"
Expand Down Expand Up @@ -95,7 +97,7 @@ var (
options.CompassConnect: "MongoDB Compass",
skipConnect: "Skip Connection",
}
mdbVersions = []string{mdb7}
mdbVersions = []string{mdb7, mdb8}
)

type SetupOpts struct {
Expand Down Expand Up @@ -413,7 +415,7 @@ func (opts *SetupOpts) validateFlags() error {
}
}

if opts.MdbVersion != "" && opts.MdbVersion != mdb7 {
if opts.MdbVersion != "" && !slices.Contains(mdbVersions, opts.MdbVersion) {
return fmt.Errorf("%w: %s", errInvalidMongoDBVersion, opts.MdbVersion)
}

Expand Down Expand Up @@ -452,7 +454,7 @@ func (opts *SetupOpts) setDefaultSettings() error {
}

if opts.MdbVersion == "" {
opts.MdbVersion = mdb7
opts.MdbVersion = mdb8
defaultValuesSet = true
}

Expand Down
8 changes: 4 additions & 4 deletions internal/cli/deployments/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestSetupOpts_LocalDev_HappyPathClean(t *testing.T) {
force: true,
}

const dockerImageName = "docker.io/mongodb/mongodb-atlas-local:7.0"
const dockerImageName = "docker.io/mongodb/mongodb-atlas-local:8.0"

// Container engine is fine
deploymentTest.MockContainerEngine.EXPECT().Ready().Return(nil).Times(1)
Expand Down Expand Up @@ -128,7 +128,7 @@ func TestSetupOpts_LocalDev_HappyPathOfflinePull(t *testing.T) {
force: true,
}

const dockerImageName = "docker.io/mongodb/mongodb-atlas-local:7.0"
const dockerImageName = "docker.io/mongodb/mongodb-atlas-local:8.0"

// Container engine is fine
deploymentTest.MockContainerEngine.EXPECT().Ready().Return(nil).Times(1)
Expand Down Expand Up @@ -196,7 +196,7 @@ func TestSetupOpts_LocalDev_UnhappyPathOfflinePull(t *testing.T) {
force: true,
}

const dockerImageName = "docker.io/mongodb/mongodb-atlas-local:7.0"
const dockerImageName = "docker.io/mongodb/mongodb-atlas-local:8.0"

// Container engine is fine
deploymentTest.MockContainerEngine.EXPECT().Ready().Return(nil).Times(1)
Expand Down Expand Up @@ -271,7 +271,7 @@ func TestSetupOpts_LocalDev_RemoveUnhealthyDeployment(t *testing.T) {
force: true,
}

const dockerImageName = "docker.io/mongodb/mongodb-atlas-local:7.0"
const dockerImageName = "docker.io/mongodb/mongodb-atlas-local:8.0"

// Container engine is fine
deploymentTest.MockContainerEngine.EXPECT().Ready().Return(nil).Times(1)
Expand Down
2 changes: 1 addition & 1 deletion internal/podman/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
)

var (
ErrPodmanNotFound = errors.New("podman not found in your system, check requirements at https://dochub.mongodb.org/core/atlas-cli-deploy-local-reqs")
ErrPodmanNotFound = errors.New("neither docker or podman were found in your system, check requirements at https://dochub.mongodb.org/core/atlas-cli-deploy-local-reqs")
ErrDeterminingPodmanVersion = errors.New("could not determine docker version")
minPodmanVersion = semver.New(5, 0, 0, "", "") //nolint:mnd
)
Expand Down

0 comments on commit 3fc0b93

Please sign in to comment.