2052
2053
// TestUpdateNamespaceNotFound tests updating a non-existent namespace
2055
>
nonExistentID := uuid.NewString()
2056
>
name := "non-existent-namespace"
2057
>
state := enumspb.NAMESPACE_STATE_REGISTERED
2058
>
description := "test-description"
2059
>
owner := "test-owner"
2060
>
data := map[string]string{"k1": "v1"}
2061
>
retention := int32(10)
2062
>
2063
>
clusterActive := "some random active cluster name"
2064
>
configVersion := int64(10)
2065
>
failoverVersion := int64(59)
2066
>
isGlobalNamespace := false
2067
>
2068
>
// Get current notification version
2069
>
metadata, err := m.MetadataManager.GetMetadata(m.ctx)
2070
>
m.NoError(err)
2071
>
notificationVersion := metadata.NotificationVersion
2072
>
2073
>
// Try to update a non-existent namespace
2074
>
_ = m.UpdateNamespace(
2075
>
&persistencespb.NamespaceInfo{
2076
>
Id: nonExistentID,
2077
>
Name: name,
2078
>
State: state,
2079
>
Description: description,
2080
>
Owner: owner,
2081
>
Data: data,
2082
>
},
2083
>
&persistencespb.NamespaceConfig{
2084
>
Retention: timestamp.DurationFromDays(retention),
2085
>
},
2086
>
&persistencespb.NamespaceReplicationConfig{
2087
>
ActiveClusterName: clusterActive,
2088
>
Clusters: []string{clusterActive},
2089
>
},
2090
>
configVersion,
2091
>
failoverVersion,
2092
>
0,
2093
>
time.Time{},
2094
>
notificationVersion,
2095
>
isGlobalNamespace,
2096
>
)
2097
>
2098
>
// Update operations may silently succeed on non-existent namespaces (no-op)
2099
>
// or may fail depending on implementation. For now, we just verify the operation completes.
2100
>
// The key test is that after the update, the namespace still doesn't exist.
2101
>
_, err3 := m.GetNamespace(nonExistentID, "")
2102
>
m.ErrorAs(err3, new(*serviceerror.NamespaceNotFound))
2103
>
}
2104
2105
// TestRenameNamespaceNotFound tests renaming a non-existent namespace