Skip to content

Commit

Permalink
Add test to check that MySQL pod can become guarranteed QoS
Browse files Browse the repository at this point in the history
Signed-off-by: Masayuki Ishii <masa213f@gmail.com>
  • Loading branch information
masa213f committed Jun 2, 2023
1 parent 2ac6d95 commit 4766408
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions e2e/lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,23 @@ var _ = Context("lifecycle", func() {
}).Should(Succeed())
})

It("should give a pod the guarranteed QoS class", func() {
Eventually(func() error {
out, err := kubectl(nil, "get", "-n", "foo", "pod", "moco-single-0", "-o", "json")
if err != nil {
return err
}
pod := &corev1.Pod{}
if err := json.Unmarshal(out, pod); err != nil {
return err
}
if pod.Status.QOSClass != corev1.PodQOSGuaranteed {
return fmt.Errorf("mysql pod is not the Guarranteed QoS class: %s", pod.Status.QOSClass)
}
return nil
}).Should(Succeed())
})

It("should log slow queries via sidecar", func() {
out := kubectlSafe(nil, "moco", "-n", "foo", "mysql", "single", "--", "-N", "-e", "SELECT @@long_query_time")
val, err := strconv.ParseFloat(strings.TrimSpace(string(out)), 64)
Expand Down
4 changes: 4 additions & 0 deletions e2e/testdata/single.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ spec:
containers:
- name: mysqld
image: quay.io/cybozu/mysql:{{ . }}
resources:
limits:
cpu: "0.5"
memory: 1Gi
volumeClaimTemplates:
- metadata:
name: mysql-data
Expand Down

0 comments on commit 4766408

Please sign in to comment.