Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
vendor/
pkg/client/
docker/mongodb-kubernetes-tests
scripts/
# scripts/
samples/
.multi_cluster_local_test_files/

Expand Down
19 changes: 6 additions & 13 deletions .evergreen-functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -679,12 +679,9 @@ functions:
params:
shell: bash
working_dir: src/github.com/mongodb/mongodb-kubernetes
script: |
source .generated/context.export.env
make test-race
- command: gotest.parse_files
params:
files: [ "src/github.com/mongodb/mongodb-kubernetes/*.suite", "src/github.com/mongodb/mongodb-kubernetes/docker/mongodb-kubernetes-init-ops-manager/mmsconfiguration/*.suite" ]
env:
USE_RACE: "true"
script: scripts/evergreen/unit-tests-golang.sh

test_helm_unit:
- command: shell.exec
Expand All @@ -702,19 +699,15 @@ functions:
params:
shell: bash
working_dir: src/github.com/mongodb/mongodb-kubernetes
script: |
source .generated/context.export.env
make python-tests
script: scripts/evergreen/unit-tests-python.sh

test_sboms:
test_python_sbom:
- command: shell.exec
type: test
params:
shell: bash
working_dir: src/github.com/mongodb/mongodb-kubernetes
script: |
source .generated/context.export.env
make sbom-tests
script: scripts/evergreen/unit-tests-sbom.sh

generate_perf_tests_tasks:
- *switch_context
Expand Down
7 changes: 6 additions & 1 deletion .evergreen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ tasks:
# See https://docs.devprod.prod.corp.mongodb.com/evergreen/Project-Configuration/Project-Configuration-Files#limiting-when-a-task-or-variant-will-run
patchable: false
commands:
- func: "test_sboms"
- func: "test_python_sbom"

- name: lint_repo
tags: [ "unit_tests" ]
Expand Down Expand Up @@ -567,6 +567,11 @@ task_groups:
- unit_tests_python
- unit_tests_helm
- sbom_tests
teardown_task:
- command: attach.xunit_results
params:
files: [ "src/github.com/mongodb/mongodb-kubernetes/*-result.xml" ]


# Task group for deploying mongodbcommunity resources and testing the (former) MCO
- name: e2e_mdb_community_task_group
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ bundle
.DS_Store
cover.out
result.suite
*result.xml
# loadtesting binary
production_notes/cmd/runtest/runtest
production_notes/helm_charts/opsmanager/charts/
Expand Down
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -278,19 +278,18 @@ endif
ENVTEST_ASSETS_DIR=$(shell pwd)/testbin

golang-tests:
scripts/evergreen/unit-tests.sh
scripts/evergreen/unit-tests-golang.sh

golang-tests-race:
USE_RACE=true scripts/evergreen/unit-tests.sh
USE_RACE=true scripts/evergreen/unit-tests-golang.sh

sbom-tests:
@ scripts/dev/run_python.sh -m pytest generate_ssdlc_report_test.py
scripts/evergreen/unit-tests-sbom.sh

# e2e tests are also in python and we will need to ignore them as they are in the docker/mongodb-kubernetes-tests folder
# additionally, we have one lib which we want to test which is in the =docker/mongodb-kubernetes-tests folder.
python-tests:
@ scripts/dev/run_python.sh -m pytest docker/mongodb-kubernetes-tests/kubeobject
@ scripts/dev/run_python.sh -m pytest --ignore=docker/mongodb-kubernetes-tests
scripts/evergreen/unit-tests-python.sh

generate-ssdlc-report:
@ scripts/dev/run_python.sh generate_ssdlc_report.py
Expand Down
4 changes: 4 additions & 0 deletions api/v1/mdb/sharded_cluster_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ func TestNoIgnoredFieldUsed(t *testing.T) {
Spec: corev1.PodSpec{},
}},
}

// when tests are executed with env set from current context, some kubeconfig validation tests might stop working
t.Setenv(multicluster.KubeConfigPathEnv, "")

