Add test for bad volumes
This commit is contained in:
@@ -71,6 +71,14 @@ services:
|
|||||||
labels:
|
labels:
|
||||||
katenary.io/same-pod: http3
|
katenary.io/same-pod: http3
|
||||||
|
|
||||||
|
# unmapped volumes
|
||||||
|
novol:
|
||||||
|
image: nginx
|
||||||
|
volumes:
|
||||||
|
- /tmp/data
|
||||||
|
labels:
|
||||||
|
katenary.io/ports: 80
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
data:
|
data:
|
||||||
driver: local
|
driver: local
|
||||||
@@ -263,3 +271,23 @@ func TestIngress(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check unmapped volumes
|
||||||
|
func TestUnmappedVolumes(t *testing.T) {
|
||||||
|
tmp, p := setUp(t)
|
||||||
|
defer os.RemoveAll(tmp)
|
||||||
|
|
||||||
|
for name := range p.Data.Services {
|
||||||
|
if name == "novol" {
|
||||||
|
path := filepath.Join(tmp, "templates", name+".deployment.yaml")
|
||||||
|
fp, _ := os.Open(path)
|
||||||
|
defer fp.Close()
|
||||||
|
lines, _ := ioutil.ReadAll(fp)
|
||||||
|
for _, line := range strings.Split(string(lines), "\n") {
|
||||||
|
if strings.Contains(line, "novol-data") {
|
||||||
|
t.Error("novol service should not have a volume")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user