Skip to content

Commit

Permalink
fix: change the offline client from seed peer to peer
Browse files Browse the repository at this point in the history
Signed-off-by: BruceAko <chongzhi@hust.edu.cn>
  • Loading branch information
BruceAko committed Sep 30, 2024
1 parent 61e0147 commit 70ce6a8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
4 changes: 2 additions & 2 deletions test/e2e/v2/leave_host_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ var _ = Describe("Clients go offline normally and abnormally", func() {
hostCount := util.Servers[util.SeedClientServerName].Replicas + util.Servers[util.ClientServerName].Replicas
Expect(getHostCountFromScheduler(schedulerClient)).To(Equal(hostCount))

podName, err := util.GetClientPodName()
podName, err := util.GetClientPodName(1)
Expect(err).NotTo(HaveOccurred())

out, err := util.KubeCtlCommand("-n", util.DragonflyNamespace, "delete", "pod", podName).CombinedOutput()
fmt.Println(string(out))
Expect(err).NotTo(HaveOccurred())
Expect(getHostCountFromScheduler(schedulerClient)).To(Equal(hostCount))

podName, err = util.GetClientPodName()
podName, err = util.GetClientPodName(1)
Expect(err).NotTo(HaveOccurred())

out, err = util.KubeCtlCommand("-n", util.DragonflyNamespace, "delete", "pod", podName, "--force", "--grace-period=0").CombinedOutput()
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/v2/util/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ var Servers = map[string]server{
Name: ClientServerName,
Namespace: DragonflyNamespace,
LogDirName: "dfdaemon",
Replicas: 1,
Replicas: 2,
},
}
6 changes: 3 additions & 3 deletions test/e2e/v2/util/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func KubeCtlCopyCommand(ns, pod, source, target string) *exec.Cmd {
}

func ClientExec() (*PodExec, error) {
podName, err := GetClientPodName()
podName, err := GetClientPodName(0)
if err != nil {
return nil, err
}
Expand All @@ -126,9 +126,9 @@ func ManagerExec(n int) (*PodExec, error) {
return NewPodExec(DragonflyNamespace, podName, "manager"), nil
}

func GetClientPodName() (string, error) {
func GetClientPodName(n int) (string, error) {
out, err := KubeCtlCommand("-n", DragonflyNamespace, "get", "pod", "-l", "component=client",
"-o", fmt.Sprintf("jsonpath='{range .items[0]}{.metadata.name}{end}'")).CombinedOutput()
"-o", fmt.Sprintf("jsonpath='{range .items[%d]}{.metadata.name}{end}'", n)).CombinedOutput()
if err != nil {
return "", err
}
Expand Down
18 changes: 18 additions & 0 deletions test/testdata/kind/config-v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ networking:
ipFamily: dual
nodes:
- role: control-plane
image: kindest/node:v1.23.4
extraMounts:
- hostPath: ./test/testdata/containerd/config-v2.toml
containerPath: /etc/containerd/config.toml
- hostPath: /tmp/artifact
containerPath: /tmp/artifact
- hostPath: /dev/fuse
containerPath: /dev/fuse
- role: worker
image: kindest/node:v1.23.4
extraPortMappings:
- containerPort: 4001
Expand All @@ -22,3 +31,12 @@ nodes:
containerPath: /tmp/artifact
- hostPath: /dev/fuse
containerPath: /dev/fuse
- role: worker
image: kindest/node:v1.23.4
extraMounts:
- hostPath: ./test/testdata/containerd/config-v2.toml
containerPath: /etc/containerd/config.toml
- hostPath: /tmp/artifact
containerPath: /tmp/artifact
- hostPath: /dev/fuse
containerPath: /dev/fuse

0 comments on commit 70ce6a8

Please sign in to comment.