metadata_persistence_v2.go ×1

Frontier kind: Code frontier

unlabeled · c_7a517373dd7b

7 tests · 4316 LOC · 181 files · introduces 0 tests · 94 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
1 range94 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
766 ranges4316 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: 94 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 94 introduced LOC · 1 range

Open complete file

1762
1763 // TestCreateNamespaceWithDuplicateName tests creating a namespace with a name that already exists
1764 > func (m *MetadataPersistenceSuiteV2) TestCreateNamespaceWithDuplicateName() { metadata_persistence_v2.go
1765 > id1 := uuid.NewString()
1766 > name := "duplicate-name-test-namespace"
1767 > state := enumspb.NAMESPACE_STATE_REGISTERED
1768 > description := "duplicate-name-test-description"
1769 > owner := "duplicate-name-test-owner"
1770 > data := map[string]string{"k1": "v1"}
1771 > retention := int32(10)
1772 > historyArchivalState := enumspb.ARCHIVAL_STATE_ENABLED
1773 > historyArchivalURI := "test://history/uri"
1774 > visibilityArchivalState := enumspb.ARCHIVAL_STATE_ENABLED
1775 > visibilityArchivalURI := "test://visibility/uri"
1776 >
1777 > clusterActive := "some random active cluster name"
1778 > clusterStandby := "some random standby cluster name"
1779 > configVersion := int64(10)
1780 > failoverVersion := int64(59)
1781 > isGlobalNamespace := true
1782 > clusters := []string{clusterActive, clusterStandby}
1783 >
1784 > // Create first namespace
1785 > resp1, err1 := m.CreateNamespace(
1786 > &persistencespb.NamespaceInfo{
1787 > Id: id1,
1788 > Name: name,
1789 > State: state,
1790 > Description: description,
1791 > Owner: owner,
1792 > Data: data,
1793 > },
1794 > &persistencespb.NamespaceConfig{
1795 > Retention: timestamp.DurationFromDays(retention),
1796 > HistoryArchivalState: historyArchivalState,
1797 > HistoryArchivalUri: historyArchivalURI,
1798 > VisibilityArchivalState: visibilityArchivalState,
1799 > VisibilityArchivalUri: visibilityArchivalURI,
1800 > },
1801 > &persistencespb.NamespaceReplicationConfig{
1802 > ActiveClusterName: clusterActive,
1803 > Clusters: clusters,
1804 > },
1805 > isGlobalNamespace,
1806 > configVersion,
1807 > failoverVersion,
1808 > )
1809 > m.NoError(err1)
1810 > m.NotNil(resp1)
1811 >
1812 > // Verify the namespace was created
1813 > getResp1, err2 := m.GetNamespace(id1, "")
1814 > m.NoError(err2)
1815 > m.NotNil(getResp1)
1816 > m.Equal(name, getResp1.Namespace.Info.Name)
1817 >
1818 > // Try to create another namespace with the same name but different ID
1819 > id2 := uuid.NewString()
1820 > _, err3 := m.CreateNamespace(
1821 > &persistencespb.NamespaceInfo{
1822 > Id: id2,
1823 > Name: name, // Same name as the first namespace
1824 > State: state,
1825 > Description: "different description",
1826 > Owner: "different owner",
1827 > Data: map[string]string{"k2": "v2"},
1828 > },
1829 > &persistencespb.NamespaceConfig{
1830 > Retention: timestamp.DurationFromDays(retention * 2),
1831 > HistoryArchivalState: enumspb.ARCHIVAL_STATE_DISABLED,
1832 > HistoryArchivalUri: "",
1833 > VisibilityArchivalState: enumspb.ARCHIVAL_STATE_DISABLED,
1834 > VisibilityArchivalUri: "",
1835 > },
1836 > &persistencespb.NamespaceReplicationConfig{
1837 > ActiveClusterName: clusterActive,
1838 > Clusters: clusters,
1839 > },
1840 > isGlobalNamespace,
1841 > configVersion,
1842 > failoverVersion,
1843 > )
1844 > m.ErrorAs(err3, new(*serviceerror.NamespaceAlreadyExists))
1845 >
1846 > // Verify that the original namespace still exists and was not modified
1847 > getResp2, err4 := m.GetNamespace(id1, "")
1848 > m.NoError(err4)
1849 > m.NotNil(getResp2)
1850 > m.Equal(name, getResp2.Namespace.Info.Name)
1851 > m.Equal(description, getResp2.Namespace.Info.Description)
1852 > m.Equal(owner, getResp2.Namespace.Info.Owner)
1853 >
1854 > // Verify that the second namespace ID does not exist
1855 > _, err5 := m.GetNamespace(id2, "")
1856 > m.ErrorAs(err5, new(*serviceerror.NamespaceNotFound))
1857 > }
1858
1859 // TestCreateNamespaceWithDuplicateID tests creating a namespace with an ID that already exists