Skip to content

Commit

Permalink
Merge pull request #649 from cybozu-go/rename-pod-and-containers
Browse files Browse the repository at this point in the history
Rename test pod and containers
  • Loading branch information
masa213f committed Jul 13, 2023
2 parents dba8ec9 + 24e6092 commit 959a94c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions mtest/assets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package mtest

import _ "embed"

//go:embed nginx.yml
var nginxYAML []byte
//go:embed httpd.yml
var httpdYAML []byte

//go:embed reboot-deployment.yaml
var rebootDeploymentYAML []byte
Expand Down
6 changes: 3 additions & 3 deletions mtest/nginx.yml → mtest/httpd.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apiVersion: v1
kind: Pod
metadata:
name: nginx
name: httpd
labels:
app.kubernetes.io/name: nginx
app.kubernetes.io/name: httpd
spec:
containers:
- name: nginx
- name: httpd
image: quay.io/cybozu/testhttpd:0
hostNetwork: true
16 changes: 8 additions & 8 deletions mtest/kubernetes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ func testKubernetes() {
return nil
}).Should(Succeed())

By("running nginx")
_, stderr, err = kubectlWithInput(nginxYAML, "apply", "-f", "-", "-n="+namespace)
By("running httpd")
_, stderr, err = kubectlWithInput(httpdYAML, "apply", "-f", "-", "-n="+namespace)
Expect(err).NotTo(HaveOccurred(), "stderr=%s", stderr)

By("checking nginx pod status")
By("checking httpd pod status")
Eventually(func() error {
stdout, stderr, err := kubectl("get", "pods/nginx", "-n="+namespace, "-o", "json")
stdout, stderr, err := kubectl("get", "pods/httpd", "-n="+namespace, "-o", "json")
if err != nil {
return fmt.Errorf("%v: stderr=%s", err, stderr)
}
Expand Down Expand Up @@ -111,10 +111,10 @@ func testKubernetes() {
}).Should(Succeed())

By("deploying Service resource")
_, stderr, err = kubectlWithInput(nginxYAML, "apply", "-f", "-", "-n="+namespace)
_, stderr, err = kubectlWithInput(httpdYAML, "apply", "-f", "-", "-n="+namespace)
Expect(err).NotTo(HaveOccurred(), "stderr=%s", stderr)

_, stderr, err = kubectl("expose", "-n="+namespace, "pod", "nginx", "--port=8000")
_, stderr, err = kubectl("expose", "-n="+namespace, "pod", "httpd", "--port=8000")
Expect(err).NotTo(HaveOccurred(), "stderr=%s", stderr)

overrides := fmt.Sprintf(`{
Expand All @@ -138,12 +138,12 @@ func testKubernetes() {

By("resolving domain names")
Eventually(func() error {
_, stderr, err := kubectl("exec", "-n="+namespace, "client", "getent", "hosts", "nginx")
_, stderr, err := kubectl("exec", "-n="+namespace, "client", "getent", "hosts", "httpd")
if err != nil {
return fmt.Errorf("%v: stderr=%s", err, stderr)
}

_, stderr, err = kubectl("exec", "-n="+namespace, "client", "getent", "hosts", "nginx."+namespace+".svc.cluster.local")
_, stderr, err = kubectl("exec", "-n="+namespace, "client", "getent", "hosts", "httpd."+namespace+".svc.cluster.local")
if err != nil {
return fmt.Errorf("%v: stderr=%s", err, stderr)
}
Expand Down
2 changes: 1 addition & 1 deletion mtest/reboot-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
reboot-app: sample
spec:
containers:
- name: ubuntu
- name: httpd
image: quay.io/cybozu/testhttpd:0
---
apiVersion: policy/v1
Expand Down

0 comments on commit 959a94c

Please sign in to comment.