-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore(clusterconfig): rename authentications to gather_authentication * chore(clusterconfig): rename ceph_cluster to gather_cepth_cluster * chore(clusterconfig): rename certificate_signing_requests to gather_certificate_signing_requests * chore(clusterconfig): rename config_maps to gather_config_maps * chore(clusterconfig): rename container_images to gather_container_images * chore(clusterconfig): rename container_runtime_configs to gather_container_runtime_configs * chore(clusterconfig): rename cost_management_metrics_configs to gather_cost_management_metrics_configs * chore(clusterconfig): rename custom_resource_definitions to gather_custom_resource_definitions * chore(clusterconfig): rename dvo_metrics to gather_dvo_metrics * chore(clusterconfig): rename feature_gates to gather_feature_gates * chore(clusterconfig): rename host_subnets to gather_host_subnets * chore(clusterconfig): rename image to gather_cluster_image * chore(clusterconfig): rename image_pruners to gather_image_pruners * chore(clusterconfig): rename image_registries to gather_cluster_image_registries * chore(clusterconfig): rename install_plans to gather_install_plans * chore(clusterconfig): rename jaeger_cr to gather_jaeger_cr * chore(clusterconfig): rename machine_autoscalers to gather_machine_autoscalers * chore(clusterconfig): rename machine_config_pools to gather_machine_config_pools * chore(clusterconfig): rename machine_configs to gather_machine_configs * chore(clusterconfig): rename machine_healthchecks to gather_machine_health_check * chore(clusterconfig): rename machine_sets to gather_machine_sets * chore(clusterconfig): rename machines to gather_machines * chore(clusterconfig): rename mutatingwebhookconfigurations to gather_mutating_webhook_configurations * chore(clusterconfig): rename namespaces_with_overlapping_uids to gather_namespaces_with_overlapping_uids * chore(clusterconfig): rename netnamespace to gather_net_namespace * chore(clusterconfig): rename node_logs to gather_node_logs * chore(clusterconfig): rename olm_operators to gather_olm_operators * chore(clusterconfig): rename openshift_logging to gather_openshift_logging * chore(clusterconfig): rename openshift_machine_api_events to gather_openshift_machine_api_events * chore(clusterconfig): rename operators to gather_cluster_operators * chore(clusterconfig): rename operators_pods_and_events to gather_cluster_operator_pods_and_events * chore(clusterconfig): rename pod_disruption_budgets to gather_pod_disruption_budgets * chore(clusterconfig): rename pod_network_connectivity_checks to gather_pod_network_connectivity_checks * chore(clusterconfig): rename sap_config to gather_sap_config * chore(clusterconfig): rename sap_datahubs to gather_sap_datahubs * chore(clusterconfig): rename sap_pods to gather_sap_pods * chore(clusterconfig): rename scheduler to gather_schedulers * chore(clusterconfig): rename service_accounts to gather_service_accounts * chore(clusterconfig): rename storage_cluster to gather_storage_cluster * chore(clusterconfig): rename support_secret to gather_support_secret * chore(clusterconfig): rename tsdb_status to gather_prometheus_tsdb_status * chore(clusterconfig): rename validatingwebhookconfigurations to gather_validating_webhook_configurations * test(clusterconfig): adjusting method names * chore(workloads): rename workload_info to gather_workload_info * docs(gathered-data): update gathered-data docs * refactor: sort the gatherers for configcluster * test(clusterconfig): add tests for gather_cluster_feature_gates * test(clusterconfig): add tests for gather_cluster_authentication * test(clusterconfig): adds unit test for gather_prometheus_tsdb_status * fix: adding lost gatherers on merge
- Loading branch information
Ricardo Lüders
authored
Jun 30, 2023
1 parent
8f64a40
commit d88e43c
Showing
86 changed files
with
339 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
63 changes: 63 additions & 0 deletions
63
pkg/gatherers/clusterconfig/gather_cluster_authentication_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package clusterconfig | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
configfake "github.com/openshift/client-go/config/clientset/versioned/fake" | ||
|
||
v1 "github.com/openshift/api/config/v1" | ||
"github.com/openshift/insights-operator/pkg/record" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func Test_gatherClusterAuthentication(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
authentication *v1.Authentication | ||
result []record.Record | ||
errCount int | ||
}{ | ||
{ | ||
name: "Retrieving authentication returns record of that authentication and no errors", | ||
authentication: &v1.Authentication{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "cluster", | ||
}, | ||
}, | ||
result: []record.Record{ | ||
{ | ||
Name: "config/authentication", | ||
Item: record.ResourceMarshaller{ | ||
Resource: &v1.Authentication{ | ||
ObjectMeta: metav1.ObjectMeta{Name: "cluster"}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
errCount: 0, | ||
}, | ||
{ | ||
name: "Retrieving no authentication returns no error/no records", | ||
authentication: &v1.Authentication{}, | ||
result: nil, | ||
}, | ||
} | ||
for _, testCase := range tests { | ||
tc := testCase | ||
t.Run(tc.name, func(t *testing.T) { | ||
t.Parallel() | ||
// Given | ||
configClient := configfake.NewSimpleClientset(tc.authentication) | ||
|
||
// When | ||
got, gotErrs := gatherClusterAuthentication(context.Background(), configClient.ConfigV1()) | ||
|
||
// Assert | ||
assert.Equal(t, tc.result, got) | ||
assert.Len(t, gotErrs, tc.errCount) | ||
}) | ||
} | ||
} |
File renamed without changes.
63 changes: 63 additions & 0 deletions
63
pkg/gatherers/clusterconfig/gather_cluster_feature_gates_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package clusterconfig | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
v1 "github.com/openshift/api/config/v1" | ||
|
||
configfake "github.com/openshift/client-go/config/clientset/versioned/fake" | ||
"github.com/openshift/insights-operator/pkg/record" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func Test_gatherClusterFeatureGates(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
feature *v1.FeatureGate | ||
result []record.Record | ||
errCount int | ||
}{ | ||
{ | ||
name: "Retrieving featuregate returns record of that featuregate and no errors", | ||
feature: &v1.FeatureGate{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "cluster", | ||
}, | ||
}, | ||
result: []record.Record{ | ||
{ | ||
Name: "config/featuregate", | ||
Item: record.ResourceMarshaller{ | ||
Resource: &v1.FeatureGate{ | ||
ObjectMeta: metav1.ObjectMeta{Name: "cluster"}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
errCount: 0, | ||
}, | ||
{ | ||
name: "Retrieving no featuregate returns no error/no record", | ||
feature: &v1.FeatureGate{}, | ||
result: nil, | ||
}, | ||
} | ||
for _, testCase := range tests { | ||
tc := testCase | ||
t.Run(tc.name, func(t *testing.T) { | ||
t.Parallel() | ||
// Given | ||
configClient := configfake.NewSimpleClientset(tc.feature) | ||
|
||
// When | ||
got, gotErrs := gatherClusterFeatureGates(context.Background(), configClient.ConfigV1()) | ||
|
||
// Assert | ||
assert.Equal(t, tc.result, got) | ||
assert.Len(t, gotErrs, tc.errCount) | ||
}) | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.