Skip to content

Commit 9d6febf

Browse files
authored
Merge pull request #1524 from LiZhenCheng9527/clean-e2e-shell
[clean] only install istiod when kmesh run e2e test
2 parents 18ccbeb + 902e737 commit 9d6febf

File tree

4 files changed

+30
-200
lines changed

4 files changed

+30
-200
lines changed

test/e2e/baseline_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ func TestBookinfo(t *testing.T) {
774774
})
775775

776776
fetchFn := testKube.NewSinglePodFetch(t.Clusters().Default(), namespace)
777-
if _, err := testKube.WaitUntilPodsAreReady(fetchFn); err != nil {
777+
if _, err := testKube.WaitUntilPodsAreReady(fetchFn, retry.Timeout(15*time.Minute), retry.Delay(5*time.Second)); err != nil {
778778
t.Fatalf("failed to wait bookinfo pods to be ready: %v", err)
779779
}
780780

@@ -797,7 +797,7 @@ func TestBookinfo(t *testing.T) {
797797
return true
798798
}
799799

800-
if err := retry.Until(checkBookinfo, retry.Timeout(600*time.Second), retry.Delay(1*time.Second)); err != nil {
800+
if err := retry.Until(checkBookinfo, retry.Timeout(900*time.Second), retry.Delay(3*time.Second)); err != nil {
801801
t.Fatal("failed to access bookinfo correctly: %v", err)
802802
}
803803

@@ -815,7 +815,7 @@ func TestBookinfo(t *testing.T) {
815815
UnsetWaypoint(t, namespace, "", Namespace)
816816
})
817817

818-
if err := retry.Until(checkBookinfo, retry.Timeout(600*time.Second), retry.Delay(1*time.Second)); err != nil {
818+
if err := retry.Until(checkBookinfo, retry.Timeout(900*time.Second), retry.Delay(3*time.Second)); err != nil {
819819
t.Fatal("failed to access bookinfo correctly when there is a namespace waypoint: %v", err)
820820
}
821821
})

test/e2e/main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,5 +370,5 @@ func deleteWaypointProxy(ctx resource.Context, ns namespace.Instance, name strin
370370
}
371371

372372
return nil
373-
}, retry.Timeout(time.Minute*10), retry.BackoffDelay(time.Millisecond*200))
373+
}, retry.Timeout(time.Minute*10), retry.BackoffDelay(time.Second*1))
374374
}

test/e2e/run_test.sh

Lines changed: 26 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,33 @@ function setup_istio() {
109109
echo "install istio $ISTIO_VERSION"
110110
kubectl get crd gateways.gateway.networking.k8s.io &>/dev/null ||
111111
{ kubectl kustomize "github.com/kubernetes-sigs/gateway-api/config/crd/experimental?ref=v1.1.0" | kubectl apply -f -; }
112+
# install istio CRD
113+
helm repo add istio https://istio-release.storage.googleapis.com/charts
114+
helm repo update
115+
helm install istio-base istio/base -n istio-system --create-namespace
112116

113-
istioctl install --set profile=ambient --set meshConfig.accessLogFile="/dev/stdout" --set components.ingressGateways[0].enabled=true --set components.ingressGateways[0].name=istio-ingressgateway --skip-confirmation
117+
helm install istiod istio/istiod --namespace istio-system --version $ISTIO_VERSION --set pilot.env.PILOT_ENABLE_AMBIENT=true --create-namespace
118+
119+
helm install istio-ingressgateway istio/gateway -n istio-system --create-namespace
120+
121+
while true; do
122+
pod_info=$(kubectl get pods -n istio-system -l app=istiod -o jsonpath='{range .items[*]}{.metadata.name}{" "}{.status.phase}{"\n"}{end}')
123+
124+
if [ -z "$pod_info" ]; then
125+
echo "No istiod pod found yet, waiting..."
126+
sleep 1
127+
continue
128+
fi
129+
130+
read -r pod_name pod_status <<<"$pod_info"
131+
if [ "$pod_status" = "Running" ]; then
132+
echo "Istiod pod $pod_name is in Running state."
133+
break
134+
fi
135+
136+
echo "Waiting for pods of Kmesh daemon to enter Running state..."
137+
sleep 1
138+
done
114139
}
115140

