Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Commit

Permalink
e2e test to check parameters validation
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
  • Loading branch information
ndeloof committed Oct 24, 2019
1 parent f9f8aac commit fb320dc
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
29 changes: 29 additions & 0 deletions e2e/testdata/invalid/unused_parameter.dockerapp/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: "3.6"
services:
api:
image: python:3.6
networks:
back:
front:
aliases:
- api.example.com
- ${api.host}
web:
image: nginx:latest
networks:
- front
volumes:
- static:/opt/${static_subdir}
ports:
- ${web.port}:80
db:
image: postgres:9.3
networks:
- back
networks:
front:
back:
volumes:
static:
external: true
name: corp/web-static-data
8 changes: 8 additions & 0 deletions e2e/testdata/invalid/unused_parameter.dockerapp/metadata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 1.1.0-beta1
name: simple
description: "new fancy webapp with microservices"
maintainers:
- name: John Developer
email: john.dev@example.com
- name: Jane Developer
email: jane.dev@example.com
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
web:
port: '8082'
api:
host: example.com
static_subdir: data/static
unused:
parameter: FOO
19 changes: 19 additions & 0 deletions e2e/validate_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package e2e

import (
"path"
"testing"

"gotest.tools/assert"

"gotest.tools/icmd"
)

func TestOrphanedParameter(t *testing.T) {
cmd, cleanup := dockerCli.createTestCmd()
defer cleanup()
p := path.Join("testdata", "invalid", "unused_parameter")
cmd.Command = dockerCli.Command("app", "validate", p)
out := icmd.RunCmd(cmd).Assert(t, icmd.Expected{ExitCode: 1}).Combined()
assert.Equal(t, out, "unused.parameter is declared as parameter but not used by the compose file")
}

0 comments on commit fb320dc

Please sign in to comment.