-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmanifest_validation_test.go
55 lines (47 loc) · 1.57 KB
/
manifest_validation_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package main
import (
"strings"
"testing"
)
func TestSimpleManifest(t *testing.T) {
err := ValidateManifest("testdata/simple-manifest.yml")
if err != nil {
t.Fatal("simple manifest should validate")
}
}
func TestAllMavenKeysManifest(t *testing.T) {
err := ValidateManifest("testdata/all-maven-keys-manifest.yml")
if err != nil {
t.Fatal("all maven keys manifest should validate")
}
}
func TestMissingManifest(t *testing.T) {
err := ValidateManifest("testdata/doesntexist")
if err == nil || !strings.HasPrefix(err.Error(), "failed to open manifest") {
t.Fatal("expected error opening file")
}
}
func TestInvalidManifest(t *testing.T) {
err := ValidateManifest("testdata/invalid-yaml-manifest.yml")
if err == nil || !strings.HasPrefix(err.Error(), "failed to parse manifest") {
t.Fatal("expected error parsing yaml")
}
}
func TestEmptyManifest(t *testing.T) {
err := ValidateManifest("testdata/empty-manifest.yml")
if err == nil || !strings.HasPrefix(err.Error(), "single application manifest required") {
t.Fatal("expected error for missing application")
}
}
func TestMultipleApplicationManifest(t *testing.T) {
err := ValidateManifest("testdata/multi-app-manifest.yml")
if err == nil || !strings.HasPrefix(err.Error(), "single application manifest required") {
t.Fatal("expected error for missing application")
}
}
func TestInvalidKey(t *testing.T) {
err := ValidateManifest("testdata/invalid-key-manifest.yml")
if err == nil || !strings.HasPrefix(err.Error(), "invalid key found in maven configuration") {
t.Fatal("expected error for invalid maven key")
}
}