Skip to content

Commit 81befee

Browse files
CLOUDP-79644: Running replicaset/shared cluster tests on ops manager 4.4 and 4.2 (#601)
1 parent b080773 commit 81befee

File tree

9 files changed

+144
-11
lines changed

9 files changed

+144
-11
lines changed

build/ci/ego

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,12 @@ _user_dir() {
317317

318318
scenario_install_agent() {
319319
local baseUrl="https://cloud.mongodb.com"
320+
local ops_manager=0
320321

321322
while [[ "$#" -gt 0 ]]; do
322323
case "$1" in
323324
--baseUrl) baseUrl=$2; shift 2 ;;
325+
--ops-manager) ops_manager=1; shift;;
324326
* ) echo "Invalid option for installing mongodb $1"; return 1 ;;
325327
esac
326328
done
@@ -339,6 +341,11 @@ scenario_install_agent() {
339341
replace_property_in_file /etc/mongodb-mms/automation-agent.config mmsGroupId "${LC_GROUP_ID}"
340342
replace_property_in_file /etc/mongodb-mms/automation-agent.config mmsApiKey "${LC_AGENT_KEY}"
341343

344+
if [[ "${ops_manager}" -eq 1 ]]; then
345+
echo "Replacing mmsBaseUrl with ${baseUrl::-1}"
346+
replace_property_in_file /etc/mongodb-mms/automation-agent.config mmsBaseUrl "${baseUrl::-1}"
347+
fi
348+
342349
echo "Preparing the /data directory to store your MongoDB data"
343350
mkdir -p /data
344351
chown -R mongodb:mongodb /data

build/ci/evergreen.yml

Lines changed: 105 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ tasks:
735735
MCLI_SERVICE: cloud-manager
736736
E2E_TAGS: cloudmanager,generic
737737
- name: ops_manager_generic_4_4_e2e
738-
tags: ["e2e","generic","opsmanager"]
738+
tags: ["opsmanager", "general"]
739739
depends_on:
740740
- name: compile
741741
variant: "code_health"
@@ -754,7 +754,7 @@ tasks:
754754
vars:
755755
E2E_TAGS: opsmanager,generic
756756
- name: ops_manager_generic_4_2_e2e
757-
tags: ["e2e","generic","opsmanager"]
757+
tags: ["opsmanager", "general"]
758758
depends_on:
759759
- name: compile
760760
variant: "code_health"
@@ -794,6 +794,91 @@ tasks:
794794
MCLI_OPS_MANAGER_URL: ${mcli_ops_manager_url}
795795
MCLI_SERVICE: cloud-manager
796796
E2E_TAGS: cloudmanager,remote,replica
797+
# Deploy a replica set, we need to be careful on running parallel modifications to the automation config
798+
- name: ops_manager_4_4_deploy_replica_set_e2e
799+
tags: ["e2e","clusters","opsmanager"]
800+
depends_on:
801+
- name: compile
802+
variant: "code_health"
803+
patch_optional: true
804+
commands:
805+
- func: "clone"
806+
- func: "install gotestsum"
807+
- func: "build"
808+
- func: "deploy spawn host"
809+
- func: ssh-ready
810+
- func: "install ops manager"
811+
vars:
812+
ARCHIVE: ${ops_manager_4_4_archive}
813+
- func: "set-up ops manager"
814+
- func: "install automation agent"
815+
- func: "e2e test"
816+
vars:
817+
E2E_TAGS: opsmanager,remote,replica
818+
# Deploy a sharded cluster, we need to be careful on running parallel modifications to the automation config
819+
- name: ops_manager_4_4_deploy_sharded_cluster_e2e
820+
tags: ["e2e","clusters","opsmanager"]
821+
depends_on:
822+
- name: compile
823+
variant: "code_health"
824+
patch_optional: true
825+
commands:
826+
- func: "clone"
827+
- func: "install gotestsum"
828+
- func: "build"
829+
- func: "deploy spawn host"
830+
- func: ssh-ready
831+
- func: "install ops manager"
832+
vars:
833+
ARCHIVE: ${ops_manager_4_4_archive}
834+
- func: "set-up ops manager"
835+
- func: "install automation agent"
836+
- func: "e2e test"
837+
vars:
838+
E2E_TAGS: opsmanager,remote,sharded
839+
# Deploy a replica set, we need to be careful on running parallel modifications to the automation config
840+
# 4.2 tests are failing because of this https://github.com/mongodb/mongocli/pull/601#issuecomment-772401224
841+
# - name: ops_manager_4_2_deploy_replica_set_e2e
842+
# tags: ["opsmanager","clusters"]
843+
# depends_on:
844+
# - name: compile
845+
# variant: "code_health"
846+
# patch_optional: true
847+
# commands:
848+
# - func: "clone"
849+
# - func: "install gotestsum"
850+
# - func: "build"
851+
# - func: "deploy spawn host"
852+
# - func: ssh-ready
853+
# - func: "install ops manager"
854+
# vars:
855+
# ARCHIVE: ${ops_manager_4_2_archive}
856+
# - func: "set-up ops manager"
857+
# - func: "install automation agent"
858+
# - func: "e2e test"
859+
# vars:
860+
# E2E_TAGS: opsmanager,remote,replica
861+
# # Deploy a sharded cluster, we need to be careful on running parallel modifications to the automation config
862+
# - name: ops_manager_4_2_deploy_sharded_cluster_e2e
863+
# tags: ["opsmanager","clusters"]
864+
# depends_on:
865+
# - name: compile
866+
# variant: "code_health"
867+
# patch_optional: true
868+
# commands:
869+
# - func: "clone"
870+
# - func: "install gotestsum"
871+
# - func: "build"
872+
# - func: "deploy spawn host"
873+
# - func: ssh-ready
874+
# - func: "install ops manager"
875+
# vars:
876+
# ARCHIVE: ${ops_manager_4_2_archive}
877+
# - func: "set-up ops manager"
878+
# - func: "install automation agent"
879+
# - func: "e2e test"
880+
# vars:
881+
# E2E_TAGS: opsmanager,remote,sharded
797882
# Deploy a sharded cluster, we need to be careful on running parallel modifications to the automation config
798883
- name: cloud_manager_deploy_sharded_cluster_e2e
799884
tags: ["e2e","clusters","cloudmanager"]
@@ -1429,6 +1514,15 @@ buildvariants:
14291514
go_bin: "/opt/golang/go1.15/bin"
14301515
tasks:
14311516
- name: ".e2e .generic"
1517+
- name: opsmanager_e2e_generic
1518+
display_name: "Ops Manager E2E Tests Generic"
1519+
run_on:
1520+
- rhel70-small
1521+
expansions:
1522+
go_root: "/opt/golang/go1.15"
1523+
go_bin: "/opt/golang/go1.15/bin"
1524+
tasks:
1525+
- name: ".opsmanager .general"
14321526
- name: e2e_atlas_clusters
14331527
display_name: "E2E Atlas Cluster Tests"
14341528
run_on:
@@ -1465,6 +1559,15 @@ buildvariants:
14651559
go_bin: "/opt/golang/go1.15/bin"
14661560
tasks:
14671561
- name: ".e2e .clusters .cloudmanager"
1562+
- name: e2e_ops_manager_remote
1563+
display_name: "E2E Ops Manager Remote Host Tests"
1564+
run_on:
1565+
- rhel70-small
1566+
expansions:
1567+
go_root: "/opt/golang/go1.15"
1568+
go_bin: "/opt/golang/go1.15/bin"
1569+
tasks:
1570+
- name: ".e2e .clusters .opsmanager"
14681571
- name: goreleaser_snapshot
14691572
display_name: "Packaging and Publishing (goreleaser, apt, yum)"
14701573
run_on:

build/ci/install-agent-spawn-host.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17+
# automation_agent_settings.sh constains the configurations needed
18+
# to install the automation agent with ops manager.
19+
# this script is created in set-up-ops-manager.sh
20+
# run this script before setting set - so it's safe if it is not there
21+
# shellcheck disable=SC1091
22+
source automation_agent_settings.sh
1723

1824
set -euo pipefail
1925

@@ -33,6 +39,13 @@ while getopts 'i:h:g:u:a:b:' opt; do
3339
esac
3440
done
3541

42+
flags=()
43+
if [[ -n "${MCLI_SERVICE+x}" ]]; then
44+
flags+=("--ops-manager")
45+
fi
46+
47+
flags+=("--baseUrl ${BASE_URL}")
48+
3649
export SSH_OPTS="-i ${keyfile} -o SendEnv=LC_GROUP_ID -o SendEnv=LC_AGENT_KEY"
3750

3851
hosts=$(
@@ -50,7 +63,6 @@ for host in ${hosts}; do
5063
./ego seed "${user}@${host}"
5164

5265
echo "bin/ego scenario_install_agent"
53-
./ego run "${user}@${host}" bin/ego scenario_install_agent \
54-
--baseUrl "${BASE_URL}"
66+
./ego run "${user}@${host}" bin/ego scenario_install_agent "${flags[@]}"
5567

5668
done

build/ci/set-up-ops-manager.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,16 @@ MCLI_PUBLIC_API_KEY=$(date +%s | sha256sum | base64 | head -c 8)@ops-manager-tea
5252
export MCLI_PUBLIC_API_KEY
5353

5454
echo "create first user"
55-
MCLI_PRIVATE_API_KEY=$(./bin/mongocli om owner create --firstName evergreen --lastName evergreen --email "${MCLI_PUBLIC_API_KEY}" --password "${password}" -o="go-template={{.APIKey}}")
55+
MCLI_PRIVATE_API_KEY=$(./bin/mongocli om owner create --firstName evergreen --lastName evergreen --email "${MCLI_PUBLIC_API_KEY}" --password "${password}" --accessListIp "127.0.0.1/1" -o="go-template={{.APIKey}}")
5656
export MCLI_PRIVATE_API_KEY
5757

5858
echo "create organization"
5959
MCLI_ORG_ID=$(./bin/mongocli iam organizations create myOrg -o="go-template={{.ID}}")
6060

6161
echo "create project"
62-
MCLI_PROJECT_ID=$(./bin/mongocli iam projects create myProj --orgId "${MCLI_ORG_ID}" -o="go-template={{.ID}}")
62+
AGENT_API_KEY=$(./bin/mongocli iam projects create myProj --orgId "${MCLI_ORG_ID}" -o="go-template={{.AgentAPIKey}}")
63+
MCLI_PROJECT_ID=$(./bin/mongocli iam project list -o="go-template={{ (index .Results 0).ID }}")
64+
6365

6466
cat <<EOF > "${XDG_CONFIG_HOME}/mongocli.toml"
6567
[default]
@@ -69,6 +71,15 @@ cat <<EOF > "${XDG_CONFIG_HOME}/mongocli.toml"
6971
private_api_key = "${MCLI_PRIVATE_API_KEY}"
7072
org_id = "${MCLI_ORG_ID}"
7173
project_id = "${MCLI_PROJECT_ID}"
74+
agent_api_key = "${AGENT_API_KEY}"
75+
76+
EOF
7277

78+
popd
79+
cat <<EOF > automation_agent_settings.sh
80+
export BASE_URL=${MCLI_OPS_MANAGER_URL}
81+
export LC_AGENT_KEY=${AGENT_API_KEY}
82+
export LC_GROUP_ID=${MCLI_PROJECT_ID}
83+
export MCLI_SERVICE=ops-manager
7384
EOF
7485

e2e/cloud_manager/agent_api_keys_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
// +build e2e cloudmanager,remote,replica
14+
// +build e2e cloudmanager,remote,replica opsmanager,remote,replica
1515

1616
package cloud_manager_test
1717

e2e/cloud_manager/agents_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
// +build e2e cloudmanager,remote,replica
14+
// +build e2e cloudmanager,remote,replica opsmanager,remote,replica
1515

1616
package cloud_manager_test
1717

e2e/cloud_manager/deploy_replica_set_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
// +build e2e cloudmanager,remote,replica
14+
// +build e2e cloudmanager,remote,replica opsmanager,remote,replica
1515

1616
package cloud_manager_test
1717

e2e/cloud_manager/deploy_sharded_cluster_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
// +build e2e cloudmanager,remote,sharded
14+
// +build e2e cloudmanager,remote,sharded opsmanager,remote,sharded
1515

1616
package cloud_manager_test
1717

e2e/cloud_manager/servers_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
// +build e2e cloudmanager,remote,replica
14+
// +build e2e cloudmanager,remote,replica opsmanager,remote,replica
1515

1616
package cloud_manager_test
1717

0 commit comments

Comments
 (0)