Skip to content

Commit

Permalink
Fix the etcd failover e2e tests.
Browse files Browse the repository at this point in the history
Signed-off-by: Ye Cao <[email protected]>
  • Loading branch information
dashanji committed Aug 14, 2024
1 parent 05986d8 commit dbfbf1c
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
8 changes: 6 additions & 2 deletions k8s/test/e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ load-vineyardd-image:
@docker push localhost:5001/vineyardd:latest
.PHONY: load-vineyardd-image

load-vineyard-python-dev-image:
@docker tag ghcr.io/v6d-io/v6d/vineyard-python-dev:latest localhost:5001/vineyard-python-dev:latest
@docker push localhost:5001/vineyard-python-dev:latest

load-vineyard-operator-image:
@docker tag vineyardcloudnative/vineyard-operator:latest localhost:5001/vineyard-operator:latest
@docker push localhost:5001/vineyard-operator:latest
Expand Down Expand Up @@ -248,13 +252,13 @@ e2e-tests-failover: prepare-e2e-test install-vineyard-cluster

############# etcd failover testing #############################################

e2e-tests-three-etcd-nodes-failover: prepare-e2e-test build-local-cluster load-vineyardd-image
e2e-tests-three-etcd-nodes-failover: prepare-e2e-test build-local-cluster load-vineyardd-image load-vineyard-python-dev-image
@echo "Running three etcd nodes failover e2e test..."
@cd ${ROOT_DIR} && ${GOBIN}/e2e run --config=${E2E_DIR}/etcd-failover/three-etcd-nodes-failover-e2e.yaml
@echo "three etcd nodes failover e2e test passed."
@make delete-local-cluster

e2e-tests-five-etcd-nodes-failover: prepare-e2e-test build-local-cluster load-vineyardd-image
e2e-tests-five-etcd-nodes-failover: prepare-e2e-test build-local-cluster load-vineyardd-image load-vineyard-python-dev-image
@echo "Running five etcd nodes failover e2e test..."
@cd ${ROOT_DIR} && ${GOBIN}/e2e run --config=${E2E_DIR}/etcd-failover/five-etcd-nodes-failover-e2e.yaml
@echo "five etcd nodes failover e2e test passed."
Expand Down
4 changes: 2 additions & 2 deletions k8s/test/e2e/etcd-failover/consumer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ spec:
restartPolicy: Never
containers:
- name: consumer
image: python:3.10
image: localhost:5001/vineyard-python-dev:latest
imagePullPolicy: IfNotPresent
command:
- bash
- -c
- |
pip install vineyard numpy pandas --index-url https://pypi.tuna.tsinghua.edu.cn/simple;
cat << EOF >> consumer.py
import vineyard
client = vineyard.connect(host="vineyardd-svc.default.svc.cluster.local",port=9600)
Expand Down
3 changes: 2 additions & 1 deletion k8s/test/e2e/etcd-failover/five-etcd-nodes-failover-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ setup:
done
kubectl delete pod "vineyardd-$num1" -n default --force
kubectl delete pod "vineyardd-$num2" -n default --force
kubectl rollout status statefulset/vineyardd
# wait for the instance quit messages to be propagated
sleep 240
sleep 360
kubectl rollout status statefulset/vineyardd
done
- name: install consumer
Expand Down
6 changes: 3 additions & 3 deletions k8s/test/e2e/etcd-failover/producer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ spec:
restartPolicy: Never
containers:
- name: producer
image: python:3.10
image: localhost:5001/vineyard-python-dev:latest
imagePullPolicy: IfNotPresent
command:
- bash
- -c
- |
pip install vineyard numpy pandas --index-url https://pypi.tuna.tsinghua.edu.cn/simple;
cat << EOF >> producer.py
import vineyard
import numpy as np
Expand All @@ -42,4 +42,4 @@ spec:
client.put(data, persist=True, name="test_data");
client.close()
EOF
python producer.py;
python producer.py;
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ setup:
kubectl delete pod vineyardd-$(shuf -i 0-2 -n 1) -n default --force
kubectl rollout status statefulset/vineyardd
# wait for the instance quit messages to be propagated
sleep 60
sleep 120
kubectl rollout status statefulset/vineyardd
done
- name: install consumer
Expand Down
1 change: 0 additions & 1 deletion src/server/util/etcd_launcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ Status EtcdLauncher::LaunchEtcdServer(
etcd_client.reset(new etcd::Client(etcd_endpoints_));
if (probeEtcdServer(etcd_client, sync_lock)) {
etcd_member_id_ = findMemberID(etcd_client, peer_endpoint);
std::cout << "%%%%%%%%%%%%%%%%%set " << etcd_member_id_ << std::endl;
// reset the etcd watcher
break;
}
Expand Down
6 changes: 1 addition & 5 deletions src/server/util/etcd_launcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ class EtcdLauncher {
std::string generateMemberName(
const std::vector<std::string>& existing_members_name);

const uint64_t GetMemberID() {
std::cout << "LLLLLLLLLLLLLLl etcd_member_id_: " << etcd_member_id_
<< std::endl;
return etcd_member_id_;
}
const uint64_t GetMemberID() { return etcd_member_id_; }

Status RemoveMember(std::unique_ptr<etcd::Client>& etcd_client,
const uint64_t& member_id) {
Expand Down

0 comments on commit dbfbf1c

Please sign in to comment.