@@ -29,7 +29,10 @@ testGeneration() {
29
29
30
30
if [[ " $lang " == " go" ]]; then
31
31
# Test that we have generated the test.pb.go file.
32
- expected_file_name=" /all/test/test.pb.go"
32
+ expected_file_name=" /all/test.pb.go"
33
+ if [[ " $extra_args " == * " --go-source-relative" * ]]; then
34
+ expected_file_name=" /all/test/test.pb.go"
35
+ fi
33
36
if [[ ! -f " $expected_output_dir$expected_file_name " ]]; then
34
37
echo " $expected_file_name file was not generated in $expected_output_dir "
35
38
exit 1
@@ -66,7 +69,7 @@ testGeneration() {
66
69
67
70
if [[ " $extra_args " == * " --go-plugin-micro" * ]]; then
68
71
# Test that we have generated the test.pb.micro.go file.
69
- expected_file_name=" /all/test/test .pb.micro.go"
72
+ expected_file_name=" /all/test.pb.micro.go"
70
73
if [[ ! -f " $expected_output_dir$expected_file_name " ]]; then
71
74
echo " $expected_file_name file was not generated in $expected_output_dir "
72
75
exit 1
@@ -75,7 +78,7 @@ testGeneration() {
75
78
76
79
if [[ " $extra_args " == * " --with-gateway" * ]]; then
77
80
# Test that we have generated the test.pb.gw.go file.
78
- expected_file_name1=" /all/test/test .pb.gw.go"
81
+ expected_file_name1=" /all/test.pb.gw.go"
79
82
expected_file_name2=" /all/test/test.swagger.json"
80
83
if [[ ! -f " $expected_output_dir$expected_file_name1 " ]]; then
81
84
echo " $expected_file_name1 file was not generated in $expected_output_dir "
@@ -101,6 +104,24 @@ testGeneration() {
101
104
fi
102
105
fi
103
106
107
+ # Test that we have generated the test.pb.go file.
108
+ expected_file_name=" /all/test.pb.go"
109
+ if [[ " $extra_args " == * " --with-validator" * ]]; then
110
+ expected_file_name1=" /all/test.pb.go"
111
+ expected_file_name2=" /all/test.pb.validate.go"
112
+ if [[ " $extra_args " == * " --validator-source-relative" * ]]; then
113
+ expected_file_name2=" /all/test/test.pb.validate.go"
114
+ fi
115
+ if [[ ! -f " $expected_output_dir$expected_file_name1 " ]]; then
116
+ echo " $expected_file_name1 file was not generated in $expected_output_dir "
117
+ exit 1
118
+ fi
119
+ if [[ ! -f " $expected_output_dir$expected_file_name2 " ]]; then
120
+ echo " $expected_file_name2 file was not generated in $expected_output_dir "
121
+ exit 1
122
+ fi
123
+ fi
124
+
104
125
rm -rf ` echo $expected_output_dir | cut -d ' /' -f1`
105
126
echo " Generating for $lang passed!"
106
127
}
@@ -114,6 +135,15 @@ testGeneration go "gen/pb-go" --with-gateway --with-openapi-json-names
114
135
# Test grpc-gateway generation + json (deprecated) (only valid for Go)
115
136
testGeneration go " gen/pb-go" --with-gateway --with-swagger-json-names
116
137
138
+ # Test go source relative generation
139
+ testGeneration go " gen/pb-go" --go-source-relative
140
+
141
+ # Test go validator
142
+ testGeneration go " gen/pb-go" --with-validator
143
+
144
+ # Test go validator with source relative option
145
+ testGeneration go " gen/pb-go" --with-validator --validator-source-relative
146
+
117
147
# Test go-micro generations
118
148
testGeneration go " gen/pb-go" --go-plugin-micro
119
149
0 commit comments