metadata_persistence_v2.go ×1

Frontier kind: Code frontier

unlabeled · c_d8b3e523759e

7 tests · 4385 LOC · 181 files · introduces 0 tests · 98 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
1 range98 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
781 ranges4385 lines · 181 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: 98 introduced LOC across 1 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/common/persistence/persistence-tests/metadata_persistence_v2.go 98 introduced LOC · 1 range

Open complete file

1599
1600 // TestRenameNamespaceWithNameConflict tests name conflict when trying to rename a namespace
1601 > func (m *MetadataPersistenceSuiteV2) TestRenameNamespaceWithNameConflict() { metadata_persistence_v2.go
1602 > id1 := uuid.NewString()
1603 > name1 := "rename-conflict-namespace-1"
1604 > id2 := uuid.NewString()
1605 > name2 := "rename-conflict-namespace-2"
1606 > state := enumspb.NAMESPACE_STATE_REGISTERED
1607 > description := "rename-conflict-test-description"
1608 > owner := "rename-conflict-test-owner"
1609 > data := map[string]string{"k1": "v1"}
1610 > retention := int32(10)
1611 > historyArchivalState := enumspb.ARCHIVAL_STATE_ENABLED
1612 > historyArchivalURI := "test://history/uri"
1613 > visibilityArchivalState := enumspb.ARCHIVAL_STATE_ENABLED
1614 > visibilityArchivalURI := "test://visibility/uri"
1615 >
1616 > clusterActive := "some random active cluster name"
1617 > clusterStandby := "some random standby cluster name"
1618 > configVersion := int64(10)
1619 > failoverVersion := int64(59)
1620 > isGlobalNamespace := true
1621 > clusters := []string{clusterActive, clusterStandby}
1622 >
1623 > // Create first namespace
1624 > resp1, err1 := m.CreateNamespace(
1625 > &persistencespb.NamespaceInfo{
1626 > Id: id1,
1627 > Name: name1,
1628 > State: state,
1629 > Description: description,
1630 > Owner: owner,
1631 > Data: data,
1632 > },
1633 > &persistencespb.NamespaceConfig{
1634 > Retention: timestamp.DurationFromDays(retention),
1635 > HistoryArchivalState: historyArchivalState,
1636 > HistoryArchivalUri: historyArchivalURI,
1637 > VisibilityArchivalState: visibilityArchivalState,
1638 > VisibilityArchivalUri: visibilityArchivalURI,
1639 > },
1640 > &persistencespb.NamespaceReplicationConfig{
1641 > ActiveClusterName: clusterActive,
1642 > Clusters: clusters,
1643 > },
1644 > isGlobalNamespace,
1645 > configVersion,
1646 > failoverVersion,
1647 > )
1648 > m.NoError(err1)
1649 > m.EqualValues(id1, resp1.ID)
1650 >
1651 > // Create second namespace
1652 > resp2, err2 := m.CreateNamespace(
1653 > &persistencespb.NamespaceInfo{
1654 > Id: id2,
1655 > Name: name2,
1656 > State: state,
1657 > Description: description,
1658 > Owner: owner,
1659 > Data: data,
1660 > },
1661 > &persistencespb.NamespaceConfig{
1662 > Retention: timestamp.DurationFromDays(retention),
1663 > HistoryArchivalState: historyArchivalState,
1664 > HistoryArchivalUri: historyArchivalURI,
1665 > VisibilityArchivalState: visibilityArchivalState,
1666 > VisibilityArchivalUri: visibilityArchivalURI,
1667 > },
1668 > &persistencespb.NamespaceReplicationConfig{
1669 > ActiveClusterName: clusterActive,
1670 > Clusters: clusters,
1671 > },
1672 > isGlobalNamespace,
1673 > configVersion,
1674 > failoverVersion,
1675 > )
1676 > m.NoError(err2)
1677 > m.EqualValues(id2, resp2.ID)
1678 >
1679 > // Try to rename namespace1 to the same name as namespace2 (should fail)
1680 > err3 := m.MetadataManager.RenameNamespace(m.ctx, &p.RenameNamespaceRequest{
1681 > PreviousName: name1,
1682 > NewName: name2,
1683 > })
1684 > // The error should be a conflict/unavailable error due to CAS failure
1685 > m.ErrorAs(err3, new(*serviceerror.Unavailable))
1686 >
1687 > // Verify that we can still query namespace2 by name, proving the rename didn't affect it
1688 > resp5, err5 := m.GetNamespace("", name2)
1689 > m.NoError(err5)
1690 > m.Equal(name2, resp5.Namespace.Info.Name)
1691 > m.Equal(id2, resp5.Namespace.Info.Id)
1692 >
1693 > // Verify that namespace1 can still be queried by its original name
1694 > resp6, err6 := m.GetNamespace("", name1)
1695 > m.NoError(err6)
1696 > m.Equal(name1, resp6.Namespace.Info.Name)
1697 > m.Equal(id1, resp6.Namespace.Info.Id)
1698 > }
1699
1700 // TestGetMetadataVersionIncrement tests that GetMetadata correctly increments the version after a namespace is created