metadata_persistence_v2.go ×4

Frontier kind: Code frontier

unlabeled · c_685322c13fdf

7 tests · 4236 LOC · 180 files · introduces 0 tests · 120 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
4 ranges120 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
739 ranges4236 lines · 180 files · Browse complete extent
All tests (intent)
7 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 120 introduced LOC across 4 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/common/persistence/persistence-tests/metadata_persistence_v2.go 120 introduced LOC · 4 ranges

Open complete file

1202
1203 // TestListNamespaces test
1204 > func (m *MetadataPersistenceSuiteV2) TestListNamespaces() { metadata_persistence_v2.go
1205 > clusterActive1 := "some random active cluster name"
1206 > clusterStandby1 := "some random standby cluster name"
1207 > clusters1 := []string{clusterActive1, clusterStandby1}
1208 >
1209 > clusterActive2 := "other random active cluster name"
1210 > clusterStandby2 := "other random standby cluster name"
1211 > clusters2 := []string{clusterActive2, clusterStandby2}
1212 >
1213 > testBinaries1 := &namespacepb.BadBinaries{
1214 > Binaries: map[string]*namespacepb.BadBinaryInfo{
1215 > "abc": {
1216 > Reason: "test-reason1",
1217 > Operator: "test-operator1",
1218 > CreateTime: timestamppb.New(time.Date(2020, 8, 22, 0, 0, 0, 0, time.UTC)),
1219 > },
1220 > },
1221 > }
1222 > testBinaries2 := &namespacepb.BadBinaries{
1223 > Binaries: map[string]*namespacepb.BadBinaryInfo{
1224 > "efg": {
1225 > Reason: "test-reason2",
1226 > Operator: "test-operator2",
1227 > CreateTime: timestamppb.New(time.Date(2020, 8, 22, 0, 0, 0, 0, time.UTC)),
1228 > },
1229 > },
1230 > }
1231 >
1232 > inputNamespaces := []*p.GetNamespaceResponse{
1233 > {
1234 > Namespace: &persistencespb.NamespaceDetail{
1235 > Info: &persistencespb.NamespaceInfo{
1236 > Id: uuid.NewString(),
1237 > Name: "list-namespace-test-name-1",
1238 > State: enumspb.NAMESPACE_STATE_REGISTERED,
1239 > Description: "list-namespace-test-description-1",
1240 > Owner: "list-namespace-test-owner-1",
1241 > Data: map[string]string{"k1": "v1"},
1242 > },
1243 > Config: &persistencespb.NamespaceConfig{
1244 > Retention: timestamp.DurationFromDays(109),
1245 > HistoryArchivalState: enumspb.ARCHIVAL_STATE_ENABLED,
1246 > HistoryArchivalUri: "test://history/uri",
1247 > VisibilityArchivalState: enumspb.ARCHIVAL_STATE_ENABLED,
1248 > VisibilityArchivalUri: "test://visibility/uri",
1249 > BadBinaries: testBinaries1,
1250 > },
1251 > ReplicationConfig: &persistencespb.NamespaceReplicationConfig{
1252 > ActiveClusterName: clusterActive1,
1253 > Clusters: clusters1,
1254 > },
1255 >
1256 > ConfigVersion: 133,
1257 > FailoverVersion: 266,
1258 > },
1259 > IsGlobalNamespace: true,
1260 > },
1261 > {
1262 > Namespace: &persistencespb.NamespaceDetail{
1263 > Info: &persistencespb.NamespaceInfo{
1264 > Id: uuid.NewString(),
1265 > Name: "list-namespace-test-name-2",
1266 > State: enumspb.NAMESPACE_STATE_REGISTERED,
1267 > Description: "list-namespace-test-description-2",
1268 > Owner: "list-namespace-test-owner-2",
1269 > Data: map[string]string{"k1": "v2"},
1270 > },
1271 > Config: &persistencespb.NamespaceConfig{
1272 > Retention: timestamp.DurationFromDays(326),
1273 > HistoryArchivalState: enumspb.ARCHIVAL_STATE_DISABLED,
1274 > HistoryArchivalUri: "",
1275 > VisibilityArchivalState: enumspb.ARCHIVAL_STATE_DISABLED,
1276 > VisibilityArchivalUri: "",
1277 > BadBinaries: testBinaries2,
1278 > },
1279 > ReplicationConfig: &persistencespb.NamespaceReplicationConfig{
1280 > ActiveClusterName: clusterActive2,
1281 > Clusters: clusters2,
1282 > },
1283 > ConfigVersion: 400,
1284 > FailoverVersion: 667,
1285 > },
1286 > IsGlobalNamespace: false,
1287 > },
1288 > }
1289 > for _, namespace := range inputNamespaces {
1290 > _, err := m.CreateNamespace(
1291 > namespace.Namespace.Info,
1292 > namespace.Namespace.Config,
1293 > namespace.Namespace.ReplicationConfig,
1294 > namespace.IsGlobalNamespace,
1295 > namespace.Namespace.ConfigVersion,
1296 > namespace.Namespace.FailoverVersion,
1297 > )
1298 > m.NoError(err)
1299 > }
1300
1301 > var token []byte metadata_persistence_v2.go
1302 > const pageSize = 1
1303 > pageCount := 0
1304 > outputNamespaces := make(map[string]*p.GetNamespaceResponse)
1305 > for {
1306 > resp, err := m.ListNamespaces(pageSize, token)
1307 > m.NoError(err)
1308 > token = resp.NextPageToken
1309 > for _, namespace := range resp.Namespaces {
1310 > outputNamespaces[namespace.Namespace.Info.Id] = namespace
1311 > // global notification version is already tested, so here we make it 0
1312 > // so we can test == easily
1313 > namespace.NotificationVersion = 0
1314 > }
1315 // Some persistence backends return an unavoidable empty final page.
1316 > if len(resp.Namespaces) > 0 { metadata_persistence_v2.go
1317 > pageCount++
1318 > }
1319 > if len(token) == 0 {
1320 > break
1321 }
1322 }
1323
1324 // There should be 2 non-empty pages.
1325 > m.Equal(pageCount, 2) metadata_persistence_v2.go
1326 > m.Equal(len(inputNamespaces), len(outputNamespaces))
1327 > for _, namespace := range inputNamespaces {
1328 > m.DeepEqual(namespace, outputNamespaces[namespace.Namespace.Info.Id])
1329 > }
1330 }
1331