|
1 | 1 | import json |
| 2 | +import os |
| 3 | +from scripts.release.build.build_scenario import BuildScenario |
| 4 | +from scripts.release.release_info import convert_to_release_info_json |
| 5 | +from scripts.release.build.build_info import load_build_info |
2 | 6 |
|
3 | | -from scripts.release.release_info import DUMMY_VERSION, create_release_info_json |
4 | | - |
| 7 | +OPERATOR_VERSION = "1.6.0" |
5 | 8 |
|
6 | 9 | def test_create_release_info_json(): |
7 | 10 | expected_json = { |
8 | 11 | "images": { |
9 | 12 | "operator": { |
10 | | - "repositories": ["quay.io/mongodb/mongodb-kubernetes"], |
11 | | - "platforms": ["linux/arm64", "linux/amd64", "linux/s390x", "linux/ppc64le"], |
12 | | - "version": DUMMY_VERSION, |
| 13 | + "repoURL": "quay.io/mongodb/mongodb-kubernetes", |
| 14 | + "platforms": [ |
| 15 | + "linux/arm64", |
| 16 | + "linux/amd64", |
| 17 | + "linux/s390x", |
| 18 | + "linux/ppc64le" |
| 19 | + ], |
| 20 | + "tag": "1.6.0", |
| 21 | + "digest": "sha256:317a7f2d40807629b1df78e7ef81790bcaeb09993d88b476ec3a33ee44cbb78d" |
13 | 22 | }, |
14 | 23 | "init-database": { |
15 | | - "repositories": ["quay.io/mongodb/mongodb-kubernetes-init-database"], |
16 | | - "platforms": ["linux/arm64", "linux/amd64", "linux/s390x", "linux/ppc64le"], |
17 | | - "version": DUMMY_VERSION, |
| 24 | + "repoURL": "quay.io/mongodb/mongodb-kubernetes-init-database", |
| 25 | + "platforms": [ |
| 26 | + "linux/arm64", |
| 27 | + "linux/amd64", |
| 28 | + "linux/s390x", |
| 29 | + "linux/ppc64le" |
| 30 | + ], |
| 31 | + "tag": "1.6.0", |
| 32 | + "digest": "sha256:ce10a711a6e6a31d20deecbe0ef15b5f82c2ca24d495fb832f5199ac327ee8ec" |
18 | 33 | }, |
19 | 34 | "init-appdb": { |
20 | | - "repositories": ["quay.io/mongodb/mongodb-kubernetes-init-appdb"], |
21 | | - "platforms": ["linux/arm64", "linux/amd64", "linux/s390x", "linux/ppc64le"], |
22 | | - "version": DUMMY_VERSION, |
| 35 | + "repoURL": "quay.io/mongodb/mongodb-kubernetes-init-appdb", |
| 36 | + "platforms": [ |
| 37 | + "linux/arm64", |
| 38 | + "linux/amd64", |
| 39 | + "linux/s390x", |
| 40 | + "linux/ppc64le" |
| 41 | + ], |
| 42 | + "tag": "1.6.0", |
| 43 | + "digest": "sha256:b0b66397056636052756157628c164d480f540d919a615d057192d553a7e892c" |
23 | 44 | }, |
24 | 45 | "init-ops-manager": { |
25 | | - "repositories": ["quay.io/mongodb/mongodb-kubernetes-init-ops-manager"], |
26 | | - "platforms": ["linux/amd64"], |
27 | | - "version": DUMMY_VERSION, |
| 46 | + "repoURL": "quay.io/mongodb/mongodb-kubernetes-init-ops-manager", |
| 47 | + "platforms": [ |
| 48 | + "linux/amd64" |
| 49 | + ], |
| 50 | + "tag": "1.6.0", |
| 51 | + "digest": "sha256:62825c8edcd45e26586cce5b4062d6930847db0c58a76c168312be8cdc934707" |
28 | 52 | }, |
29 | 53 | "database": { |
30 | | - "repositories": ["quay.io/mongodb/mongodb-kubernetes-database"], |
31 | | - "platforms": ["linux/arm64", "linux/amd64", "linux/s390x", "linux/ppc64le"], |
32 | | - "version": DUMMY_VERSION, |
| 54 | + "repoURL": "quay.io/mongodb/mongodb-kubernetes-database", |
| 55 | + "platforms": [ |
| 56 | + "linux/arm64", |
| 57 | + "linux/amd64", |
| 58 | + "linux/s390x", |
| 59 | + "linux/ppc64le" |
| 60 | + ], |
| 61 | + "tag": "1.6.0", |
| 62 | + "digest": "sha256:382248da5bdd90c8dbb0a1571b5f9ec90c10931c7e0974f4563a522963304b58" |
33 | 63 | }, |
34 | | - "readiness-probe": { |
35 | | - "repositories": ["quay.io/mongodb/mongodb-kubernetes-readinessprobe"], |
36 | | - "platforms": ["linux/arm64", "linux/amd64"], |
37 | | - "version": DUMMY_VERSION, |
| 64 | + "ops-manager": { |
| 65 | + "repoURL": "quay.io/mongodb/mongodb-enterprise-ops-manager-ubi", |
| 66 | + "platforms": [ |
| 67 | + "linux/amd64" |
| 68 | + ], |
| 69 | + "tag": "8.0.16", |
| 70 | + "digest": "sha256:ca4aad523f14d68fccb60256f9ce8909c66ebb5b321ee15e5abf9ac5738947f9" |
| 71 | + }, |
| 72 | + "agent": { |
| 73 | + "repoURL": "quay.io/mongodb/mongodb-agent", |
| 74 | + "platforms": [ |
| 75 | + "linux/arm64", |
| 76 | + "linux/amd64", |
| 77 | + "linux/s390x", |
| 78 | + "linux/ppc64le" |
| 79 | + ], |
| 80 | + "tag": "108.0.16.8895-1", |
| 81 | + "digest": "sha256:6c5df0e0ec425731da1f82c7229304c1a01353d3aa81e02423f84904d96a7688" |
38 | 82 | }, |
39 | 83 | "upgrade-hook": { |
40 | | - "repositories": ["quay.io/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook"], |
41 | | - "platforms": ["linux/arm64", "linux/amd64"], |
42 | | - "version": DUMMY_VERSION, |
| 84 | + "repoURL": "quay.io/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook", |
| 85 | + "platforms": [ |
| 86 | + "linux/arm64", |
| 87 | + "linux/amd64" |
| 88 | + ], |
| 89 | + "tag": "1.0.10", |
| 90 | + "digest": "sha256:f321ec1d25d6e98805b8be9321f2a926d702835136dde88d5fffe917c2df1d0a" |
43 | 91 | }, |
44 | | - }, |
45 | | - "binaries": { |
46 | | - "kubectl-mongodb": { |
| 92 | + "readiness-probe": { |
| 93 | + "repoURL": "quay.io/mongodb/mongodb-kubernetes-readinessprobe", |
47 | 94 | "platforms": [ |
48 | | - "darwin/amd64", |
49 | | - "darwin/arm64", |
50 | | - "linux/amd64", |
51 | 95 | "linux/arm64", |
52 | | - "linux/s390x", |
53 | | - "linux/ppc64le", |
| 96 | + "linux/amd64" |
54 | 97 | ], |
55 | | - "version": DUMMY_VERSION, |
| 98 | + "tag": "1.0.23", |
| 99 | + "digest": "sha256:436fc328f3887f022a4760afd03da1a7091d285baf3d627a17d80bbdaab0ee47" |
| 100 | + }, |
| 101 | + "search": { |
| 102 | + "repoURL": "quay.io/mongodb/mongodb-search", |
| 103 | + "platforms": [ |
| 104 | + "linux/arm64", |
| 105 | + "linux/amd64" |
| 106 | + ], |
| 107 | + "tag": "0.55.0", |
| 108 | + "digest": "sha256:c1e636119aa206ff98cefed37ee4b488d75c6a5e6025dcb71f44275a8f3f546a" |
| 109 | + }, |
| 110 | + "mongodb-enterprise-server": { |
| 111 | + "repoURL": "quay.io/mongodb/mongodb-enterprise-server", |
| 112 | + "platforms": [ |
| 113 | + "linux/arm64", |
| 114 | + "linux/amd64" |
| 115 | + ], |
| 116 | + "tag": "8.0.0-ubi9", |
| 117 | + "digest": "sha256:7a93a0276531ff9be4c90bb8fe8d104e0a9e930c29792aafe03cc6a76a9fa89c" |
56 | 118 | } |
57 | 119 | }, |
58 | | - "helm-charts": { |
59 | | - "mongodb-kubernetes": {"registry": "quay.io", "repository": "mongodb/helm-charts", "version": DUMMY_VERSION} |
60 | | - }, |
61 | | - } |
62 | | - expected_release_info_json = json.dumps(expected_json, indent=2) |
63 | | - release_info_json = create_release_info_json() |
64 | | - |
65 | | - assert release_info_json == expected_release_info_json |
| 120 | + "latestOpsManagerAgentMapping": [ |
| 121 | + { |
| 122 | + "6": { |
| 123 | + "opsManagerVersion": "6.0.27", |
| 124 | + "agentVersion": "12.0.35.7911-1" |
| 125 | + } |
| 126 | + }, |
| 127 | + { |
| 128 | + "7": { |
| 129 | + "opsManagerVersion": "7.0.19", |
| 130 | + "agentVersion": "107.0.19.8805-1" |
| 131 | + } |
| 132 | + }, |
| 133 | + { |
| 134 | + "8": { |
| 135 | + "opsManagerVersion": "8.0.16", |
| 136 | + "agentVersion": "108.0.16.8895-1" |
| 137 | + } |
| 138 | + } |
| 139 | + ] |
| 140 | + } |
| 141 | + |
| 142 | + build_info = load_build_info(scenario=BuildScenario.RELEASE) |
| 143 | + |
| 144 | + # release_test.json is just a copy of our original release.json file and it's created so that we can easily |
| 145 | + # test release_info.py. If we directly used release.json, we will have to change the expected output `expected_json` |
| 146 | + # because content of release.json changes after every MCK/OM/Agent release. |
| 147 | + test_release_json_path = os.path.join(os.getcwd(), "scripts/release/tests/testdata/release_test.json") |
| 148 | + release_info_asset = convert_to_release_info_json(build_info, test_release_json_path, OPERATOR_VERSION) |
| 149 | + |
| 150 | + assert release_info_asset == expected_json |
0 commit comments