diff --git a/.dockerignore b/.dockerignore index 7e6fd07a04..a185217410 100644 --- a/.dockerignore +++ b/.dockerignore @@ -8,7 +8,7 @@ vendor/ pkg/client/ docker/mongodb-kubernetes-tests -scripts/ +# scripts/ samples/ .multi_cluster_local_test_files/ diff --git a/.evergreen-functions.yml b/.evergreen-functions.yml index f5766d127e..c4133929b3 100644 --- a/.evergreen-functions.yml +++ b/.evergreen-functions.yml @@ -616,12 +616,10 @@ 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" + USE_COVERAGE: "true" + script: scripts/evergreen/unit-tests-golang.sh test_helm_unit: - command: shell.exec @@ -639,19 +637,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: - command: shell.exec diff --git a/.evergreen.yml b/.evergreen.yml index 127e1c4c5d..e9e27cd8c6 100644 --- a/.evergreen.yml +++ b/.evergreen.yml @@ -280,7 +280,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" ] @@ -636,6 +636,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 diff --git a/.gitignore b/.gitignore index 5427db7cc4..88d340fc4b 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ diff --git a/Makefile b/Makefile index 40204ecf80..a8e4475afd 100644 --- a/Makefile +++ b/Makefile @@ -275,19 +275,18 @@ endif ENVTEST_ASSETS_DIR=$(shell pwd)/testbin golang-tests: - scripts/evergreen/unit-tests.sh + USE_RACE=false USE_COVERAGE=false scripts/evergreen/unit-tests-golang.sh golang-tests-race: - USE_RACE=true scripts/evergreen/unit-tests.sh + USE_RACE=true USE_COVERAGE=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 diff --git a/api/v1/mdb/sharded_cluster_validation_test.go b/api/v1/mdb/sharded_cluster_validation_test.go index 6918c4d16b..6838e9cce1 100644 --- a/api/v1/mdb/sharded_cluster_validation_test.go +++ b/api/v1/mdb/sharded_cluster_validation_test.go @@ -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 diff --git a/controllers/om/init_test.go b/controllers/om/init_test.go new file mode 100644 index 0000000000..2e8e51bfec --- /dev/null +++ b/controllers/om/init_test.go @@ -0,0 +1,13 @@ +package om + +import ( + "os" + + "go.uber.org/zap" +) + +func init() { + logger, _ := zap.NewDevelopment() + zap.ReplaceGlobals(logger) + os.Clearenv() // nolint:forbidigo +} diff --git a/controllers/operator/mock/test_fixtures.go b/controllers/operator/mock/test_fixtures.go index 8111477ec3..cfd8f20dfd 100644 --- a/controllers/operator/mock/test_fixtures.go +++ b/controllers/operator/mock/test_fixtures.go @@ -4,6 +4,7 @@ import ( "os" "github.com/mongodb/mongodb-kubernetes/pkg/util" + "github.com/mongodb/mongodb-kubernetes/pkg/util/architectures" ) // nolint:forbidigo @@ -22,4 +23,5 @@ func InitDefaultEnvVariables() { _ = os.Setenv(util.BackupDisableWaitRetriesEnv, "3") _ = os.Unsetenv(util.ManagedSecurityContextEnv) _ = os.Unsetenv(util.ImagePullSecrets) + _ = os.Unsetenv(architectures.DefaultEnvArchitecture) } diff --git a/docker/mongodb-kubernetes-init-ops-manager/Dockerfile b/docker/mongodb-kubernetes-init-ops-manager/Dockerfile index 07427ff0f8..0c84e7964d 100644 --- a/docker/mongodb-kubernetes-init-ops-manager/Dockerfile +++ b/docker/mongodb-kubernetes-init-ops-manager/Dockerfile @@ -1,12 +1,12 @@ FROM --platform=${BUILDPLATFORM} public.ecr.aws/docker/library/golang:1.24 AS base -WORKDIR /go/src -ADD ./docker/mongodb-kubernetes-init-ops-manager . +COPY . /go/src/github.com/mongodb/mongodb-kubernetes +WORKDIR /go/src/github.com/mongodb/mongodb-kubernetes ARG TARGETOS ARG TARGETARCH -RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -buildvcs=false -o /data/scripts/mmsconfiguration ./mmsconfiguration -RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -buildvcs=false -o /data/scripts/backup-daemon-readiness-probe ./backupdaemon_readinessprobe/ +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -buildvcs=false -o /data/scripts/mmsconfiguration ./docker/mongodb-kubernetes-init-ops-manager/mmsconfiguration +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -buildvcs=false -o /data/scripts/backup-daemon-readiness-probe ./docker/mongodb-kubernetes-init-ops-manager/backupdaemon_readinessprobe/ COPY ./docker/mongodb-kubernetes-init-ops-manager/scripts/docker-entry-point.sh /data/scripts/ COPY ./docker/mongodb-kubernetes-init-ops-manager/scripts/backup-daemon-liveness-probe.sh /data/scripts/ diff --git a/docker/mongodb-kubernetes-init-ops-manager/go.mod b/docker/mongodb-kubernetes-init-ops-manager/go.mod deleted file mode 100644 index 8359c6c203..0000000000 --- a/docker/mongodb-kubernetes-init-ops-manager/go.mod +++ /dev/null @@ -1,14 +0,0 @@ -module github.com/mongodb/mongodb-kubernetes/docker/mongodb-kubernetes-init-ops-manager - -go 1.24.0 - -require ( - github.com/stretchr/testify v1.10.0 - golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 -) - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) diff --git a/docker/mongodb-kubernetes-init-ops-manager/go.sum b/docker/mongodb-kubernetes-init-ops-manager/go.sum deleted file mode 100644 index eea6469fb4..0000000000 --- a/docker/mongodb-kubernetes-init-ops-manager/go.sum +++ /dev/null @@ -1,12 +0,0 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= -github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/docker/mongodb-kubernetes-init-ops-manager/mmsconfiguration/edit_mms_configuration.go b/docker/mongodb-kubernetes-init-ops-manager/mmsconfiguration/edit_mms_configuration.go index ca7b9a3b0d..f638000eec 100755 --- a/docker/mongodb-kubernetes-init-ops-manager/mmsconfiguration/edit_mms_configuration.go +++ b/docker/mongodb-kubernetes-init-ops-manager/mmsconfiguration/edit_mms_configuration.go @@ -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) } diff --git a/docker/mongodb-kubernetes-init-ops-manager/scripts/backup-daemon-liveness-probe.sh b/docker/mongodb-kubernetes-init-ops-manager/scripts/backup-daemon-liveness-probe.sh index ea8daa188c..b53ca2231b 100755 --- a/docker/mongodb-kubernetes-init-ops-manager/scripts/backup-daemon-liveness-probe.sh +++ b/docker/mongodb-kubernetes-init-ops-manager/scripts/backup-daemon-liveness-probe.sh @@ -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 \ No newline at end of file diff --git a/go.mod b/go.mod index d4dc182d3f..bfd2c5fd7c 100644 --- a/go.mod +++ b/go.mod @@ -48,14 +48,17 @@ require google.golang.org/protobuf v1.36.10 // 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.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect @@ -68,6 +71,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.3 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect @@ -82,6 +86,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.5.0 // indirect @@ -131,6 +137,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-20240911193312-2b36238f13e9 // indirect k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect @@ -139,3 +146,5 @@ require ( ) go 1.24.0 + +tool gotest.tools/gotestsum diff --git a/go.sum b/go.sum index f12b9199c6..151890f80e 100644 --- a/go.sum +++ b/go.sum @@ -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= @@ -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= @@ -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= @@ -86,6 +90,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-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo= github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +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= @@ -317,6 +323,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.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -388,6 +395,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.32.10 h1:ocp4turNfa1V40TuBW/LuA17TeXG9g/GI2ebg0KxBNk= k8s.io/api v0.32.10/go.mod h1:AsMsc4b6TuampYqgMEGSv0HBFpRS4BlKTXAVCAa7oF4= k8s.io/apiextensions-apiserver v0.31.0 h1:fZgCVhGwsclj3qCw1buVXCV6khjRzKC5eCFt24kyLSk= diff --git a/mongodb-community-operator/scripts/dev/e2e.py b/mongodb-community-operator/scripts/dev/e2e.py index a3c585649f..287ed88985 100755 --- a/mongodb-community-operator/scripts/dev/e2e.py +++ b/mongodb-community-operator/scripts/dev/e2e.py @@ -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"}], }, diff --git a/mongodb-community-operator/test/e2e/feature_compatibility_version/feature_compatibility_version_test.go b/mongodb-community-operator/test/e2e/feature_compatibility_version/feature_compatibility_version_test.go index e977ca3966..fb9e72e067 100644 --- a/mongodb-community-operator/test/e2e/feature_compatibility_version/feature_compatibility_version_test.go +++ b/mongodb-community-operator/test/e2e/feature_compatibility_version/feature_compatibility_version_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package feature_compatibility_version import ( diff --git a/mongodb-community-operator/test/e2e/prometheus/prometheus_test.go b/mongodb-community-operator/test/e2e/prometheus/prometheus_test.go index 3b0ba02ffe..37d428419f 100644 --- a/mongodb-community-operator/test/e2e/prometheus/prometheus_test.go +++ b/mongodb-community-operator/test/e2e/prometheus/prometheus_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package prometheus import ( diff --git a/mongodb-community-operator/test/e2e/replica_set/replica_set_test.go b/mongodb-community-operator/test/e2e/replica_set/replica_set_test.go index d0641f7037..7814503f76 100644 --- a/mongodb-community-operator/test/e2e/replica_set/replica_set_test.go +++ b/mongodb-community-operator/test/e2e/replica_set/replica_set_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_arbiter/replica_set_arbiter_test.go b/mongodb-community-operator/test/e2e/replica_set_arbiter/replica_set_arbiter_test.go index 52bbaa4872..e45eef2a05 100644 --- a/mongodb-community-operator/test/e2e/replica_set_arbiter/replica_set_arbiter_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_arbiter/replica_set_arbiter_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_authentication/replica_set_authentication_test.go b/mongodb-community-operator/test/e2e/replica_set_authentication/replica_set_authentication_test.go index 757ac10c41..d52a771852 100644 --- a/mongodb-community-operator/test/e2e/replica_set_authentication/replica_set_authentication_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_authentication/replica_set_authentication_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set_authentication import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_change_version/replica_set_change_version_test.go b/mongodb-community-operator/test/e2e/replica_set_change_version/replica_set_change_version_test.go index bf1128f5c0..6295f174ca 100644 --- a/mongodb-community-operator/test/e2e/replica_set_change_version/replica_set_change_version_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_change_version/replica_set_change_version_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_connection_string_options/replica_set_connection_string_options_test.go b/mongodb-community-operator/test/e2e/replica_set_connection_string_options/replica_set_connection_string_options_test.go index b5e6f52972..b9b14bfdb5 100644 --- a/mongodb-community-operator/test/e2e/replica_set_connection_string_options/replica_set_connection_string_options_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_connection_string_options/replica_set_connection_string_options_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set_connection_string_options import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_cross_namespace_deploy/replica_set_cross_namespace_deploy_test.go b/mongodb-community-operator/test/e2e/replica_set_cross_namespace_deploy/replica_set_cross_namespace_deploy_test.go index 8fd514f2a0..3e1f4c06cc 100644 --- a/mongodb-community-operator/test/e2e/replica_set_cross_namespace_deploy/replica_set_cross_namespace_deploy_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_cross_namespace_deploy/replica_set_cross_namespace_deploy_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set_cross_namespace_deploy import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_custom_annotations_test/replica_set_custom_annotations_test.go b/mongodb-community-operator/test/e2e/replica_set_custom_annotations_test/replica_set_custom_annotations_test.go index 12b213aaf8..cc21259893 100644 --- a/mongodb-community-operator/test/e2e/replica_set_custom_annotations_test/replica_set_custom_annotations_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_custom_annotations_test/replica_set_custom_annotations_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set_custom_annotations_test import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_custom_persistent_volume/replica_set_custom_persistent_volume_test.go b/mongodb-community-operator/test/e2e/replica_set_custom_persistent_volume/replica_set_custom_persistent_volume_test.go index eb03a325fc..ecf8953d25 100644 --- a/mongodb-community-operator/test/e2e/replica_set_custom_persistent_volume/replica_set_custom_persistent_volume_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_custom_persistent_volume/replica_set_custom_persistent_volume_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set_custom_persistent_volume import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_custom_role/replica_set_custom_role_test.go b/mongodb-community-operator/test/e2e/replica_set_custom_role/replica_set_custom_role_test.go index 70d3b4f47a..258d4f3319 100644 --- a/mongodb-community-operator/test/e2e/replica_set_custom_role/replica_set_custom_role_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_custom_role/replica_set_custom_role_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set_custom_role import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_enterprise_upgrade_4_5/replica_set_enterprise_upgrade_4_5_test.go b/mongodb-community-operator/test/e2e/replica_set_enterprise_upgrade_4_5/replica_set_enterprise_upgrade_4_5_test.go index 8d5e9e6783..c94e45b6eb 100644 --- a/mongodb-community-operator/test/e2e/replica_set_enterprise_upgrade_4_5/replica_set_enterprise_upgrade_4_5_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_enterprise_upgrade_4_5/replica_set_enterprise_upgrade_4_5_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_enterprise_upgrade_5_6/replica_set_enterprise_upgrade_5_6_test.go b/mongodb-community-operator/test/e2e/replica_set_enterprise_upgrade_5_6/replica_set_enterprise_upgrade_5_6_test.go index 6f7b33d779..3ef82aa30a 100644 --- a/mongodb-community-operator/test/e2e/replica_set_enterprise_upgrade_5_6/replica_set_enterprise_upgrade_5_6_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_enterprise_upgrade_5_6/replica_set_enterprise_upgrade_5_6_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_enterprise_upgrade_6_7/replica_set_enterprise_upgrade_5_6_test.go b/mongodb-community-operator/test/e2e/replica_set_enterprise_upgrade_6_7/replica_set_enterprise_upgrade_5_6_test.go index 9f2bed1834..0c7885232c 100644 --- a/mongodb-community-operator/test/e2e/replica_set_enterprise_upgrade_6_7/replica_set_enterprise_upgrade_5_6_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_enterprise_upgrade_6_7/replica_set_enterprise_upgrade_5_6_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_enterprise_upgrade_7_8/replica_set_enterprise_upgrade_5_6_test.go b/mongodb-community-operator/test/e2e/replica_set_enterprise_upgrade_7_8/replica_set_enterprise_upgrade_5_6_test.go index a7f91fa8f1..33f50b6548 100644 --- a/mongodb-community-operator/test/e2e/replica_set_enterprise_upgrade_7_8/replica_set_enterprise_upgrade_5_6_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_enterprise_upgrade_7_8/replica_set_enterprise_upgrade_5_6_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_mongod_config/replica_set_mongod_config_test.go b/mongodb-community-operator/test/e2e/replica_set_mongod_config/replica_set_mongod_config_test.go index d16887be78..85edbb4671 100644 --- a/mongodb-community-operator/test/e2e/replica_set_mongod_config/replica_set_mongod_config_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_mongod_config/replica_set_mongod_config_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set_mongod_config import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_mongod_port_change_with_arbiters/replica_set_mongod_port_change_with_arbiters_test.go b/mongodb-community-operator/test/e2e/replica_set_mongod_port_change_with_arbiters/replica_set_mongod_port_change_with_arbiters_test.go index fbcefb7466..8768c81cc8 100644 --- a/mongodb-community-operator/test/e2e/replica_set_mongod_port_change_with_arbiters/replica_set_mongod_port_change_with_arbiters_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_mongod_port_change_with_arbiters/replica_set_mongod_port_change_with_arbiters_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set_mongod_config import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_mongod_readiness/replica_set_mongod_readiness_test.go b/mongodb-community-operator/test/e2e/replica_set_mongod_readiness/replica_set_mongod_readiness_test.go index 0af26f217b..6ae9319c28 100644 --- a/mongodb-community-operator/test/e2e/replica_set_mongod_readiness/replica_set_mongod_readiness_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_mongod_readiness/replica_set_mongod_readiness_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set_mongod_readiness import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_mount_connection_string/replica_set_mount_connection_string_test.go b/mongodb-community-operator/test/e2e/replica_set_mount_connection_string/replica_set_mount_connection_string_test.go index 34917260b9..ce6eb32e4e 100644 --- a/mongodb-community-operator/test/e2e/replica_set_mount_connection_string/replica_set_mount_connection_string_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_mount_connection_string/replica_set_mount_connection_string_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set_mount_connection_string import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_multiple/replica_set_multiple_test.go b/mongodb-community-operator/test/e2e/replica_set_multiple/replica_set_multiple_test.go index b42dc1fdf7..01ea06ef4b 100644 --- a/mongodb-community-operator/test/e2e/replica_set_multiple/replica_set_multiple_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_multiple/replica_set_multiple_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set_multiple import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_operator_upgrade/replica_set_operator_upgrade_test.go b/mongodb-community-operator/test/e2e/replica_set_operator_upgrade/replica_set_operator_upgrade_test.go index c4e08505cb..fd6eea5193 100644 --- a/mongodb-community-operator/test/e2e/replica_set_operator_upgrade/replica_set_operator_upgrade_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_operator_upgrade/replica_set_operator_upgrade_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set_operator_upgrade import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_recovery/replica_set_recovery_test.go b/mongodb-community-operator/test/e2e/replica_set_recovery/replica_set_recovery_test.go index 18e699e408..8196ba5a7c 100644 --- a/mongodb-community-operator/test/e2e/replica_set_recovery/replica_set_recovery_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_recovery/replica_set_recovery_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set_recovery import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_remove_user/replica_set_remove_user_test.go b/mongodb-community-operator/test/e2e/replica_set_remove_user/replica_set_remove_user_test.go index b38208b611..23fcf00e26 100644 --- a/mongodb-community-operator/test/e2e/replica_set_remove_user/replica_set_remove_user_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_remove_user/replica_set_remove_user_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set_remove_user import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_scale/replica_set_scaling_test.go b/mongodb-community-operator/test/e2e/replica_set_scale/replica_set_scaling_test.go index 15f3b99ca5..46633425e1 100644 --- a/mongodb-community-operator/test/e2e/replica_set_scale/replica_set_scaling_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_scale/replica_set_scaling_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set_scale_up import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_scale_down/replica_set_scale_down_test.go b/mongodb-community-operator/test/e2e/replica_set_scale_down/replica_set_scale_down_test.go index f474688f7c..82acfcad3a 100644 --- a/mongodb-community-operator/test/e2e/replica_set_scale_down/replica_set_scale_down_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_scale_down/replica_set_scale_down_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set_scale_down import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_tls/replica_set_tls_test.go b/mongodb-community-operator/test/e2e/replica_set_tls/replica_set_tls_test.go index 1d5eb2d8ba..76db00276d 100644 --- a/mongodb-community-operator/test/e2e/replica_set_tls/replica_set_tls_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_tls/replica_set_tls_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set_tls import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_tls_recreate_mdbc/replica_set_tls_recreate_mdbc_test.go b/mongodb-community-operator/test/e2e/replica_set_tls_recreate_mdbc/replica_set_tls_recreate_mdbc_test.go index 69b697ed4f..b9d4dcce95 100644 --- a/mongodb-community-operator/test/e2e/replica_set_tls_recreate_mdbc/replica_set_tls_recreate_mdbc_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_tls_recreate_mdbc/replica_set_tls_recreate_mdbc_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set_tls import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_tls_rotate/replica_set_tls_rotate_test.go b/mongodb-community-operator/test/e2e/replica_set_tls_rotate/replica_set_tls_rotate_test.go index 1a0efc6e0a..057ac17230 100644 --- a/mongodb-community-operator/test/e2e/replica_set_tls_rotate/replica_set_tls_rotate_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_tls_rotate/replica_set_tls_rotate_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set_tls import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_tls_rotate_delete_sts/replica_set_tls_rotate_delete_sts_test.go b/mongodb-community-operator/test/e2e/replica_set_tls_rotate_delete_sts/replica_set_tls_rotate_delete_sts_test.go index ab00a2ceed..ef64817fe0 100644 --- a/mongodb-community-operator/test/e2e/replica_set_tls_rotate_delete_sts/replica_set_tls_rotate_delete_sts_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_tls_rotate_delete_sts/replica_set_tls_rotate_delete_sts_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set_tls_rotate_delete_sts import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_tls_upgrade/replica_set_tls_upgrade_test.go b/mongodb-community-operator/test/e2e/replica_set_tls_upgrade/replica_set_tls_upgrade_test.go index c602abcdb2..ab738ff589 100644 --- a/mongodb-community-operator/test/e2e/replica_set_tls_upgrade/replica_set_tls_upgrade_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_tls_upgrade/replica_set_tls_upgrade_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set_tls import ( diff --git a/mongodb-community-operator/test/e2e/replica_set_x509/replica_set_x509_test.go b/mongodb-community-operator/test/e2e/replica_set_x509/replica_set_x509_test.go index 639666cc63..57c25f25b5 100644 --- a/mongodb-community-operator/test/e2e/replica_set_x509/replica_set_x509_test.go +++ b/mongodb-community-operator/test/e2e/replica_set_x509/replica_set_x509_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package replica_set_x509 import ( diff --git a/mongodb-community-operator/test/e2e/statefulset_arbitrary_config/statefulset_arbitrary_config_test.go b/mongodb-community-operator/test/e2e/statefulset_arbitrary_config/statefulset_arbitrary_config_test.go index b12d784218..c0531f0c98 100644 --- a/mongodb-community-operator/test/e2e/statefulset_arbitrary_config/statefulset_arbitrary_config_test.go +++ b/mongodb-community-operator/test/e2e/statefulset_arbitrary_config/statefulset_arbitrary_config_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package statefulset_arbitrary_config_update import ( diff --git a/mongodb-community-operator/test/e2e/statefulset_arbitrary_config_update/statefulset_arbitrary_config_update_test.go b/mongodb-community-operator/test/e2e/statefulset_arbitrary_config_update/statefulset_arbitrary_config_update_test.go index 62447f63ca..7fff0cf459 100644 --- a/mongodb-community-operator/test/e2e/statefulset_arbitrary_config_update/statefulset_arbitrary_config_update_test.go +++ b/mongodb-community-operator/test/e2e/statefulset_arbitrary_config_update/statefulset_arbitrary_config_update_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package statefulset_arbitrary_config import ( diff --git a/mongodb-community-operator/test/e2e/statefulset_delete/statefulset_delete_test.go b/mongodb-community-operator/test/e2e/statefulset_delete/statefulset_delete_test.go index 63b5b4efd2..2a4d42a470 100644 --- a/mongodb-community-operator/test/e2e/statefulset_delete/statefulset_delete_test.go +++ b/mongodb-community-operator/test/e2e/statefulset_delete/statefulset_delete_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package statefulset_delete import ( diff --git a/mongodb-community-operator/test/e2e/util/mongotester/mongotester_test.go b/mongodb-community-operator/test/e2e/util/mongotester/mongotester_test.go index 91ca6489b5..76fd8bb0cf 100644 --- a/mongodb-community-operator/test/e2e/util/mongotester/mongotester_test.go +++ b/mongodb-community-operator/test/e2e/util/mongotester/mongotester_test.go @@ -1,3 +1,5 @@ +//go:build community_e2e + package mongotester import ( diff --git a/pkg/images/Imageurls.go b/pkg/images/Imageurls.go index 2e4ed59918..bfb7db5e6c 100644 --- a/pkg/images/Imageurls.go +++ b/pkg/images/Imageurls.go @@ -13,6 +13,10 @@ import ( "github.com/mongodb/mongodb-kubernetes/pkg/util/env" ) +func init() { + os.Clearenv() // nolint:forbidigo +} + // replaceImageTagOrDigestToTag returns the image with the tag or digest replaced to a given version func replaceImageTagOrDigestToTag(image string, newVersion string) string { // example: quay.io/mongodb/mongodb-agent@sha256:6a82abae27c1ba1133f3eefaad71ea318f8fa87cc57fe9355d6b5b817ff97f1a diff --git a/pkg/telemetry/init_test.go b/pkg/telemetry/init_test.go new file mode 100644 index 0000000000..1abbdf4bf0 --- /dev/null +++ b/pkg/telemetry/init_test.go @@ -0,0 +1,13 @@ +package telemetry + +import ( + "os" + + "go.uber.org/zap" +) + +func init() { + logger, _ := zap.NewDevelopment() + zap.ReplaceGlobals(logger) + os.Clearenv() // nolint:forbidigo +} diff --git a/pkg/util/architectures/static_test.go b/pkg/util/architectures/static_test.go index 2f11a0015c..137dec7216 100644 --- a/pkg/util/architectures/static_test.go +++ b/pkg/util/architectures/static_test.go @@ -5,6 +5,8 @@ import ( ) func TestIsRunningStaticArchitecture(t *testing.T) { + t.Setenv(DefaultEnvArchitecture, "") + tests := []struct { name string annotations map[string]string diff --git a/scripts/code_snippets/kind_search_snippets_render_template.sh b/scripts/code_snippets/kind_search_snippets_render_template.sh index 57d2fcc280..2aa68dcaa1 100755 --- a/scripts/code_snippets/kind_search_snippets_render_template.sh +++ b/scripts/code_snippets/kind_search_snippets_render_template.sh @@ -3,4 +3,4 @@ set -eou pipefail test_dir="$1" -scripts/evergreen/run_python.sh scripts/code_snippets/render_template.py "${test_dir}/README.md.j2" "${test_dir}/README.md" +scripts/dev/run_python.sh scripts/code_snippets/render_template.py "${test_dir}/README.md.j2" "${test_dir}/README.md" diff --git a/scripts/evergreen/unit-tests-golang.sh b/scripts/evergreen/unit-tests-golang.sh new file mode 100755 index 0000000000..a9ece15932 --- /dev/null +++ b/scripts/evergreen/unit-tests-golang.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -Eeou pipefail + +set -x + +source scripts/dev/set_env_context.sh + +USE_RACE_SWITCH="" +if [[ "${USE_RACE:-"false"}" = "true" ]]; then + USE_RACE_SWITCH="-race" +fi + +USE_COVERAGE_SWITCH="" +if [[ "${USE_COVERAGE:-"false"}" = "true" ]]; then + USE_COVERAGE_SWITCH="-coverprofile cover.out" +fi + +rm golang-unit-result.xml cover.out 2>/dev/null || true + +# gotestsum is just a wrapper on go test -json adding output formatting and xml file +# shellcheck disable=SC2086 +go tool gotestsum --junitfile golang-unit-result.xml --format-icons hivis -- -v ${USE_RACE_SWITCH} ${USE_COVERAGE_SWITCH} ./... diff --git a/scripts/evergreen/unit-tests-python.sh b/scripts/evergreen/unit-tests-python.sh new file mode 100755 index 0000000000..fc99b28560 --- /dev/null +++ b/scripts/evergreen/unit-tests-python.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -Eeou pipefail + +# e2e tests are also in python and we will need to ignore them as they are in the docker/mongodb-kubernetes-tests folder +# we also ignore generate_ssdlc_report_test.py as it's very slow +scripts/dev/run_python.sh -m pytest --junitxml=python-unit-result.xml --ignore=docker/mongodb-kubernetes-tests --ignore=generate_ssdlc_report_test.py +# additionally, we have one lib which we want to test which is in the =docker/mongodb-kubernetes-tests folder. +scripts/dev/run_python.sh -m pytest --junitxml=python-kubeobject-result.xml docker/mongodb-kubernetes-tests/kubeobject + diff --git a/scripts/evergreen/unit-tests-sbom.sh b/scripts/evergreen/unit-tests-sbom.sh new file mode 100755 index 0000000000..28c171573c --- /dev/null +++ b/scripts/evergreen/unit-tests-sbom.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -Eeou pipefail + +scripts/dev/run_python.sh -m pytest --junitxml=python-ssdlc-result.xml generate_ssdlc_report_test.py diff --git a/scripts/evergreen/unit-tests.sh b/scripts/evergreen/unit-tests.sh deleted file mode 100755 index 60fb081a4b..0000000000 --- a/scripts/evergreen/unit-tests.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -set -Eeou pipefail - -# shellcheck disable=SC2038 -# shellcheck disable=SC2016 -# TODO: MCK once we merge folder we need to update this -# This command iterates over all the dirs (excepting ./docker/mongodb-kubernetes-tests/*) that have go.mod in them -# and then `cd`s into those to run the go test command. -find . -name go.mod -not -path "./docker/mongodb-kubernetes-tests/*" -exec dirname "{}" \+ | xargs -L 1 /bin/bash -c ' -cd "$0" -echo "testing $0" -rm -f result.suite -if [ "$USE_RACE" = "true" ]; then - echo "running test with race enabled" - GO_TEST_CMD="go test -v -coverprofile cover.out \$(go list ./... | grep -v \"mongodb-community-operator/test/e2e\")" -else - echo "running test without race enabled" - GO_TEST_CMD="go test -v -coverprofile cover.out \$(go list ./... | grep -v \"mongodb-community-operator/test/e2e\")" -fi -echo "running $GO_TEST_CMD" -eval "$GO_TEST_CMD" | tee -a result.suite -'