@@ -1006,7 +1006,7 @@ func TestSyncCatalogSources(t *testing.T) {
10061006 clockFake := utilclocktesting .NewFakeClock (time .Date (2018 , time .January , 26 , 20 , 40 , 0 , 0 , time .UTC ))
10071007 now := metav1 .NewTime (clockFake .Now ())
10081008
1009- configmapCatalog := & v1alpha1.CatalogSource {
1009+ internalCatalog := & v1alpha1.CatalogSource {
10101010 ObjectMeta : metav1.ObjectMeta {
10111011 Name : "cool-catalog" ,
10121012 Namespace : "cool-namespace" ,
@@ -1017,6 +1017,17 @@ func TestSyncCatalogSources(t *testing.T) {
10171017 SourceType : v1alpha1 .SourceTypeInternal ,
10181018 },
10191019 }
1020+ configMapCatalog := & v1alpha1.CatalogSource {
1021+ ObjectMeta : metav1.ObjectMeta {
1022+ Name : "cool-catalog" ,
1023+ Namespace : "cool-namespace" ,
1024+ UID : types .UID ("catalog-uid" ),
1025+ },
1026+ Spec : v1alpha1.CatalogSourceSpec {
1027+ ConfigMap : "cool-configmap" ,
1028+ SourceType : v1alpha1 .SourceTypeConfigmap ,
1029+ },
1030+ }
10201031 grpcCatalog := & v1alpha1.CatalogSource {
10211032 ObjectMeta : metav1.ObjectMeta {
10221033 Name : "cool-catalog" ,
@@ -1061,7 +1072,7 @@ func TestSyncCatalogSources(t *testing.T) {
10611072 {
10621073 testName : "CatalogSourceWithBackingConfigMap" ,
10631074 namespace : "cool-namespace" ,
1064- catalogSource : configmapCatalog ,
1075+ catalogSource : internalCatalog ,
10651076 k8sObjs : []runtime.Object {
10661077 & corev1.ConfigMap {
10671078 ObjectMeta : metav1.ObjectMeta {
@@ -1141,7 +1152,7 @@ func TestSyncCatalogSources(t *testing.T) {
11411152 {
11421153 testName : "CatalogSourceWithMissingConfigMap" ,
11431154 namespace : "cool-namespace" ,
1144- catalogSource : configmapCatalog ,
1155+ catalogSource : internalCatalog ,
11451156 k8sObjs : []runtime.Object {
11461157 & corev1.ConfigMap {},
11471158 },
@@ -1198,6 +1209,19 @@ func TestSyncCatalogSources(t *testing.T) {
11981209 pod (t , * grpcCatalog ),
11991210 },
12001211 },
1212+ {
1213+ testName : "CatalogSourceWithGrpcType/CreatesNetworkPolicyResources" ,
1214+ namespace : "cool-namespace" ,
1215+ catalogSource : grpcCatalog ,
1216+ expectedObjs : []runtime.Object {
1217+ grpcServerNetworkPolicy (grpcCatalog , map [string ]string {
1218+ reconciler .CatalogSourceLabelKey : grpcCatalog .GetName (),
1219+ install .OLMManagedLabelKey : install .OLMManagedLabelValue ,
1220+ }),
1221+ unpackBundlesNetworkPolicy (grpcCatalog ),
1222+ },
1223+ expectedError : nil ,
1224+ },
12011225 {
12021226 testName : "CatalogSourceWithGrpcType/EnsuresImageOrAddressIsSet" ,
12031227 namespace : "cool-namespace" ,
@@ -1238,6 +1262,39 @@ func TestSyncCatalogSources(t *testing.T) {
12381262 },
12391263 expectedError : nil ,
12401264 },
1265+ {
1266+ testName : "CatalogSourceWithInternalType/CreatesNetworkPolicyResources" ,
1267+ namespace : "cool-namespace" ,
1268+ catalogSource : withStatus (* internalCatalog , v1alpha1.CatalogSourceStatus {
1269+ ConfigMapResource : & v1alpha1.ConfigMapResourceReference {
1270+ Name : "cool-configmap" ,
1271+ Namespace : "cool-namespace" ,
1272+ UID : "configmap-uid" ,
1273+ ResourceVersion : "resource-version" ,
1274+ LastUpdateTime : now ,
1275+ },
1276+ RegistryServiceStatus : nil ,
1277+ }),
1278+ k8sObjs : []runtime.Object {
1279+ & corev1.ConfigMap {
1280+ ObjectMeta : metav1.ObjectMeta {
1281+ Name : "cool-configmap" ,
1282+ Namespace : "cool-namespace" ,
1283+ UID : types .UID ("configmap-uid" ),
1284+ ResourceVersion : "resource-version" ,
1285+ },
1286+ Data : fakeConfigMapData (),
1287+ },
1288+ },
1289+ expectedObjs : []runtime.Object {
1290+ grpcServerNetworkPolicy (internalCatalog , map [string ]string {
1291+ reconciler .CatalogSourceLabelKey : internalCatalog .GetName (),
1292+ install .OLMManagedLabelKey : install .OLMManagedLabelValue ,
1293+ }),
1294+ unpackBundlesNetworkPolicy (internalCatalog ),
1295+ },
1296+ expectedError : nil ,
1297+ },
12411298 {
12421299 testName : "CatalogSourceWithConfigMapType/EnsuresConfigMapIsSet" ,
12431300 namespace : "cool-namespace" ,
@@ -1258,6 +1315,39 @@ func TestSyncCatalogSources(t *testing.T) {
12581315 },
12591316 expectedError : nil ,
12601317 },
1318+ {
1319+ testName : "CatalogSourceWithConfigMapType/CreatesNetworkPolicyResources" ,
1320+ namespace : "cool-namespace" ,
1321+ catalogSource : withStatus (* configMapCatalog , v1alpha1.CatalogSourceStatus {
1322+ ConfigMapResource : & v1alpha1.ConfigMapResourceReference {
1323+ Name : "cool-configmap" ,
1324+ Namespace : "cool-namespace" ,
1325+ UID : "configmap-uid" ,
1326+ ResourceVersion : "resource-version" ,
1327+ LastUpdateTime : now ,
1328+ },
1329+ RegistryServiceStatus : nil ,
1330+ }),
1331+ k8sObjs : []runtime.Object {
1332+ & corev1.ConfigMap {
1333+ ObjectMeta : metav1.ObjectMeta {
1334+ Name : "cool-configmap" ,
1335+ Namespace : "cool-namespace" ,
1336+ UID : types .UID ("configmap-uid" ),
1337+ ResourceVersion : "resource-version" ,
1338+ },
1339+ Data : fakeConfigMapData (),
1340+ },
1341+ },
1342+ expectedObjs : []runtime.Object {
1343+ grpcServerNetworkPolicy (configMapCatalog , map [string ]string {
1344+ reconciler .CatalogSourceLabelKey : configMapCatalog .GetName (),
1345+ install .OLMManagedLabelKey : install .OLMManagedLabelValue ,
1346+ }),
1347+ unpackBundlesNetworkPolicy (configMapCatalog ),
1348+ },
1349+ expectedError : nil ,
1350+ },
12611351 {
12621352 testName : "GRPCConnectionStateAddressIsUpdated" ,
12631353 namespace : "cool-namespace" ,
0 commit comments