Skip to content

Commit cb8e7a3

Browse files
Addressed review commands.
1 parent cbcca65 commit cb8e7a3

File tree

1 file changed

+1
-112
lines changed

1 file changed

+1
-112
lines changed

Tests/kaas/kaas-sonobuoy-tests/scs_k8s_conformance_tests/scs_0215_v1_robustness_features_test.go

Lines changed: 1 addition & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ import (
1414

1515
// ==================== Helper Functions ====================
1616

17-
// isKindCluster determines if we're running on a kind cluster
18-
func isKindCluster(clientset *kubernetes.Clientset) bool {
19-
return false
20-
}
21-
2217
// setupClientset creates a Kubernetes clientset
2318
func setupClientset() (*kubernetes.Clientset, error) {
2419
config, err := rest.InClusterConfig()
@@ -53,6 +48,7 @@ func Test_scs_0215_requestLimits(t *testing.T) {
5348
"max-requests-inflight",
5449
"max-mutating-requests-inflight",
5550
"min-request-timeout",
51+
"EventRateLimit",
5652
}
5753

5854
for _, container := range apiServer.Spec.Containers {
@@ -74,9 +70,6 @@ func Test_scs_0215_requestLimits(t *testing.T) {
7470
t.Errorf("Required setting %s not found in API server configuration", setting)
7571
}
7672
}
77-
if !foundSettings["EventRateLimit"] {
78-
t.Error("EventRateLimit admission plugin not enabled")
79-
}
8073
})
8174
}
8275

@@ -116,10 +109,6 @@ func Test_scs_0215_eventRateLimit(t *testing.T) {
116109
t.Fatalf("Failed to setup clientset: %v", err)
117110
}
118111

119-
if isKindCluster(clientset) {
120-
t.Skip("Running on kind cluster - skipping EventRateLimit test")
121-
}
122-
123112
t.Run("Check_EventRateLimit_Configuration", func(t *testing.T) {
124113
configLocations := []struct {
125114
name string
@@ -160,10 +149,6 @@ func Test_scs_0215_apiPriorityAndFairness(t *testing.T) {
160149
t.Fatalf("Failed to setup clientset: %v", err)
161150
}
162151

163-
if isKindCluster(clientset) {
164-
t.Skip("Running on kind cluster - skipping APF test")
165-
}
166-
167152
t.Run("Check_APF_Configuration", func(t *testing.T) {
168153
pods, err := clientset.CoreV1().Pods("kube-system").List(context.Background(), metav1.ListOptions{
169154
LabelSelector: "component=kube-apiserver",
@@ -185,108 +170,12 @@ func Test_scs_0215_apiPriorityAndFairness(t *testing.T) {
185170
})
186171
}
187172

188-
func Test_scs_0215_rateLimitValues(t *testing.T) {
189-
clientset, err := setupClientset()
190-
if err != nil {
191-
t.Fatalf("Failed to setup clientset: %v", err)
192-
}
193-
194-
if isKindCluster(clientset) {
195-
t.Skip("Running on kind cluster - skipping rate limit values test")
196-
}
197-
198-
t.Run("Check_Rate_Limit_Values", func(t *testing.T) {
199-
expectedValues := map[string]string{
200-
"qps": "5000",
201-
"burst": "20000",
202-
}
203-
204-
configMaps, _ := clientset.CoreV1().ConfigMaps("kube-system").List(context.Background(), metav1.ListOptions{})
205-
for _, cm := range configMaps.Items {
206-
var config string
207-
switch {
208-
case strings.Contains(cm.Name, "event-rate-limit"):
209-
config = cm.Data["config.yaml"]
210-
case cm.Name == "admission-configuration":
211-
config = cm.Data["eventratelimit.yaml"]
212-
case cm.Name == "kube-apiserver":
213-
config = cm.Data["config.yaml"]
214-
}
215-
216-
if config != "" {
217-
allFound := true
218-
for k, v := range expectedValues {
219-
if !strings.Contains(config, fmt.Sprintf("%s: %s", k, v)) {
220-
allFound = false
221-
break
222-
}
223-
}
224-
if allFound {
225-
return
226-
}
227-
}
228-
}
229-
230-
t.Error("Recommended rate limit values (qps: 5000, burst: 20000) not found")
231-
})
232-
}
233-
234-
func Test_scs_0215_etcdCompaction(t *testing.T) {
235-
clientset, err := setupClientset()
236-
if err != nil {
237-
t.Fatalf("Failed to setup clientset: %v", err)
238-
}
239-
240-
if isKindCluster(clientset) {
241-
t.Skip("Running on kind cluster - skipping etcd compaction test")
242-
}
243-
244-
t.Run("Check_Etcd_Compaction_Settings", func(t *testing.T) {
245-
pods, err := clientset.CoreV1().Pods("kube-system").List(context.Background(), metav1.ListOptions{
246-
LabelSelector: "component=etcd",
247-
})
248-
if err != nil || len(pods.Items) == 0 {
249-
t.Skip("No etcd pods found")
250-
return
251-
}
252-
253-
requiredSettings := map[string]string{
254-
"auto-compaction-mode": "periodic",
255-
"auto-compaction-retention": "8h",
256-
}
257-
258-
for _, pod := range pods.Items {
259-
for _, container := range pod.Spec.Containers {
260-
foundSettings := make(map[string]bool)
261-
for _, arg := range container.Command {
262-
for setting, value := range requiredSettings {
263-
if strings.Contains(arg, fmt.Sprintf("--%s=%s", setting, value)) {
264-
foundSettings[setting] = true
265-
}
266-
}
267-
}
268-
269-
if len(foundSettings) == len(requiredSettings) {
270-
t.Log("Found correct etcd compaction settings")
271-
return
272-
}
273-
}
274-
}
275-
276-
t.Error("Required etcd compaction settings not found")
277-
})
278-
}
279-
280173
func Test_scs_0215_etcdBackup(t *testing.T) {
281174
clientset, err := setupClientset()
282175
if err != nil {
283176
t.Fatalf("Failed to setup clientset: %v", err)
284177
}
285178

286-
if isKindCluster(clientset) {
287-
t.Skip("Running on kind cluster - skipping etcd backup test")
288-
}
289-
290179
t.Run("Check_Etcd_Backup_Configuration", func(t *testing.T) {
291180
cronJobs, err := clientset.BatchV1().CronJobs("").List(context.Background(), metav1.ListOptions{})
292181
if err == nil {

0 commit comments

Comments
 (0)