@@ -17,6 +17,31 @@ func TestDefinitionsValidation(t *testing.T) {
17
17
ErrorAssertion func (err error , msgAndArgs ... interface {}) bool
18
18
CustomAssertion func (defs * Definitions )
19
19
}{
20
+ {
21
+ Title : "should succeed with script type alone" ,
22
+ TomlDefinitions : `
23
+ name = "example"
24
+ types = ["script"]
25
+ version = "v1.0.0"
26
+ language = "go"
27
+ product = "SDS"
28
+ ` ,
29
+ ErrorAssertion : a .NoError ,
30
+ },
31
+ {
32
+ Title : "should not have script service type with other types" ,
33
+ TomlDefinitions : `
34
+ name = "example"
35
+ types = ["grpc", "http", "script"]
36
+ version = "v1.0.0"
37
+ language = "go"
38
+ product = "SDS"
39
+ ` ,
40
+ ErrorAssertion : a .Error ,
41
+ Expected : []string {
42
+ "failed on the 'single_script' tag" ,
43
+ },
44
+ },
20
45
{
21
46
Title : "should not have duplicated service types" ,
22
47
TomlDefinitions : `
@@ -28,7 +53,7 @@ product = "SDS"
28
53
` ,
29
54
ErrorAssertion : a .Error ,
30
55
Expected : []string {
31
- "cannot have duplicated service types " ,
56
+ "failed on the 'no_duplicated_service' tag " ,
32
57
},
33
58
},
34
59
{
@@ -113,40 +138,6 @@ emitted_events = [ "VEHICLE_CREATED" ]
113
138
DefsAssertion : a .NotNil ,
114
139
ErrorAssertion : a .Error ,
115
140
},
116
- {
117
- Title : "should fail with wrong tracing names" ,
118
- TomlDefinitions : `
119
- name = "service_test"
120
- types = ["grpc"]
121
- version = "v0.1.0"
122
- language = "go"
123
- product = "SDS"
124
-
125
- [features.database]
126
- kind = "mongo"
127
- ttl = 0
128
-
129
- [[features.tracing.collectors]]
130
- name = "error01"
131
- kind = "counter"
132
- description = "just a simple error counter"
133
-
134
- [[features.tracing.collectors]]
135
- name = "error02 abc"
136
- kind = "counter"
137
- description = "another simple error counter"
138
-
139
- [[features.tracing.collectors]]
140
- name = "error02-abc-EFG"
141
- kind = "counter"
142
- description = "another simple error counter"
143
- ` ,
144
- ErrorAssertion : a .Error ,
145
- Expected : []string {
146
- "Key: 'Definitions.Features.Tracing.Collectors[1].Name' Error:Field validation for 'Name' failed on the 'collector_name' tag" ,
147
- "Key: 'Definitions.Features.Tracing.Collectors[2].Name' Error:Field validation for 'Name' failed on the 'collector_name' tag" ,
148
- },
149
- },
150
141
{
151
142
Title : "succeed with service custom settings" ,
152
143
TomlDefinitions : `
0 commit comments