Skip to content

Commit 592afe4

Browse files
committed
address feedback
1 parent 7b76d21 commit 592afe4

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

.pipelines/singletenancy/cilium-overlay/cilium-overlay-e2e-step-template.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ steps:
7373

7474
- template: ../../templates/cilium-cli.yaml
7575

76-
7776
- script: |
7877
echo "Start Azilium E2E Tests on Overlay Cluster"
7978
if [ "$CILIUM_VERSION_TAG" = "cilium-nightly-pipeline" ]

test/integration/lrp/lrp_test.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ import (
1616
ciliumClientset "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned"
1717
"github.com/pkg/errors"
1818
"github.com/stretchr/testify/require"
19+
"golang.org/x/exp/rand"
1920
)
2021

2122
const (
22-
ciliumManifestsDir = "../manifests/cilium/lrp/"
23-
kubeSystemNamespace = "kube-system"
24-
dnsService = "kube-dns"
25-
// envCiliumDir = "DIR"
23+
ciliumConfigmapName = "cilium-config"
24+
ciliumManifestsDir = "../manifests/cilium/lrp/"
25+
enableLRPFlag = "enable-local-redirect-policy"
26+
kubeSystemNamespace = "kube-system"
27+
dnsService = "kube-dns"
2628
retryAttempts = 10
2729
retryDelay = 5 * time.Second
2830
promAddress = "http://localhost:9253/metrics"
@@ -62,8 +64,12 @@ func TestLRP(t *testing.T) {
6264
require.NoError(t, err)
6365
kubeDNS := svc.Spec.ClusterIP
6466

67+
// ensure lrp flag is enabled
68+
ciliumCM, err := kubernetes.GetConfigmap(ctx, cs, kubeSystemNamespace, ciliumConfigmapName)
69+
require.NoError(t, err)
70+
require.Equal(t, "true", ciliumCM.Data[enableLRPFlag], "enable-local-redirect-policy not set to true in cilium-config")
71+
6572
// 1.17 and 1.13 cilium versions of both files are identical
66-
// directory := os.Getenv(string(envCiliumDir))
6773
// read file
6874
nodeLocalDNSContent, err := os.ReadFile(nodeLocalDNSDaemonsetPath)
6975
require.NoError(t, err)
@@ -167,10 +173,13 @@ func TestLRP(t *testing.T) {
167173
require.Greater(t, afterMetric.GetCounter().GetValue(), beforeMetric.GetCounter().GetValue(), "dns metric count did not increase after nslookup")
168174
}
169175

176+
// TakeOne takes one item from the slice randomly; if empty, it returns the empty value for the type
177+
// Use in testing only
170178
func TakeOne[T any](slice []T) T {
171179
if len(slice) == 0 {
172180
var zero T
173181
return zero
174182
}
175-
return slice[0]
183+
rand.Seed(uint64(time.Now().UnixNano()))
184+
return slice[rand.Intn(len(slice))]
176185
}

test/internal/kubernetes/utils_get.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,11 @@ func GetService(ctx context.Context, clientset *kubernetes.Clientset, namespace,
6969
}
7070
return service, nil
7171
}
72+
73+
func GetConfigmap(ctx context.Context, clientset *kubernetes.Clientset, namespace, name string) (*corev1.ConfigMap, error) {
74+
configmap, err := clientset.CoreV1().ConfigMaps(namespace).Get(ctx, name, metav1.GetOptions{})
75+
if err != nil {
76+
return configmap, errors.Wrap(err, "could not get configmap")
77+
}
78+
return configmap, nil
79+
}

0 commit comments

Comments
 (0)