tests := []struct {
name string
isMultiCluster bool
Expand Down
8 changes: 6 additions & 2 deletions api/v1/search/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions controllers/operator/appdbreplicaset_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"
"os"
"path/filepath"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -54,15 +53,14 @@ func init() {

// getReleaseJsonPath searches for a specified target directory by traversing the directory tree backwards from the current working directory
func getReleaseJsonPath() (string, error) {
repositoryRootDirName := "mongodb-kubernetes"
releaseFileName := "release.json"

currentDir, err := os.Getwd()
if err != nil {
return "", err
}
for currentDir != "/" {
if strings.HasSuffix(currentDir, repositoryRootDirName) {
if _, err := os.Stat(filepath.Join(currentDir, releaseFileName)); err == nil {
return filepath.Join(currentDir, releaseFileName), nil
}
currentDir = filepath.Dir(currentDir)
Expand Down
14 changes: 0 additions & 14 deletions docker/mongodb-kubernetes-init-ops-manager/go.mod

This file was deleted.

12 changes: 0 additions & 12 deletions docker/mongodb-kubernetes-init-ops-manager/go.sum

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func readLinesFromFile(name string) ([]string, error) {
func writeLinesToFile(name string, lines []string) error {
output := strings.Join(lines, lineBreak)

err := os.WriteFile(name, []byte(output), 0o644)
err := os.WriteFile(name, []byte(output), 0o644) // nolint:gosec
if err != nil {
return xerrors.Errorf("error writing to file %s: %w", name, err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ check_backup_daemon_alive () {
pgrep --exact 'mms-app' || pgrep -f '/mongodb-ops-manager/jdk/bin/mms-app'
}

check_backup_daemon_alive
check_backup_daemon_alive
11 changes: 10 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,17 @@ require google.golang.org/protobuf v1.36.8 // indirect

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/bitfield/gotestdox v0.2.2 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dnephin/pflag v1.0.7 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.9.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/fsnotify/fsnotify v1.8.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-jose/go-jose/v4 v4.1.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
Expand All @@ -69,6 +72,7 @@ require (
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
Expand All @@ -83,6 +87,8 @@ require (
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moby/spdystream v0.4.0 // indirect
Expand Down Expand Up @@ -132,6 +138,7 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools/gotestsum v1.12.3 // indirect
k8s.io/apiextensions-apiserver v0.31.0 // indirect
k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
Expand All @@ -140,3 +147,5 @@ require (
)

go 1.24.0

tool gotest.tools/gotestsum
15 changes: 13 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bitfield/gotestdox v0.2.2 h1:x6RcPAbBbErKLnapz1QeAlf3ospg8efBsedU93CDsnE=
github.com/bitfield/gotestdox v0.2.2/go.mod h1:D+gwtS0urjBrzguAkTM2wodsTQYFHdpx8eqRJ3N+9pY=
github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ=
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
Expand All @@ -16,6 +18,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dnephin/pflag v1.0.7 h1:oxONGlWxhmUct0YzKTgrpQv9AUA1wtPBn7zuSjJqptk=
github.com/dnephin/pflag v1.0.7/go.mod h1:uxE91IoWURlOiTUIA8Mq5ZZkAv3dPUfZNaT80Zm7OQE=
github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g=
github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lShz4oaXpDTX2bLe7ls=
Expand All @@ -28,8 +32,8 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
Expand Down Expand Up @@ -87,6 +91,8 @@ github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af h1:kmjWCqn2qkEml422C2Rrd27c3VGxi6a/6HNq8QmHRKM=
github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
Expand Down Expand Up @@ -318,6 +324,7 @@ golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
Expand Down Expand Up @@ -390,6 +397,10 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools/gotestsum v1.12.3 h1:jFwenGJ0RnPkuKh2VzAYl1mDOJgbhobBDeL2W1iEycs=
gotest.tools/gotestsum v1.12.3/go.mod h1:Y1+e0Iig4xIRtdmYbEV7K7H6spnjc1fX4BOuUhWw2Wk=
gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q=
gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA=
k8s.io/api v0.31.11 h1:jmrs+NBmdyaYMOIhAmi2g2eemugqiMwRSKtdpk0FAFc=
k8s.io/api v0.31.11/go.mod h1:t1/N5KEcY/DCwEzCbtCoJeJt4b00phLCRVgM11Ijb6o=
k8s.io/apiextensions-apiserver v0.31.0 h1:fZgCVhGwsclj3qCw1buVXCV6khjRzKC5eCFt24kyLSk=
Expand Down
2 changes: 1 addition & 1 deletion mongodb-community-operator/scripts/dev/e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def create_test_pod(args: argparse.Namespace, namespace: str) -> None:
"command": [
"sh",
"-c",
f"go test -v -timeout=45m -failfast ./mongodb-community-operator/test/e2e/{args.test} | tee -a /tmp/results/result.suite",
f"go test -tags=community_e2e -v -timeout=45m -failfast ./mongodb-community-operator/test/e2e/{args.test} | tee -a /tmp/results/result.suite",
],
"volumeMounts": [{"name": "results", "mountPath": "/tmp/results"}],
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build community_e2e

package feature_compatibility_version

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build community_e2e

package prometheus

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build community_e2e

package replica_set

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build community_e2e

package replica_set

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build community_e2e

package replica_set_authentication

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build community_e2e

package replica_set

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build community_e2e

package replica_set_connection_string_options

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build community_e2e

package replica_set_cross_namespace_deploy

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build community_e2e

package replica_set_custom_annotations_test

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build community_e2e

package replica_set_custom_persistent_volume

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build community_e2e

package replica_set_custom_role

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build community_e2e

package replica_set

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build community_e2e

package replica_set

import (
Expand Down
Loading