116141
function setup_kmesh() {
@@ -176,55 +201,6 @@ function setup_kmesh() {
176201
done
177202
}
178203

179-
function set_daemonupgarde_testcase_image() {
180-
local TMP_BUILD
181-
TMP_BUILD="$(mktemp -d)"
182-
echo "Building in temp dir: $TMP_BUILD"
183-
184-
git clone --depth 1 . "$TMP_BUILD" || {
185-
echo "git clone failed"
186-
rm -rf "$TMP_BUILD"
187-
return 1
188-
}
189-
190-
pushd "$TMP_BUILD" >/dev/null
191-
192-
BPF_HEADER_FILE="./bpf/include/bpf_common.h"
193-
echo "Modifying BPF header file: ${BPF_HEADER_FILE}"
194-
195-
sed -i \
196-
'/} kmesh_map64 SEC(".maps");/a\
197-
\
198-
struct {\
199-
__uint(type, BPF_MAP_TYPE_HASH);\
200-
__uint(key_size, sizeof(__u32));\
201-
__uint(value_size, MAP_VAL_SIZE_64);\
202-
__uint(max_entries, MAP_MAX_ENTRIES);\
203-
__uint(map_flags, BPF_F_NO_PREALLOC);\
204-
} kmesh_map64_bak_for_test SEC(".maps");' \
205-
"${BPF_HEADER_FILE}"
206-
207-
local HUB="localhost:5000"
208-
local TARGET="kmesh"
209-
local TAG="test-upgrade-map-change"
210-
local IMAGE="${HUB}/${TARGET}:${TAG}"
211-
212-
echo "Running 'make docker.push' with custom HUB and TAG in $TMP_BUILD"
213-
if ! HUB=${HUB} TARGET=${TARGET} TAG=${TAG} make docker.push; then
214-
echo "make docker.push failed"
215-
popd >/dev/null
216-
rm -rf "$TMP_BUILD"
217-
return 1
218-
fi
219-
220-
export KMESH_UPGRADE_IMAGE="${IMAGE}"
221-
echo "Built and pushed image: ${IMAGE}"
222-
223-
popd >/dev/null
224-
# rm -rf "$TMP_BUILD"
225-
return 0
226-
}
227-
228204
function setup_kmesh_log() {
229205
# Set log of each Kmesh pods.
230206
PODS=$(kubectl get pods -n kmesh-system -l app=kmesh -o jsonpath='{.items[*].metadata.name}')
@@ -395,10 +371,6 @@ while (("$#")); do
395371
PARAMS+=("-istio.test.nocleanup")
396372
shift
397373
;;
398-
--skip-build-daemonupgarde-image)
399-
SKIP_BUILD_UPGARDE=true
400-
shift
401-
;;
402374
*)
403375
PARAMS+=("$1")
404376
shift
@@ -420,9 +392,6 @@ if [[ -z ${SKIP_BUILD:-} ]]; then
420392
setup_kind_registry
421393
build_and_push_images
422394
install_kmeshctl
423-
if [[ -z ${SKIP_BUILD_UPGARDE:-} ]]; then
424-
set_daemonupgarde_testcase_image
425-
fi
426395
fi
427396

428397
kubectl config use-context "kind-$NAME"
@@ -459,6 +428,4 @@ if [[ -n ${CLEANUP_REGISTRY} ]]; then
459428
cleanup_docker_registry
460429
fi
461430

462-
#rm -rf "${TMP}"
463-
464431
exit $EXIT_CODE

test/e2e/upgarde_test.go

Lines changed: 0 additions & 137 deletions
This file was deleted.

0 commit comments

Comments
 (0)