Skip to content

Commit e8a0beb

Browse files
committed
cli/compose/schema: TestValidatePorts: use subtests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 1fe8d42 commit e8a0beb

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

cli/compose/schema/schema_test.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -117,20 +117,21 @@ func TestValidatePorts(t *testing.T) {
117117
}
118118

119119
for _, tc := range testcases {
120-
config := dict{
121-
"version": "3.0",
122-
"services": dict{
123-
"foo": dict{
124-
"image": "busybox",
125-
"ports": tc.ports,
120+
t.Run(fmt.Sprint(tc.ports), func(t *testing.T) {
121+
config := dict{
122+
"services": dict{
123+
"foo": dict{
124+
"image": "busybox",
125+
"ports": tc.ports,
126+
},
126127
},
127-
},
128-
}
129-
if tc.hasError {
130-
assert.ErrorContains(t, Validate(config, "3"), "services.foo.ports.0 Does not match format 'ports'")
131-
} else {
132-
assert.NilError(t, Validate(config, "3"))
133-
}
128+
}
129+
if tc.hasError {
130+
assert.ErrorContains(t, Validate(config, "3"), "services.foo.ports.0 Does not match format 'ports'")
131+
} else {
132+
assert.NilError(t, Validate(config, "3"))
133+
}
134+
})
134135
}
135136
}
136137

0 commit comments

Comments
 (0)