Skip to content

Commit

Permalink
use local instance of Pipelines to avoid having to rewrite the test e…
Browse files Browse the repository at this point in the history
…ach time

we add a resource to be tracked

Signed-off-by: Daniel Kiptoon <[email protected]>
  • Loading branch information
KiptoonKipkurui committed Feb 28, 2024
1 parent 8cf0c58 commit 290ccf0
Showing 1 changed file with 107 additions and 2 deletions.
109 changes: 107 additions & 2 deletions internal/config/crd_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,112 @@ var (
)

func TestWhiteListResources(t *testing.T) {

Pipelines = map[string]PipelineConfigs{
GlobalResourceKey: []PipelineConfig{
// Core Resources
{
Name: "namespaces.v1.",
PublishTo: DefaultPublishingSubject,
},
{
Name: "configmaps.v1.",
PublishTo: "meshery.meshsync.core",
Events: DefaultEvents,
},
{
Name: "nodes.v1.",
PublishTo: "meshery.meshsync.core",
Events: DefaultEvents,
},
{
Name: "secrets.v1.",
PublishTo: "meshery.meshsync.core",
Events: DefaultEvents,
},
{
Name: "persistentvolumes.v1.",
PublishTo: "meshery.meshsync.core",
Events: DefaultEvents,
},
{
Name: "persistentvolumeclaims.v1.",
PublishTo: "meshery.meshsync.core",
Events: DefaultEvents,
},
},
LocalResourceKey: []PipelineConfig{
// Core Resources
{
Name: "replicasets.v1.apps",
PublishTo: DefaultPublishingSubject,
},
{
Name: "pods.v1.",
PublishTo: DefaultPublishingSubject,
},
{
Name: "services.v1.",
PublishTo: DefaultPublishingSubject,
},
{
Name: "deployments.v1.apps",
PublishTo: DefaultPublishingSubject,
},
{
Name: "statefulsets.v1.apps",
PublishTo: DefaultPublishingSubject,
},
{
Name: "daemonsets.v1.apps",
PublishTo: DefaultPublishingSubject,
},
//Added Ingress support
{
Name: "ingresses.v1.networking.k8s.io",
PublishTo: DefaultPublishingSubject,
},
// Added endpoint support
{
Name: "endpoints.v1.",
PublishTo: DefaultPublishingSubject,
},
//Added endpointslice support
{
Name: "endpointslices.v1.discovery.k8s.io",
PublishTo: DefaultPublishingSubject,
},
// Added cronJob support
{
Name: "cronjobs.v1.batch",
PublishTo: DefaultPublishingSubject,
},
//Added ReplicationController support
{
Name: "replicationcontrollers.v1.",
PublishTo: DefaultPublishingSubject,
},
//Added storageClass support
{
Name: "storageclasses.v1.storage.k8s.io",
PublishTo: DefaultPublishingSubject,
},
//Added ClusterRole support
{
Name: "clusterroles.v1.rbac.authorization.k8s.io",
PublishTo: DefaultPublishingSubject,
},
//Added VolumeAttachment support
{
Name: "volumeattachments.v1.storage.k8s.io",
PublishTo: DefaultPublishingSubject,
},
//Added apiservice support
{
Name: "apiservices.v1.apiregistration.k8s.io",
PublishTo: DefaultPublishingSubject,
},
},
}
// Create an instance of the custom resource.
watchList := corev1.ConfigMap{
TypeMeta: metav1.TypeMeta{
Expand Down Expand Up @@ -106,7 +211,7 @@ func TestBlackListResources(t *testing.T) {
// excempted global pipelines: namespaces
// excempted local pipelines: pods, replicasets

if len(meshsyncConfig.Pipelines["global"]) != 6 {
if len(meshsyncConfig.Pipelines["global"]) != 5 {
t.Errorf("global pipelines not well configured got %d expected 6", len(meshsyncConfig.Pipelines["global"]))
}

Expand Down

0 comments on commit 290ccf0

Please sign in to comment.