@@ -17,7 +17,7 @@ import (
1717 "github.com/pkg/errors"
1818 "github.com/stretchr/testify/require"
1919 "golang.org/x/exp/rand"
20- v1 "k8s.io/api/core/v1"
20+ corev1 "k8s.io/api/core/v1"
2121)
2222
2323const (
4747 clientPath = ciliumManifestsDir + "client-ds.yaml"
4848)
4949
50- func setupLRP (t * testing.T , ctx context.Context ) (* v1 .Pod , func ()) {
50+ func setupLRP (t * testing.T , ctx context.Context ) (* corev1 .Pod , func ()) {
5151 var cleanUpFns []func ()
5252 success := false
5353 cleanupFn := func () {
@@ -153,7 +153,7 @@ func setupLRP(t *testing.T, ctx context.Context) (*v1.Pod, func()) {
153153 return & selectedClientPod , cleanupFn
154154}
155155
156- func testLRPCase (t * testing.T , ctx context.Context , clientPod v1 .Pod , clientCmd []string , expectResponse , expectErrMsg string , countShouldIncrease bool ) {
156+ func testLRPCase (t * testing.T , ctx context.Context , clientPod corev1 .Pod , clientCmd []string , expectResponse , expectErrMsg string , countShouldIncrease bool ) {
157157 config := kubernetes .MustGetRestConfig ()
158158 cs := kubernetes .MustGetClientset ()
159159
@@ -179,11 +179,10 @@ func testLRPCase(t *testing.T, ctx context.Context, clientPod v1.Pod, clientCmd
179179 // in case there is time to propagate
180180 time .Sleep (500 * time .Millisecond )
181181
182- // curl again and see count increases
182+ // curl again and see count diff
183183 afterMetric , err := prometheus .GetMetric (promAddress , coreDNSRequestCountTotal , metricLabels )
184184 require .NoError (t , err )
185185
186- // count should go up
187186 if countShouldIncrease {
188187 require .Greater (t , afterMetric .GetCounter ().GetValue (), beforeMetric .GetCounter ().GetValue (), "dns metric count did not increase after command" )
189188 } else {
@@ -194,6 +193,7 @@ func testLRPCase(t *testing.T, ctx context.Context, clientPod v1.Pod, clientCmd
194193// TestLRP tests if the local redirect policy in a cilium cluster is functioning
195194// The test assumes the current kubeconfig points to a cluster with cilium (1.16+), cns,
196195// and kube-dns already installed. The lrp feature flag should be enabled in the cilium config
196+ // Does not check if cluster is in a stable state
197197// Resources created are automatically cleaned up
198198// From the lrp folder, run: go test ./ -v -tags "lrp" -run ^TestLRP$
199199func TestLRP (t * testing.T ) {
0 commit comments