Skip to content

Commit

Permalink
chore: copy e2e proxy log to artifact (#962)
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Ma <[email protected]>
  • Loading branch information
jim3ma authored Dec 28, 2021
1 parent f6b1fc7 commit c6b7ab9
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 11 deletions.
23 changes: 23 additions & 0 deletions test/e2e/dfget_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,29 @@ var _ = Describe("Download with dfget and proxy", func() {
})
})

var _ = AfterSuite(func() {
// copy log files to artifact directory
for i := 0; i < 3; i++ {
out, err := e2eutil.KubeCtlCommand("-n", dragonflyE2ENamespace, "get", "pod", "-l", fmt.Sprintf("statefulset.kubernetes.io/pod-name=proxy-%d", i),
"-o", "jsonpath='{range .items[*]}{.metadata.name}{end}'").CombinedOutput()
if err != nil {
fmt.Printf("get pod error: %s\n", err)
continue
}
podName := strings.Trim(string(out), "'")
pod := e2eutil.NewPodExec(dragonflyE2ENamespace, podName, "proxy")

out, err = pod.Command("sh", "-c", fmt.Sprintf(`
set -x
cp /var/log/dragonfly/daemon/core.log /tmp/artifact/daemon/proxy-%d-core.log
cp /var/log/dragonfly/daemon/grpc.log /tmp/artifact/daemon/proxy-%d-grpc.log
`, i, i)).CombinedOutput()
if err != nil {
fmt.Printf("copy log output: %s, error: %s\n", string(out), err)
}
}
})

func singleDfgetTest(name, ns, label, podNamePrefix, container string) {
It(name, func() {
out, err := e2eutil.KubeCtlCommand("-n", ns, "get", "pod", "-l", label,
Expand Down
27 changes: 16 additions & 11 deletions test/testdata/k8s/proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ data:
insecure: false
url: https://index.docker.io
proxies:
- regx: blobs/sha256.*
- regx: file-server
- regx: blobs/sha256.*
- regx: file-server
---

Expand Down Expand Up @@ -116,16 +116,21 @@ spec:
volumeMounts:
- mountPath: /etc/dragonfly
name: config
- mountPath: /var/log/dragonfly/daemon
- mountPath: /var/log/dragonfly/
name: logs
- mountPath: /root/.dragonfly/dfget-daemon/
- mountPath: /var/lib/dragonfly/
name: data
- mountPath: /tmp/artifact
name: artifact
volumes:
- configMap:
defaultMode: 420
- name: config
configMap:
name: proxy
name: config
- emptyDir: {}
name: data
- emptyDir: {}
name: logs
defaultMode: 420
- name: data
emptyDir: { }
- name: logs
emptyDir: { }
- name: artifact
hostPath:
path: /tmp/artifact

0 comments on commit c6b7ab9

Please sign in to comment.