metadata_persistence_v2.go ×1

Frontier kind: Code frontier

unlabeled · c_53a9e432879d

7 tests · 4318 LOC · 181 files · introduces 0 tests · 96 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
1 range96 lines · 1 files
Tests
0 tests

Contains — complete concept membership

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

Open complete file

1858
1859 // TestCreateNamespaceWithDuplicateID tests creating a namespace with an ID that already exists
1860 > func (m *MetadataPersistenceSuiteV2) TestCreateNamespaceWithDuplicateID() { metadata_persistence_v2.go
1861 > id := uuid.NewString()
1862 > name1 := "duplicate-id-test-namespace-1"
1863 > name2 := "duplicate-id-test-namespace-2"
1864 > state := enumspb.NAMESPACE_STATE_REGISTERED
1865 > description := "duplicate-id-test-description"
1866 > owner := "duplicate-id-test-owner"
1867 > data := map[string]string{"k1": "v1"}
1868 > retention := int32(10)
1869 > historyArchivalState := enumspb.ARCHIVAL_STATE_ENABLED
1870 > historyArchivalURI := "test://history/uri"
1871 > visibilityArchivalState := enumspb.ARCHIVAL_STATE_ENABLED
1872 > visibilityArchivalURI := "test://visibility/uri"
1873 >
1874 > clusterActive := "some random active cluster name"
1875 > clusterStandby := "some random standby cluster name"
1876 > configVersion := int64(10)
1877 > failoverVersion := int64(59)
1878 > isGlobalNamespace := true
1879 > clusters := []string{clusterActive, clusterStandby}
1880 >
1881 > // Create first namespace
1882 > resp1, err1 := m.CreateNamespace(
1883 > &persistencespb.NamespaceInfo{
1884 > Id: id,
1885 > Name: name1,
1886 > State: state,
1887 > Description: description,
1888 > Owner: owner,
1889 > Data: data,
1890 > },
1891 > &persistencespb.NamespaceConfig{
1892 > Retention: timestamp.DurationFromDays(retention),
1893 > HistoryArchivalState: historyArchivalState,
1894 > HistoryArchivalUri: historyArchivalURI,
1895 > VisibilityArchivalState: visibilityArchivalState,
1896 > VisibilityArchivalUri: visibilityArchivalURI,
1897 > },
1898 > &persistencespb.NamespaceReplicationConfig{
1899 > ActiveClusterName: clusterActive,
1900 > Clusters: clusters,
1901 > },
1902 > isGlobalNamespace,
1903 > configVersion,
1904 > failoverVersion,
1905 > )
1906 > m.NoError(err1)
1907 > m.NotNil(resp1)
1908 >
1909 > // Verify the namespace was created
1910 > getResp1, err2 := m.GetNamespace(id, "")
1911 > m.NoError(err2)
1912 > m.NotNil(getResp1)
1913 > m.Equal(name1, getResp1.Namespace.Info.Name)
1914 > m.Equal(id, getResp1.Namespace.Info.Id)
1915 >
1916 > // Try to create another namespace with the same ID but different name
1917 > _, err3 := m.CreateNamespace(
1918 > &persistencespb.NamespaceInfo{
1919 > Id: id, // Same ID as the first namespace
1920 > Name: name2,
1921 > State: state,
1922 > Description: "different description",
1923 > Owner: "different owner",
1924 > Data: map[string]string{"k2": "v2"},
1925 > },
1926 > &persistencespb.NamespaceConfig{
1927 > Retention: timestamp.DurationFromDays(retention * 2),
1928 > HistoryArchivalState: enumspb.ARCHIVAL_STATE_DISABLED,
1929 > HistoryArchivalUri: "",
1930 > VisibilityArchivalState: enumspb.ARCHIVAL_STATE_DISABLED,
1931 > VisibilityArchivalUri: "",
1932 > },
1933 > &persistencespb.NamespaceReplicationConfig{
1934 > ActiveClusterName: clusterActive,
1935 > Clusters: clusters,
1936 > },
1937 > isGlobalNamespace,
1938 > configVersion,
1939 > failoverVersion,
1940 > )
1941 > m.ErrorAs(err3, new(*serviceerror.NamespaceAlreadyExists))
1942 >
1943 > // Verify that the original namespace still exists and was not modified
1944 > getResp2, err4 := m.GetNamespace(id, "")
1945 > m.NoError(err4)
1946 > m.NotNil(getResp2)
1947 > m.Equal(name1, getResp2.Namespace.Info.Name) // Should still have the original name
1948 > m.Equal(description, getResp2.Namespace.Info.Description)
1949 > m.Equal(owner, getResp2.Namespace.Info.Owner)
1950 > m.Equal(id, getResp2.Namespace.Info.Id)
1951 >
1952 > // Verify that the second name doesn't exist in the system
1953 > _, err5 := m.GetNamespace("", name2)
1954 > m.ErrorAs(err5, new(*serviceerror.NamespaceNotFound))
1955 > }
1956
1957 // TestInitializeSystemNamespaces tests the initialization of system namespaces